PHP code example of afosto / data

1. Go to this page and download the library: Download afosto/data 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/ */

    

afosto / data example snippets


$product = new Product();

$product->weight = 10;

$product->supplier = new Supplier();
$product->supplier->id = 1;
$product->supplier->name = 'TestSupplier';

$item = new Item();
$item->setAttributes([
    'sku'    => 'TEST-SKU-234',
    'ean'    => '234554245',
    'prices' => [
        [
            'price_gross' => 23.54,
            'tax_class'   => [
                'id' => 2,
            ],
        ],
    ],
]);
$product->items[] = $item;

$product->validate();

$product->getAttributes();