PHP code example of oskonnikov / yml-generator

1. Go to this page and download the library: Download oskonnikov/yml-generator library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

oskonnikov / yml-generator example snippets




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-Name($this->faker->name)
;

// Creating offers array (https://yandex.ru/support/webmaster/goods-prices/technical-        $promo_product_offers = [111111111,22222222,333333333];
            $promo_gifts = [111111111];
            $promos[] = (new Promo())
                ->setId('123456')
                ->setType('gift with purchase')
                ->setStartDate('2020-05-28 00:00')
                ->setEndDate('2020-05-30 00:00 ')
                ->setDescription('Gift Description Here!')
                ->setProductOffers($promo_product_offers)
                ->setPromoGifts($promo_gifts);


(new Generator($settings))->generate(
    $shopInfo,
    $currencies,
    $categories,
    $offers,
    $deliveries,
    $promos
);