- Laravel 11
- PHP 8.2 or higher
- ext-simplexml enabled
This package is available on Packagist via Composer and can be installed with the following command:
composer require drei-d/laravel-xentral-orders-parser
Once installed, you can parse a file using the OrderParserService
:
$orderDto = app(\DREID\LaravelXentralOrdersParser\Services\OrderParserService::class)->parseFromDisk(
'<disk>',
'<filepath>'
);
You can also just parse the xml content without reading it from a file beforehand:
$orderDto = app(\DREID\LaravelXentralOrdersParser\Services\OrderParserService::class)->parse('<xml>');
That's already it. You're good to go.
Enjoy!