forgie1 / toptrans-api-wrapper
Toptrans API wrapper
Installs: 3 733
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:project
Requires
- php: >=8.2
- guzzlehttp/guzzle: ^6.1|^7.0
Requires (Dev)
- artfocus/codestyle: dev-github as 6.0.0
- phpstan/phpstan: 0.12.*
- phpunit/phpunit: ^9.0
README
This wrapper is to simplify communication with Toptrans API:
- https://zp.toptrans.cz/docs/api.html
- https://zp.toptrans.cz/docs/data.html
- api requires the same login as: https://zp.toptrans.cz/
Implemented Toptrans endpoints:
- /order/list by
OrderListMethod::class
- /order/price by
OrderPriceMethod::class
- /order/save by
OrderSaveMethod::class
- /order/search by
OrderSearchMethod::class
Useage:
$order = new Order(); $order->setLoading($loading) ->setDischarge($discharge) ->setPacks($packs) ->setOrderValue($orderValue) // build order entity here ... $method = new OrderSaveMethod($order) $request = new Request ('userName', 'password'); try { $response = $method->sendRequest($request) } catch (ResponseStatusException $e) { // handle Exception }