hospodskej-cz / eet-gateway-client
Typed PHP client for the EET Gateway HTTP API v1 (Czech EET 2.0). ext-curl, no other dependencies.
v0.1.1
2026-10-31 04:34 UTC
Requires
- php: >=8.1
- ext-curl: *
- ext-json: *
Requires (Dev)
- phpunit/phpunit: ^10.5 || ^11.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Typed PHP 8.1+ client for the EET Gateway HTTP API v1
(Czech EET 2.0). ext-curl, no other dependencies. Česky a o ostatních jazycích:
clients/README.md.
composer require hospodskej-cz/eet-gateway-client
use EetGateway\Client\Client; $client = new Client('http://localhost:8080', apiKey: getenv('EET_API_KEY') ?: null); $result = $client->submitSale( ['porad_cis' => 'R-1001', 'dat_trzby' => date('c'), 'celk_trzba' => '123.50'], idempotencyKey: 'R-1001', // repeat the call with the same key after any error ); if ($result->isPending()) { // queued | uncertain: the gateway keeps sending $result = $client->waitForSale($result); } echo $result->status->value, ' ', $result->pok, "\n";
submitSale()returns aSaleResultfor HTTP 200 (accepted,verification_ok,rejected), 202 (queued,uncertain) and 422 (invalid, see$result->issues). 409 throwsIdempotencyConflictException; other error statuses throwApiExceptionsubclasses; no answer throwsTransportException/TimeoutException(all extendEetGatewayException).SaleInputis an alternative to a plain array;DateTimeandfloatvalues are formatted for you.- Every operation of the API is covered:
submitSale,submitBatch,getSale,getSaleAttempts,retrySale,listQueue/iterateQueue,listRegisters,validateSales,health,getOpenApi,getDocs;*Rawvariants take NDJSON, CSV or XML. - The default transport is cURL and follows no redirects. To use Guzzle or a PSR-18 client implement
the one-method
EetGateway\Client\Http\Transportinterface and pass it astransport:. timeout:(default 30 s) bounds each request. The client does not retry by itself.
Tests: composer install && vendor/bin/phpunit. With EET_URL set (see the
overview) the integration tests run against a real gateway too.