PHPackages                             serkin/ymlparser - 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. serkin/ymlparser

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

serkin/ymlparser
================

Parser for yml(yandex.market.ru) files

v1.1.2(11y ago)114.1k7[1 issues](https://github.com/serkin/ymlparser/issues)MITPHPPHP &gt;=5.5

Since Apr 29Pushed 10y ago2 watchersCompare

[ Source](https://github.com/serkin/ymlparser)[ Packagist](https://packagist.org/packages/serkin/ymlparser)[ Docs](https://github.com/serkin/ymlparser)[ RSS](/packages/serkin-ymlparser/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (4)Used By (0)

YML Parser
==========

[](#yml-parser)

Parser for yml(yandex.market.ru) files.

[![Build Status](https://camo.githubusercontent.com/f7f623ea441ec028de7dd72f752bee7486b9516213f5a84e2072d6d920f2a8b5/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f7365726b696e2f796d6c7061727365722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/serkin/parser)[![Coverage Status](https://camo.githubusercontent.com/2465cd98c3229109b3a822c742b520359936262f50236904ff395a3569b62d3c/68747470733a2f2f696d672e736869656c64732e696f2f636f766572616c6c732f7365726b696e2f796d6c7061727365722f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://coveralls.io/r/serkin/ymlparser?branch=master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/1c71b1814fa60dc422cab245aa5ab278db98d3054e79173418c0f1cd4d539687/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f7365726b696e2f796d6c7061727365722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/serkin/ymlparser/?branch=master)[![Latest Stable Version](https://camo.githubusercontent.com/7e7f223e8ca76bc1c067fecdb572c65f1c52ce2b8e03070db6bdbd1a6b7615ae/68747470733a2f2f706f7365722e707567782e6f72672f7365726b696e2f796d6c7061727365722f762f737461626c65)](https://packagist.org/packages/serkin/ymlparser)[![Total Downloads](https://camo.githubusercontent.com/904b482e12b96d5e1b2ca6de086f3a72e655a2703166c737d5bed38481b29461/68747470733a2f2f706f7365722e707567782e6f72672f7365726b696e2f796d6c7061727365722f646f776e6c6f616473)](https://packagist.org/packages/serkin/ymlparser)[![Latest Unstable Version](https://camo.githubusercontent.com/65a06f90989a91573d6e4fd02beb558a7690a88c9d8f7ce815bf35fd90dc5fd4/68747470733a2f2f706f7365722e707567782e6f72672f7365726b696e2f796d6c7061727365722f762f756e737461626c65)](https://packagist.org/packages/serkin/ymlparser)[![License](https://camo.githubusercontent.com/c623312e75d3905db33e4fbf50d926399e72a5bbb99b751c34cafa57fb4da3b0/68747470733a2f2f706f7365722e707567782e6f72672f7365726b696e2f796d6c7061727365722f6c6963656e7365)](https://packagist.org/packages/serkin/ymlparser)

YMLParser out of box uses two types of parsing:

- XMLReader - for medium and large xml files
- SimpleXML - for small xml files

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

[](#installation)

---

via Composer:

```
composer require serkin/ymlparser ~1.1

```

Usage
-----

[](#usage)

---

### Getting all offers from file

[](#getting-all-offers-from-file)

```
include 'vendor/autoload.php';

$filename = '/path/to/file/file.xml';

//   XMLReader driver - for medium and large xml files
//   SimpleXML driver - for small xml files

$parser = new \YMLParser\YMLParser(new \YMLParser\Driver\XMLReader);
$parser->open($filename); // throws \Exception if $filename doesn't exist or empty
foreach($parser->getOffers() as $offer): // YMLParser::getOffers() returns \Generator
    echo $offer['url'];
endforeach;
```

### Getting all offers from file with applied filter

[](#getting-all-offers-from-file-with-applied-filter)

YMLParser::getOffers() can take filter function as an argument. Filter should be an anonymous function which returns true or false

```
include 'vendor/autoload.php';

$filename = '/path/to/file/file.xml';

$parser = new \YMLParser\YMLParser(new \YMLParser\Driver\SimpleXML);
$parser->open($filename);

// We want offers only with not empty url subelements
$filter = function($element) { return !empty($element['url']); };
$offers = iterator_to_array($parser->getOffers($filter));

// Let's get all params from first offer if they are exist
foreach($offers[0]['params'] as $param):
	echo $param['name'] . ' - ' . $param['value'];
endforeach;
```

Dependencies
------------

[](#dependencies)

- PHP: &gt;= 5.5
- xmlrpc extension
- mbstring extension

Contribution
------------

[](#contribution)

- Send a pull request

Licence
-------

[](#licence)

- MIT

TODO
----

[](#todo)

- getCurrencies()
- setDefaultCurrency()
- Offers price according set defaultCurrency

Tests
-----

[](#tests)

```
phpunit

```

It is extensible
----------------

[](#it-is-extensible)

You can create your own Driver. All you have to do is to implement YMLParser\\Driver\\DriverInterface interface in your class

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity27

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~1 days

Total

2

Last Release

4037d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/bedf2ccb53a5e2b0ff96be92d712a1a7d7e1a974acdb9d27caa07a14719ad77d?d=identicon)[serkin](/maintainers/serkin)

---

Top Contributors

[![serkin](https://avatars.githubusercontent.com/u/1589686?v=4)](https://github.com/serkin "serkin (69 commits)")

---

Tags

ymlyandex

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/serkin-ymlparser/health.svg)

```
[![Health](https://phpackages.com/badges/serkin-ymlparser/health.svg)](https://phpackages.com/packages/serkin-ymlparser)
```

###  Alternatives

[mustangostang/spyc

A simple YAML loader/dumper class for PHP

73440.3M172](/packages/mustangostang-spyc)[hassankhan/config

Lightweight configuration file loader that supports PHP, INI, XML, JSON, and YAML files

97513.5M170](/packages/hassankhan-config)[t1gor/robots-txt-parser

PHP class to parse robots.txt rules according to Google, Yandex, W3C and The Web Robots Pages specifications.

85494.6k4](/packages/t1gor-robots-txt-parser)[lireincore/ymlparser

YML (Yandex Market Language) parser

2429.6k1](/packages/lireincore-ymlparser)[bopoda/robots-txt-parser

PHP Class for parsing robots.txt files according to Google, Yandex specifications.

48266.4k1](/packages/bopoda-robots-txt-parser)[m1/vars

Vars is a simple to use and easily extendable configuration loader with in built loaders for ini, json, PHP, toml, XML and yaml/yml file types. It also comes with in built support for Silex and more frameworks to come soon.

69124.2k1](/packages/m1-vars)

PHPackages © 2026

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