PHP code example of floor12 / mindbox-api-client
1. Go to this page and download the library: Download floor12/mindbox-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/ */
floor12 / mindbox-api-client example snippets
use floor12\MindBox\MindBoxClient;
use floor12\MindBox\MindBoxRequest;
class SomeMindboxRequest extends MindBoxRequest
{
/** @var string */
protected $operationName = 'Website.CheckCustomer';
protected $mode = MindBoxClient::MODE_SYNCHRONOUS;
/**
* @param $userId int
*/
public function __construct(int $userId)
{
$this->body = [
'customer' => [
'ids' =>
['externalId' => $userId]
]
];
}
}
$apiKey = '4a942bc1';
$apiEndPoint = 'Website.ExampleEndPoint';
$client = new MindBoxClient($apiKey, $apiEndPoint);
$request = new SomeMindboxRequest(10);
$client->sendData($request);
$response = $client->getResponse();