floor12 / mindbox-api-client
General abstraction over the MindBox API
0.0.4
2020-10-08 16:43 UTC
Requires
- php: >=7.1.0
- ext-json: *
- guzzlehttp/guzzle: *
Requires (Dev)
- phpunit/phpunit: 7.*
README
General abstraction over the Mindbox API.
To send requests to the Mindbox API you should extend the MindBoxRequest
class, set MindBoxRequest::operationName
and MindBoxRequest::body
with your data.
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();