PHP code example of subscribepro / subscribepro-php
1. Go to this page and download the library: Download subscribepro/subscribepro-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/ */
subscribepro / subscribepro-php example snippets
use SubscribePro\Sdk;
// Set credentials
$clientId = 'XXXX';
$clientSecret = 'XXXX';
// Set log message format
$messageFormat = "SUBSCRIBE PRO REST API Call: {method} - {uri}\nRequest body: {req_body}\n{code} {phrase}\nResponse body: {res_body}\n{error}\n";
// Create SDK object
// Setup with Platform API base url and credentials from Magento config
$sdk = new Sdk([
'client_id' => $clientId,
'client_secret' => $clientSecret,
'logging_enable' => true,
'logging_file_name' => 'var/log/subscribe_pro_api.log',
'logging_message_format' => $messageFormat,
'api_request_timeout' => 60,
]);
$products = $sdk
->getProductService()
->loadProducts(['sku' => 'SOME-EXAMPLE-SKU']);
bash
composer
bash
php-cs-fixer fix