Simple, fast, and extension-free parser for eXeLearning project files
Features | Installation | Usage
ELP Parser provides a simple and intuitive API to parse eXeLearning project files (.elp):
- Parse both version 2 and version 3 .elp files
- Extract text content from XML
- Detect file version
- Extract entire .elp file contents
- No external extensions required
- Lightweight and easy to use (less than 4 KB footprint library)
- Compatible with PHP 8.0 to PHP 8.5
For more information, visit the documentation.
- PHP 8.0+
- Composer
- zip extension
Install the package via Composer:
composer require exelearning/elp-parser
use Exelearning\ELPParser;
try {
// Parse an .elp file
$parser = ELPParser::fromFile('/path/to/your/project.elp');
// Get the file version
$version = $parser->getVersion(); // Returns 2 or 3
// Get metadata fields
$title = $parser->getTitle();
$description = $parser->getDescription();
$author = $parser->getAuthor();
$license = $parser->getLicense();
$language = $parser->getLanguage();
// Get all extracted strings
$strings = $parser->getStrings();
// Print extracted strings
foreach ($strings as $string) {
echo $string . "\n";
}
} catch (Exception $e) {
echo "Error parsing ELP file: " . $e->getMessage();
}
use Exelearning\ELPParser;
try {
$parser = ELPParser::fromFile('/path/to/your/project.elp');
// Extract entire .elp contents to a directory
$parser->extract('/path/to/destination/folder');
} catch (Exception $e) {
echo "Error extracting ELP file: " . $e->getMessage();
}
// Convert parsed data to array
$data = $parser->toArray();
// JSON serialization
$jsonData = json_encode($parser);
The parser includes robust error handling:
- Detects invalid .elp files
- Throws exceptions for parsing errors
- Supports both version 2 and 3 file formats
- Lightweight implementation
- Minimal memory footprint
- Fast XML parsing using native PHP extensions
Contributions are welcome! Please submit pull requests or open issues on our GitHub repository.
The MIT License (MIT). Please see License File for more information.