PHPackages                             sirian/yandex-market-language-parser - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. sirian/yandex-market-language-parser

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

sirian/yandex-market-language-parser
====================================

Yandex Market Language parser

v4.0.0(1mo ago)1847.5k↓12.5%13[2 issues](https://github.com/sirian/php-yml-parser/issues)PHPPHP &gt;=8.3CI passing

Since May 16Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/sirian/php-yml-parser)[ Packagist](https://packagist.org/packages/sirian/yandex-market-language-parser)[ RSS](/packages/sirian-yandex-market-language-parser/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependencies (4)Versions (8)Used By (0)

Yandex Market Language Parser
=============================

[](#yandex-market-language-parser)

[![CI](https://github.com/sirian/php-yml-parser/actions/workflows/ci.yml/badge.svg)](https://github.com/sirian/php-yml-parser/actions/workflows/ci.yml)

Streaming parser for [Yandex Market Language](https://yandex.ru/support/partnermarket/yml/about-yml.xml) (YML) feeds.

Uses `XMLReader` for the outer scan and `SimpleXMLElement` for per-offer parsing, so the whole catalog is never loaded in memory — offers arrive as a `Generator`.

Requirements
------------

[](#requirements)

- PHP **&gt;= 8.3**
- Extensions: `ext-mbstring`, `ext-simplexml`, `ext-xmlreader`, `ext-libxml`

Installation
------------

[](#installation)

```
composer require sirian/yandex-market-language-parser
```

Usage
-----

[](#usage)

```
use Sirian\YMLParser\Parser;

$parser = new Parser();
$result = $parser->parse('/path/to/catalog.xml');

$shop = $result->getShop();
echo $shop->getName();

foreach ($shop->getCategories() as $category) {
    echo $category->getId(), ': ', $category->getName(), "\n";
}

foreach ($result->getOffers() as $offer) {
    echo $offer->getId(), ' — ', $offer->getName(), "\n";
}
```

### Offer types

[](#offer-types)

`Sirian\YMLParser\Factory\Factory::createOffer()` returns:

`type` attributeclass`vendor.model``Sirian\YMLParser\Model\Offer\VendorModelOffer``book``Sirian\YMLParser\Model\Offer\BookOffer`*anything else*`Sirian\YMLParser\Model\Offer\Offer`*absent*`Sirian\YMLParser\Model\Offer\VendorModelOffer` (default)### Customization

[](#customization)

Provide a custom `FactoryInterface` to swap any model/storage implementation:

```
use Sirian\YMLParser\Factory\Factory;
use Sirian\YMLParser\Model\Offer\Offer;
use Sirian\YMLParser\Parser;

$factory = new class () extends Factory {
    public function createOffer(string $type): Offer
    {
        // return your own subclass
        return parent::createOffer($type);
    }
};

$parser = new Parser($factory);
```

### Extending offer field mapping

[](#extending-offer-field-mapping)

`Offer::applyField(string $field, string $value): bool` maps XML child elements onto setters. Override it in your own offer subclass to handle YML fields beyond the built-in ones:

```
final class MyOffer extends VendorModelOffer
{
    public function applyField(string $field, string $value): bool
    {
        if ('country_of_origin' === $field) {
            $this->country = $value;
            return true;
        }

        return parent::applyField($field, $value);
    }
}
```

Any field can also be accessed via the raw XML — `$offer->getXml()` / `$shop->getXml()`.

Development
-----------

[](#development)

```
composer install
vendor/bin/phpunit        # tests + coverage
vendor/bin/phpstan analyse # static analysis (level 8)
vendor/bin/php-cs-fixer fix --dry-run --diff  # code style
```

License
-------

[](#license)

MIT

###  Health Score

62

—

FairBetter than 99% of packages

Maintenance91

Actively maintained with recent releases

Popularity41

Moderate usage in the ecosystem

Community14

Small or concentrated contributor base

Maturity83

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 93.3% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~742 days

Recently: every ~915 days

Total

6

Last Release

35d ago

Major Versions

v1.0.0 → v2.0.02016-07-08

v2.0.0 → v3.0.02016-07-08

v3.0.2 → v4.0.02026-07-15

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/897643?v=4)[Sirian](/maintainers/Sirian)[@sirian](https://github.com/sirian)

---

Top Contributors

[![sirian](https://avatars.githubusercontent.com/u/897643?v=4)](https://github.com/sirian "sirian (28 commits)")[![alitvinenko](https://avatars.githubusercontent.com/u/1942268?v=4)](https://github.com/alitvinenko "alitvinenko (1 commits)")[![bulychev](https://avatars.githubusercontent.com/u/4833024?v=4)](https://github.com/bulychev "bulychev (1 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/sirian-yandex-market-language-parser/health.svg)

```
[![Health](https://phpackages.com/badges/sirian-yandex-market-language-parser/health.svg)](https://phpackages.com/packages/sirian-yandex-market-language-parser)
```

###  Alternatives

[mwgg/airports

A JSON collection of ~29k entries with basic information about nearly every airport and landing strip in the world

7683.4k](/packages/mwgg-airports)[sauladam/shipment-tracker

Parses tracking information for several carriers, like UPS, USPS, DHL and GLS by simply scraping the data. No need for any kind of API access.

9845.4k](/packages/sauladam-shipment-tracker)[glauberportella/cnab-layouts-parser

Parser de arquivos de configuração CNAB gerados no projeto https://github.com/glauberportella/cnab-layouts

2154.5k](/packages/glauberportella-cnab-layouts-parser)[tcds-io/php-jackson

A lightweight, flexible object serializer for PHP, inspired by FasterXML/jackson

113.4k10](/packages/tcds-io-php-jackson)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
