dafiti/datajet-client

Dafiti Datajet Client for PHP

This package's canonical repository appears to be gone and the package has been frozen as a result.

0.4.1 2019-10-07 20:29 UTC

README

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 = [
    'data' => [
        'uri' => '<import-uri>', // eg.: http://fisherman.sae.datajet.io
        'key' => '<your-import-key>'
    ],
    'search' => [
        'uri' => '<search-uri>', // eg.: http://hawk.sae.datajet.io
        'key' => '<your-search-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