New:Introducing Socket Scanning for VS Code Marketplace Extensions.Learn more →
Get Started

sitebill/ymlparser

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sitebill/ymlparser

YML (Yandex Market Language) parser

Source
Packagist
Version
1.0.1
Version published
Total downloads
5
Maintainers
1
Created
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 "sitebill/ymlparser": "^1.0" package to your require section in the composer.json file

or

$ php composer.phar require sitebill/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.

Keywords

parser

FAQs

Package last updated on 16 Feb 2024

Related posts