Awesome Open Source
Awesome Open Source

YML (Yandex Market Language) parser

Latest Stable Version Total Downloads License

About

YML (Yandex Market Language) streaming parser with validation. Based on XMLReader. Suitable for large files.

Install

Add the "lireincore/ymlparser": "^3.2" package to your require section in the composer.json file

or

$ php composer.phar require lireincore/ymlparser

Usage

use LireinCore\YMLParser\YML;

$yml = new YML();
try {
    $yml->parse($filepath);
    $date = $yml->getDate();
    $shop = $yml->getShop();
    if ($shop->isValid()) {
        $offersCount = $shop->getOffersCount();
        $shopData = $shop->getData();
        //...
        foreach ($yml->getOffers() as $offer) {
            if ($offer->isValid()) {
                $offerCategoryHierarchy = $shop->getCategoryHierarchy($offer->getCategoryId());
                $offerData = $offer->getData();
                //...
            } else {
                var_dump($offer->getErrors());
                //...
            }
        }
    } else {
        var_dump($shop->getErrors());
        //...
    }
} catch (\Exception $e) {
    echo $e->getMessage();
    //...
}

License

The MIT License (MIT). Please see License File for more information.


Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
php (16,077
parser (499
yandex (38
yml (17

Find Open Source By Browsing 7,000 Topics Across 59 Categories