PHP code example of astelbe / sdk-php

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

    

astelbe / sdk-php example snippets




// All methods 'vendor/autoload.php';

use AstelSDK\Model\Partner;
use AstelSDK\Model\Brand;

$envParticle = ''; // '' for production, 'sta' for staging env
$apiToken = '12345abcde'; // API Private Token provided by Astel
$isDebug = false; // For more debug info
$logPath = null; // Null for no logs, a valid writable path for file logs
$isPrivate = true; // Default private / professionnal param (Optionnal)
$language = 'FR'; // Default language used by the page (Optionnal)

$AstelApiContext = new AstelSDK\AstelContext($envParticle, $apiToken, $isDebug, $logPath);
$AstelApiContext->setIsPrivate($isPrivate);
$AstelApiContext->setLanguage($language);

// Utils debug function registering
AstelSDK\AstelContext::registerUtilsFunctions();

$Product = AstelSDK\Model\Product::getInstance();

$products = $Product->find('all', [
	'_embed' => 'play_description,commission,web',
	'brand_id' => 3 // VOO
]);

debug($products);

$productVOOOne = $Product->find('first', [
	'id' => '1999', // VOO One
	'_embed' => 'play_description,commission,web',
]);

debug($productVOOOne);

$Discount = Discount::getInstance();

$discounts = $Discount->find('all', [
	'brand_id' => 3,
	'_embed' => 'subscription_periods/product/commission,subscription_periods/product/web',
	'order' => '-weight',
	'count' => 50,
]);

debug($discounts);

$ composer