Usage¶
You can send requests with Speedy Client using a Speedy\SpeedyInterface object.
Configuration¶
Create a new Configuration with Speedy username, password and language
use VasilDakov\Speedy;
/** @var Configuration $configuration */
$configuration = new Configuration('username', 'password', 'language');
Creating a Client¶
Speedy Client can be configured with any Psr\Http\Client\ClientInterface implementation like Guzzle HTTP Client, Laminas HTTP client, Symphony HTTP Client , to send HTTP Request and to receive HTTP Response.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | use VasilDakov\Speedy\Speedy; use GuzzleHttp\Client; use Laminas\Diactoros\RequestFactory; /** @var Configuration $configuration */ $configuration = new Configuration('username', 'password', 'language'); /** @var Psr\\Http\\Psr\Http\Message\\ClientInterface $httpClient */ $httpClient = new GuzzleHttp\Client(); /** @var Psr\\Http\\Message\\ClientInterface $RequestFactoryInterface */ $httpFactory = new \Laminas\Diactoros\RequestFactory(); $speedy = new Speedy($configuration, $httpClient, $httpFactory); |
Sending Requests¶
1 2 | $request = new GetContractClientsRequest(); $response = $speedy->getContractClient($request); |
Using Responses¶
1 2 3 4 5 6 7 8 | /** @var Client\GetContractClientsRequest $request */ $request = new Client\GetContractClientsRequest(); /** @var Client\GetContractClientsResponse $response */ $response = $speedy->getContractClients($request); /** @var Client\Client[] $clients */ $clients = $response->getClients(); |