Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gennadyx/ymlgenerator
YML (Yandex Market Language) file generator
https://github.com/gennadyx/ymlgenerator
Last synced: 3 months ago
JSON representation
YML (Yandex Market Language) file generator
- Host: GitHub
- URL: https://github.com/gennadyx/ymlgenerator
- Owner: gennadyx
- License: mit
- Fork: true (Bukashk0zzz/YmlGenerator)
- Created: 2017-12-19T10:14:30.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2017-12-26T22:43:40.000Z (about 7 years ago)
- Last Synced: 2024-09-29T08:03:45.810Z (3 months ago)
- Language: PHP
- Homepage:
- Size: 57.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
#YML (Yandex Market Language) file generator
[![Build Status](https://img.shields.io/scrutinizer/build/g/Bukashk0zzz/YmlGenerator.svg?style=flat-square)](https://travis-ci.org/Bukashk0zzz/YmlGenerator)
[![Code Coverage](https://img.shields.io/codecov/c/github/Bukashk0zzz/YmlGenerator.svg?style=flat-square)](https://codecov.io/github/Bukashk0zzz/YmlGenerator)
[![Scrutinizer Code Quality](https://img.shields.io/scrutinizer/g/Bukashk0zzz/YmlGenerator.svg?style=flat-square)](https://scrutinizer-ci.com/g/Bukashk0zzz/YmlGenerator/?branch=master)
[![SensioLabsInsight](https://img.shields.io/sensiolabs/i/a7b93e1f-5f09-436a-bb45-0eb37b3e6110.svg)](https://insight.sensiolabs.com/projects/a7b93e1f-5f09-436a-bb45-0eb37b3e6110)
[![Dependency Status](https://www.versioneye.com/user/projects/5804e504c3e528003dbfac37/badge.svg?style=flat)](https://www.versioneye.com/user/projects/5804e504c3e528003dbfac37)
[![License](https://img.shields.io/packagist/l/Bukashk0zzz/yml-generator.svg?style=flat-square)](https://packagist.org/packages/Bukashk0zzz/yml-generator)
[![Latest Stable Version](https://img.shields.io/packagist/v/Bukashk0zzz/yml-generator.svg?style=flat-square)](https://packagist.org/packages/Bukashk0zzz/yml-generator)
[![Total Downloads](https://img.shields.io/packagist/dt/Bukashk0zzz/yml-generator.svg?style=flat-square)](https://packagist.org/packages/Bukashk0zzz/yml-generator)About
-----
[YML (Yandex Market Language)](https://yandex.ru/support/webmaster/goods-prices/technical-requirements.xml) generator.
Uses standard XMLWriter for generating YML file.
Not required any other library you just need PHP 5.5.0 or >= version.Generator supports this offer types:
- OfferCustom [(vendor.model)](https://yandex.ru/support/webmaster/goods-prices/technical-requirements.xml#vendor-model)
- OfferBook [(book)](https://yandex.ru/support/webmaster/goods-prices/technical-requirements.xml#book)
- OfferAudiobook [(audiobook)](https://yandex.ru/support/webmaster/goods-prices/technical-requirements.xml#audiobook)
- OfferArtistTitle [(artist.title)](https://yandex.ru/support/webmaster/goods-prices/technical-requirements.xml#artist-title)
- OfferTour [(tour)](https://yandex.ru/support/webmaster/goods-prices/technical-requirements.xml#tour)
- OfferEventTicket [(event-ticket)](https://yandex.ru/support/webmaster/goods-prices/technical-requirements.xml#event-ticket)
- OfferSimple [(empty)](https://yandex.ru/support/webmaster/goods-prices/technical-requirements.xml#base)Installation
------------
Run composer require```bash
composer require bukashk0zzz/yml-generator
```Or add this to your `composer.json` file:
```json
"require": {
"bukashk0zzz/yml-generator": "dev-master",
}
```Usage example
-------------```php
setOutputFile($file)
;// Creating ShopInfo object (https://yandex.ru/support/webmaster/goods-prices/technical-requirements.xml#shop)
$shopInfo = (new ShopInfo())
->setName('BestShop')
->setCompany('Best online seller Inc.')
->setUrl('http://www.best.seller.com/')
;// Creating currencies array (https://yandex.ru/support/webmaster/goods-prices/technical-requirements.xml#currencies)
$currencies = [];
$currencies[] = (new Currency())
->setId('USD')
->setRate(1)
;// Creating categories array (https://yandex.ru/support/webmaster/goods-prices/technical-requirements.xml#categories)
$categories = [];
$categories[] = (new Category())
->setId(1)
->setName($this->faker->name)
;// Creating offers array (https://yandex.ru/support/webmaster/goods-prices/technical-requirements.xml#offers)
$offers = [];
$offers[] = (new OfferSimple())
->setId(12346)
->setAvailable(true)
->setUrl('http://www.best.seller.com/product_page.php?pid=12348')
->setPrice($this->faker->numberBetween(1, 9999))
->setCurrencyId('USD')
->setCategoryId(1)
->setDelivery(false)
->setName('Best product ever')
;// Optional creating deliveries array (https://yandex.ru/support/partnermarket/elements/delivery-options.xml)
$deliveries = [];
$deliveries[] = (new Delivery())
->setCost(2)
->setDays(1)
->setOrderBefore(14)
;(new Generator($settings))->generate(
$shopInfo,
$currencies,
$categories,
$offers,
$deliveries
);
```Copyright / License
-------------------See [LICENSE](https://github.com/bukashk0zzz/YmlGenerator/blob/master/LICENSE)