All Projects → Bukashk0zzz → YmlGenerator

Bukashk0zzz / YmlGenerator

Licence: MIT License
YML (Yandex Market Language) file generator

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to YmlGenerator

Ymlparser
YML (Yandex Market Language) parser
Stars: ✭ 14 (-85.42%)
Mutual labels:  yandex, yml
Yii2 Yml Catalog
Компонент выгрузки каталога товаров в Яндекс.Маркет
Stars: ✭ 16 (-83.33%)
Mutual labels:  yandex, yml
yii2-yandex-market-yml
Yii2 module for automatically generation Yandex.Market YML
Stars: ✭ 14 (-85.42%)
Mutual labels:  yml, yandex-market
yandex-yml-generator
😎 Генератор YML для Яндекс.Маркет на php, не требует других библиотек.
Stars: ✭ 37 (-61.46%)
Mutual labels:  yml, yandex-market-language
TgTranslator
Telegram bot that removes language barrier between people in groups
Stars: ✭ 32 (-66.67%)
Mutual labels:  yandex
mystem-scala
Morphological analyzer `mystem` (Russian language) wrapper for JVM languages
Stars: ✭ 21 (-78.12%)
Mutual labels:  yandex
passport-yandex
Yandex authentication strategy for Passport and Node.js.
Stars: ✭ 19 (-80.21%)
Mutual labels:  yandex
yandex-dialogs-php-sdk
PHP-библиотека для облегчения работы с диалогами от Яндекс
Stars: ✭ 23 (-76.04%)
Mutual labels:  yandex
Simple-YAML
A Java API that provides an easy-to-use way to store data using the YAML format.
Stars: ✭ 68 (-29.17%)
Mutual labels:  yml
tapi-yandex-direct
Python библиотека API Яндекс Директ
Stars: ✭ 35 (-63.54%)
Mutual labels:  yandex
kodi.plugin.yandex-music
Yandex Music plugin for Kodi
Stars: ✭ 33 (-65.62%)
Mutual labels:  yandex
safe-search
Sets the built-in adult content filter (most often: safe search) on Google, YouTube, Bing, Yahoo, DuckDuckGo, Startpage, Dogpile, Yandex, Vimeo, Reddit, Ecosia, Dailymotion, Qwant, and Patreon.
Stars: ✭ 16 (-83.33%)
Mutual labels:  yandex
YandexTransportProxy
Proxy server for Yandex Transport API methods.
Stars: ✭ 15 (-84.37%)
Mutual labels:  yandex
vue-yandex-metrika
Vue plugin for Yandex Metrika
Stars: ✭ 64 (-33.33%)
Mutual labels:  yandex
gulp-yaml
A Gulp plugin to convert YAML to JSON
Stars: ✭ 24 (-75%)
Mutual labels:  yml
artefactory-connectors-kit
ACK is an E(T)L tool specialized in API data ingestion. It is accessible through a Command-Line Interface. The application allows you to easily extract, stream and load data (with minimum transformations), from the API source to the destination of your choice.
Stars: ✭ 34 (-64.58%)
Mutual labels:  yandex
AzurePipelinesSamples
Azure Pipeline Samples - sample configurations with explanation and useful links
Stars: ✭ 23 (-76.04%)
Mutual labels:  yml
hubi
Humanitarian ubiquitous language helper
Stars: ✭ 17 (-82.29%)
Mutual labels:  yml
js-new-features
Новые возможности JavaScript — ШРИ 2018
Stars: ✭ 19 (-80.21%)
Mutual labels:  yandex
omniauth-yandex
Omniauth 1.0 strategy for Yandex.ru
Stars: ✭ 19 (-80.21%)
Mutual labels:  yandex

YML (Yandex Market Language) file generator

Build Status Code Coverage Scrutinizer Code Quality License Latest Stable Version Total Downloads

About

YML (Yandex Market Language) 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:

Installation

Run composer require

composer require bukashk0zzz/yml-generator

Or add this to your composer.json file:

"require": {
	"bukashk0zzz/yml-generator": "dev-master",
}

Usage examples

<?php

use Bukashk0zzz\YmlGenerator\Model\Offer\OfferSimple;
use Bukashk0zzz\YmlGenerator\Model\Category;
use Bukashk0zzz\YmlGenerator\Model\Currency;
use Bukashk0zzz\YmlGenerator\Model\Delivery;
use Bukashk0zzz\YmlGenerator\Model\ShopInfo;
use Bukashk0zzz\YmlGenerator\Settings;
use Bukashk0zzz\YmlGenerator\Generator;

$file = tempnam(sys_get_temp_dir(), 'YMLGenerator');
$settings = (new Settings())
    ->setOutputFile($file)
    ->setEncoding('UTF-8')
;

// 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
);

Adding custom elements

if you need additional offers elements in your yml file using method addCustomElement('type','value'). For example:

$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')
    ->addCustomElement('type', 'value')
;

Copyright / License

See LICENSE

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].