Simple parser for eXeLearning project files.
Features | Installation | Usage
ELPParser supports the two eXeLearning project families described in the upstream format docs:
- Legacy
.elpprojects from eXeLearning 2.x based oncontentv3.xml - Modern
.elpxprojects from eXeLearning 3+ based oncontent.xmland ODE 2.0 - Modern
.elpexports that also usecontent.xml - Detection of eXeLearning major version when the package exposes it
- Heuristic detection of likely v4-style
.elpxpackages using rootcontent.dtd - Extraction of normalized metadata, strings, pages, idevices and asset references
- Safe archive extraction with ZIP path traversal checks
- JSON serialization support
For more information, visit the documentation.
- PHP 8.0+
- Composer
zipextensionsimplexmlextension
composer require exelearning/elp-parseruse Exelearning\ELPParser;
try {
$parser = ELPParser::fromFile('/path/to/project.elpx');
$version = $parser->getVersion();
$title = $parser->getTitle();
$description = $parser->getDescription();
$author = $parser->getAuthor();
$license = $parser->getLicense();
$language = $parser->getLanguage();
foreach ($parser->getStrings() as $string) {
echo $string . "\n";
}
} catch (Exception $e) {
echo "Error parsing project: " . $e->getMessage();
}use Exelearning\ELPParser;
$parser = ELPParser::fromFile('/path/to/project.elpx');
echo $parser->getSourceExtension(); // elp | elpx
echo $parser->getContentFormat(); // legacy-contentv3 | ode-content
echo $parser->getContentFile(); // contentv3.xml | content.xml
echo $parser->getContentSchemaVersion(); // 2.0 for modern ODE packages
echo $parser->getExeVersion(); // raw upstream version string when present
echo $parser->getResourceLayout(); // none | content-resources | legacy-temp-paths | mixed
var_dump($parser->hasRootDtd()); // true when content.dtd exists at archive root
var_dump($parser->isLikelyVersion4Package());$pages = $parser->getPages();
$visiblePages = $parser->getVisiblePages();
$blocks = $parser->getBlocks();
$idevices = $parser->getIdevices();
$pageTexts = $parser->getPageTexts();
$visiblePageTexts = $parser->getVisiblePageTexts();
$firstPageText = $parser->getPageTextById($pages[0]['id']);
$teacherOnlyIdevices = $parser->getTeacherOnlyIdevices();
$hiddenIdevices = $parser->getHiddenIdevices();
$assets = $parser->getAssets();
$images = $parser->getImages();
$audioFiles = $parser->getAudioFiles();
$videoFiles = $parser->getVideoFiles();
$documents = $parser->getDocuments();
$assetsDetailed = $parser->getAssetsDetailed();
$orphanAssets = $parser->getOrphanAssets();
$metadata = $parser->getMetadata();In modern content.xml packages, assets usually live under paths such as content/resources/....
Older projects and some transitional exports may still reference legacy layouts such as files/tmp/....
The parser exposes this through getResourceLayout().
$json = $parser->exportJson();
$parser->exportJson('/path/to/output.json');$parser->extract('/path/to/destination');The parser distinguishes between project format and eXeLearning version:
getContentFormat()tells you whether the package uses legacycontentv3.xmlor moderncontent.xmlgetVersion()reports the detected eXeLearning major version- In practice this means:
- eXeLearning 2.x legacy
.elp=> version2 - modern ODE-based
.elp=> usually version3 .elpxpackages with rootcontent.dtdare treated as likely v4-style packages and currently report version4- otherwise modern ODE-based packages default to version
3
- eXeLearning 2.x legacy
This distinction matters because some projects created with newer eXeLearning builds still identify themselves internally with exe_version=3.0, so strict v4 detection is not always possible from the package alone.
For that reason, the library combines explicit metadata with format heuristics:
.elpxcontent.xml- root
content.dtd - optionally
content/resources/...as the modern resource layout
The parser throws exceptions for:
- Missing files
- Invalid ZIP archives
- Unsupported project layouts
- XML parsing failures
- Unsafe archive entries during extraction
The MIT License (MIT). Please see License File for more information.