PHP code example of afosto / api-client

1. Go to this page and download the library: Download afosto/api-client 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 / api-client example snippets


$storage = new SessionStorage();
App::run($storage, CLIENT_ID, CLIENT_SECRET);

$customer = Customer::model();
$customer->email = '[email protected]';
$customer->name = 'Peter Bakker';
$customer->is_female = false;
$customer->save();

$sale = new Sale::model();
$sale->customer_id = $customer->id;

foreach (Product::model()->paginate(50) as $page => $products) {
    foreach ($products as $product) {
        foreach ($product->collections as $collection) {
            echo $collection->name;
        }
    }
}