YML (Yandex Market Language) parser for PHP.
Add the lireincore/ymlparser
package to your require
section in the composer.json
file
or
$ composer require lireincore/ymlparser
use LireinCore\YMLParser\YML;
$yml = new YML();
try {
$yml->parse($filepath);
$date = $yml->getDate();
$shop = $yml->getShop();
$offersCount = $shop->getOffersCount();
$shopData = $shop->getData();
/**@var \LireinCore\YMLParser\Offer\AOffer $offer*/
foreach ($yml->getOffers() as $offer) {
$offerCategoryHierarchy = $shop->getCategoryHierarchy($offer->getCategoryId);
$offerData = $offer->getData();
//...
}
} catch (\Exception $e) {
//...
}
The MIT License (MIT). Please see License File for more information.