Skip to content

lcfumes/datajet-client

Repository files navigation

Dafiti Datajet Client for PHP

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

Datajet.IO Client for PHP

Instalation

The package is available on Packagist. Autoloading is PSR-4 compatible.

{
    "require": {
        "dafiti/datajet-client": "dev-master"
    }
}

Usage

Basic

$config = [
    'hawk' => [
        'import_key' => '<your-key>',
        'search_key' => '<your-key>'
    ]
];

$client = \Dafiti\Datajet\Client::create($config);

All returned data is an array.

Import products

$products = [
    [
        'id'      => '1',
        'title'   => 'Product',
        'payload' => [
            'some' => 'thing'
        ],
        'brand'   => [
            'id'   => '2',
            'name' => 'Dafiti',
            'slug' => 'dafiti'
        ],
        'attributes' => [
            'color' => 'black'
        ],
        'price' => [
            'current'  => 100.00,
            'previous' => 200.00,
            'currency' => 'BRL'
        ],
        'sku' => 'APCC',
        'published_at' => date('Y-m-d H:i:s'),
        'stock_count'  => 3
    ]
];

$client->product->import($products);

Please see Datajet.IO docs: https://github.com/datajet-io/docs/wiki

Search products

$search = [
    'q'    => 'shoe',
    'filters' => [
        'brand.id' => ['1']
    ],
    'size' => 10,
    'page' => 1
];

$client->product->search($search);

Please see Datajet.IO docs: https://github.com/datajet-io/docs/wiki

Delete products

$client->product->delete($id);

Please see Datajet.IO docs: https://github.com/datajet-io/docs/wiki

License

MIT License

About

PHP Client for Dataja.IO

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages