API Reference
Exelearning\ELPParser
Construction
__construct(string $filePath, ?ArchiveLimits $limits = null)
Create and immediately parse an eXeLearning project.
fromFile(string $filePath, ?ArchiveLimits $limits = null): ELPParser
Factory equivalent to the constructor.
fromStream(mixed $stream, string $extension = 'elpx', ?ArchiveLimits $limits = null): ELPParser
Parse a readable PHP stream using bounded temporary-file spooling.
fromContents(string $contents, string $extension = 'elpx', ?ArchiveLimits $limits = null): ELPParser
Parse in-memory project bytes.
inspect(string $filePath, ?ArchiveLimits $limits = null): array
Read core format/version/project metadata without fully normalizing pages, iDevices or assets.
inspectStream(mixed $stream, string $extension = 'elpx', ?ArchiveLimits $limits = null): array
Lightweight inspection for stream input.
inspectContents(string $contents, string $extension = 'elpx', ?ArchiveLimits $limits = null): array
Lightweight inspection for in-memory project bytes.
Detection and configuration
supports(string $filePath, ArchiveLimits|ParserOptions|null $options = null): boolidentify(string $filePath, ArchiveLimits|ParserOptions|null $options = null): stringprobe(string $filePath, ArchiveLimits|ParserOptions|null $options = null): arraygetOptions(): ParserOptions
ParserOptions groups archive limits with optional expensive derived-data features:
parseAssetscollectStringsnormalizeIdeviceState
Existing calls that pass ArchiveLimits directly remain supported.
Version and format
getVersion(): int— detected major version kept for backward compatibility.getVersionInfo(): array— declared version, declared major, detected major, detection source and signals.getSourceExtension(): stringgetContentFormat(): stringgetFormatFamily(): string—legacyorode.getContentFile(): stringgetContentSchemaVersion(): ?stringgetFormatVersion(): ?string— internal format version such as ODE2.0, independent of eXeLearning 3/4.getExeVersion(): ?stringgetApplicationVersion(): ?string— raw declared eXeLearning application version.getPackageProfile(): string— compatibility profile such aslegacy-v2,elpx-v3orelpx-v4.getResourceLayout(): stringgetResourceProfile(): string—v3-uuid-resources,v4-resource-tree,mixed-modern-resources,legacy-temp-pathsornone.hasRootDtd(): boolisLikelyVersion4Package(): boolisLegacyFormat(): bool
ODE project data
getUserPreferences(): arraygetOdeResources(): arraygetOdeProperties(): arraygetProjectId(): ?stringgetProjectVersionId(): ?string
Core metadata
getTitle(): stringgetDescription(): stringgetAuthor(): stringgetLicense(): stringgetLanguage(): stringgetLearningResourceType(): stringgetMetadata(): array
Parsed content
getStrings(): arraygetPages(): arraygetPageTree(): arraygetPageById(string $pageId): ?arraygetVisiblePages(): arraygetBlocks(): arraygetBlockById(string $blockId): ?arraygetIdevices(): arraygetIdeviceById(string $ideviceId): ?arraygetPageTexts(): arraygetVisiblePageTexts(): arraygetPageTextById(string $pageId): ?arraygetTeacherOnlyIdevices(): arraygetHiddenIdevices(): array
Assets
getAssets(): arraygetAssetsDetailed(): arraygetImages(): arraygetAudioFiles(): arraygetVideoFiles(): arraygetDocuments(): arraygetOrphanAssets(): arraygetMissingAssets(): arraygetBrokenReferences(): arraygetArchiveEntries(): arrayhasEntry(string $entryName): boolgetEntryContents(string $entryName, ?int $maxBytes = null): stringcopyEntryToStream(string $entryName, $output, ?int $maxBytes = null): intextractEntry(string $entryName, string $destinationPath, ?int $maxBytes = null): voidgetInternalLinks(): arraygetBrokenInternalLinks(): arraygetUsedIdeviceTypes(): arraygetAvailableIdeviceTypes(): arraygetMissingIdeviceRuntimes(): arraygetPackageManifest(): array
Asset references are returned only when they resolve to an entry in the project archive. Both the v3 long form ({{context_path}}/content/resources/...) and the v4 form ({{context_path}}/<exportPath>) are resolved.
Typed model API
getProject(): Exelearning\\Model\\Project- Model wrappers:
Project,Page,Block,Idevice,Asset,VersionInfo. - The typed API is additive; existing array-returning APIs remain supported.
Fingerprints and comparison
getArchiveFingerprint(string $algorithm = 'sha256'): stringgetArchiveEntryFingerprint(string $entryName, string $algorithm = 'sha256'): stringgetContentFingerprint(string $algorithm = 'sha256'): stringhasSameContentAs(ELPParser $other, string $algorithm = 'sha256'): booldiff(ELPParser $other, string $algorithm = 'sha256'): array
Archive fingerprints hash exact ZIP bytes. Content fingerprints normalize logical project data, exclude volatile package identity/version metadata and include project resource hashes.
Serialization and extraction
toArray(): arraytoDetailedArray(): arraygetDetailedSchemaVersion(): stringgetDetailedJsonSchemaPath(): stringgetDetailedJsonSchema(): stringjsonSerialize(): mixedexportJson(?string $destinationPath = null): stringexportDetailedJson(?string $destinationPath = null): stringextract(string $destinationPath): void
Exelearning\Archive\ArchiveLimits
Configures limits applied before and during archive processing:
new ArchiveLimits(
maxEntries: 20000,
maxEntryBytes: 1073741824,
maxTotalBytes: 2147483647,
maxXmlBytes: 67108864,
maxCompressionRatio: 1000.0
);
Exceptions
All parser-specific exceptions extend Exelearning\Exception\ElpParserException:
InvalidArchiveExceptionInvalidXmlExceptionUnsupportedFormatExceptionUnsafeArchiveExceptionResourceLimitException
Validation
validate(): array— alias ofvalidatePackage().validateResult(): Exelearning\\Validation\\ValidationResult— typed diagnostics while preserving the array API.validatePackage(): array— structural/package diagnostics withvalid,errorsandwarnings.validateSchema(string $schemaPath, string $type = 'xsd'): array— validate the project XML against a caller-supplied trusted local XSD or DTD.
Use Exelearning\Validation\SchemaValidator::TYPE_XSD or TYPE_DTD. Schema validation is optional and requires the DOM extension.
Normalized iDevice state
Modern iDevice records include:
jsonPropertiesRaw— unmodifiedjsonPropertiespayload.storagePattern—standard-json,data-game,embedded-jsonorhtml-only.data— normalized decoded state when available.stateDecodeError— decoding error text without making project parsing fail.
The existing html and decoded jsonProperties fields remain available.
Validation models
Exelearning\Validation\DiagnosticExelearning\Validation\ValidationResult
ValidationResult provides isValid(), errors(), warnings(), has(), toArray() and JSON serialization.
Custom iDevice decoders
Implement Exelearning\Parser\IdeviceDecoderInterface, register instances in IdeviceDecoderRegistry, then pass the registry through ParserOptions::$ideviceDecoders.
The first registered decoder whose supports() method returns true supplies customDecoder and customData fields for the normalized iDevice.