PHP code example of siliconstraits / cems-php-sdk

1. Go to this page and download the library: Download siliconstraits/cems-php-sdk 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/ */

    

siliconstraits / cems-php-sdk example snippets




$client = new CEMS\Client($access_token, $apiUrl);

$client = new CEMS\Client($email, $password, $apiUrl);

$client->post($path, $params=array());
$client->get($path, $params=array());
$client->get($path, $params=array());
$client->get($path, $params=array());

try {
  $response= $client->get(
    'events',
    array(
        'category_id' => array(1, 2)
    )
  ); // CEMS\Response
}
catch (CEMS\Error $e) {
    echo $e;
}

$customer = $client->get('customers/$id')->getObject(); // CEMS\Resource
$customers = $client->get('customers')->getObjectList('customer'); // CEMS\Collection Class contains many CEMS\Customer elements

$customer->name = 'Nguyen Le Xuan';
echo $customer->name;

foreach ($customers as $customer) {
  print_r($customer->toArray());
  // toObject()
}
shell
curl -sS https://getcomposer.org/installer | php
json
{
   "iliconstraits/cems-php-sdk": "dev-master"
   }
}
shell
php composer.phar install