PHPackages                             corpsepk/yii2-yandex-market-yml - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. corpsepk/yii2-yandex-market-yml

ActiveYii2-extension[Utility &amp; Helpers](/categories/utility)

corpsepk/yii2-yandex-market-yml
===============================

Yii2 module for automatically generation Yandex.Market YML

0.8(2y ago)1810.0k↓33.3%5MITPHPPHP &gt;=8.1

Since Nov 13Pushed 2y ago5 watchersCompare

[ Source](https://github.com/corpsepk/yii2-yandex-market-yml)[ Packagist](https://packagist.org/packages/corpsepk/yii2-yandex-market-yml)[ RSS](/packages/corpsepk-yii2-yandex-market-yml/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (2)Versions (11)Used By (0)

Yandex.Market YML Module for Yii2
=================================

[](#yandexmarket-yml-module-for-yii2)

Yii2 module for automatically generation [Yandex.Market YML](https://yandex.ru/support/webmaster/goods-prices/technical-requirements.xml).

[![Latest Version](https://camo.githubusercontent.com/8704d5c51ed4cb54819fd0446d7f2acb00084b2109ff37addba03b1786ca2583/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f7461672f636f72707365706b2f796969322d79616e6465782d6d61726b65742d796d6c2e7376673f7374796c653d666c61742d737175617265266c6162656c3d72656c65617365)](https://github.com/corpsepk/yii2-yandex-market-yml/tags)[![Build Status](https://github.com/corpsepk/yii2-yandex-market-yml/workflows/build/badge.svg)](https://github.com/corpsepk/yii2-yandex-market-yml/actions)[![Quality Score](https://camo.githubusercontent.com/c986797223c22f066004335d9511d2d96a0bf8ab54b02e21444410236420562d/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f636f72707365706b2f796969322d79616e6465782d6d61726b65742d796d6c2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/corpsepk/yii2-yandex-market-yml)[![Minimum PHP Version](https://camo.githubusercontent.com/2d18ce514c7016022dad012ac9e39a8b6f47cc411b2daff6627cbf208f8cea63/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344253230382e312d3838393242462e7376673f7374796c653d666c61742d737175617265)](https://php.net/)

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

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

- Either run

```
php composer.phar require --prefer-dist "corpsepk/yii2-yandex-market-yml" "~0.8"

```

or add

```
"corpsepk/yii2-yandex-market-yml": "~0.8"

```

to the `require` section of your application's `composer.json` file.

Configure config
----------------

[](#configure-config)

Configure the `cache` component of your application's configuration file, for example:

```
'components' => [
    'cache' => [
        'class' => 'yii\caching\FileCache',
    ],
]
```

Add a new module in `modules` section of your application's configuration file, for example:

```
'modules' => [
    'YandexMarketYml' => [
        'class' => 'corpsepk\yml\YandexMarketYml',
        'cacheExpire' => 1, // 1 second. Default is 24 hours
        'categoryModel' => 'app\models\Category',
        'shopOptions' => [
            'name' => 'MyCompanyName',
            'company' => 'LTD MyCompanyName',
            'url' => 'http://example.com',
            'currencies' => [
                [
                    'id' => 'RUR',
                    'rate' => 1
                ]
            ],
        ],
        'offerModels' => [
            ['class' => 'app\models\Item'],
        ],
    ],
],
```

Add a new rule for `urlManager` of your application's configuration file, for example:

```
'urlManager' => [
    'rules' => [
        ['pattern' => 'yandex-market', 'route' => 'YandexMarketYml/default/index', 'suffix' => '.yml'],
    ],
],
```

Configure `Category` model
--------------------------

[](#configure-category-model)

Add behavior in the AR category model, for example:

```
use corpsepk\yml\behaviors\YmlCategoryBehavior;

public function behaviors()
{
    return [
        'ymlCategory' => [
            'class' => YmlCategoryBehavior::className(),
            'scope' => function ($model) {
                /** @var \yii\db\ActiveQuery $model */
                $model->select(['id', 'name', 'parent_id']);
            },
            'dataClosure' => function ($model) {
                /** @var self $model */
                return [
                    'id' => $model->id,
                    'name' => $model->name,
                    'parentId' => $model->parent_id
                ];
            }
        ],
    ];
}
```

Configure `Offer` models
------------------------

[](#configure-offer-models)

Add behavior in the AR models, for example:

```
use corpsepk\yml\behaviors\YmlOfferBehavior;
use corpsepk\yml\models\Offer;

public function behaviors()
{
    return [
        'ymlOffer' => [
            'class' => YmlOfferBehavior::className(),
            'scope' => function ($model) {
                /** @var \yii\db\ActiveQuery $model */
                $model->andWhere(['is_deleted' => false]);
            },
            'dataClosure' => function ($model) {
                /** @var self $model */
                return new Offer([
                    'id' => $model->id,
                    'url' => $model->getUrl(true), // absolute url e.g. http://example.com/item/1256
                    'price' => $model->getPrice(),
                    'currencyId' => 'RUR',
                    'categoryId' => $model->category_id,
                    'picture' => $model->cover ? $model->cover->getUrl() : null,
                    /**
                     * Or as array
                     * don't forget that yandex-market accepts 10 pictures max
                     * @see https://yandex.ru/support/partnermarket/picture.xml
                     */
                    'picture' => ArrayHelper::map($model->images, 'id', function ($image) {
                        return $image->getUrl();
                    }),
                    'name' => $model->name,
                    'vendor' => $model->brand ? $model->brand->name : null,
                    'description' => $model->description,
                    'customElements' => [
                        [
                            'outlets' => ''
                        ]
                    ],
                    'condition' => new \corpsepk\yml\dto\Condition(
                        type: \corpsepk\yml\enums\ConditionType::PREOWNED,
                        quality: \corpsepk\yml\enums\ConditionQuality::EXCELLENT,
                        reason: 'Some scratches',
                    )
                ]);
            }
        ],
    ];
}
```

Testing
-------

[](#testing)

```
./vendor/bin/phpunit
```

Howto
-----

[](#howto)

[Use console command to build yml](https://github.com/corpsepk/yii2-yandex-market-yml/blob/master/docs/console-command-basic.md)

Useful links
------------

[](#useful-links)

Yandex XML validator -

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity34

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 93.5% 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 ~300 days

Recently: every ~500 days

Total

10

Last Release

763d ago

PHP version history (3 changes)0.2PHP &gt;=5.1.2

0.3PHP &gt;=5.6

0.8PHP &gt;=8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/1739dea33fb61eb2ceb2b459d610902038b257fc35da861068b1262a2498fd92?d=identicon)[corpsepk](/maintainers/corpsepk)

---

Top Contributors

[![corpsepk](https://avatars.githubusercontent.com/u/2836353?v=4)](https://github.com/corpsepk "corpsepk (86 commits)")[![scrutinizer-auto-fixer](https://avatars.githubusercontent.com/u/6253494?v=4)](https://github.com/scrutinizer-auto-fixer "scrutinizer-auto-fixer (3 commits)")[![onmotion](https://avatars.githubusercontent.com/u/12899080?v=4)](https://github.com/onmotion "onmotion (2 commits)")[![evgkan](https://avatars.githubusercontent.com/u/11028279?v=4)](https://github.com/evgkan "evgkan (1 commits)")

---

Tags

yandex-marketyii2ymlymlyii2moduleyandex.market

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/corpsepk-yii2-yandex-market-yml/health.svg)

```
[![Health](https://phpackages.com/badges/corpsepk-yii2-yandex-market-yml/health.svg)](https://phpackages.com/packages/corpsepk-yii2-yandex-market-yml)
```

###  Alternatives

[branchonline/yii2-lightbox

Lightbox widget for Yii2

13139.0k1](/packages/branchonline-yii2-lightbox)[akiraz2/yii2-ticket-support

Yii2 Support Ticket Module, easy, flexible, fast

611.7k](/packages/akiraz2-yii2-ticket-support)

PHPackages © 2026

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