arkon-event / send-regning-api
使用 SendRegning API 的 PHP 客户端
v0.7.0
2016-09-02 13:43 UTC
Requires
- php: >=5.6
- guzzlehttp/guzzle: ~6
Requires (Dev)
- phpunit/phpunit: 5.*
This package is not auto-updated.
Last update: 2024-09-14 19:47:33 UTC
README
这是一个简单的 PHP HTTP 包装器,用于与 Sendregning.no 的 API 交互。它负责构建头部/身份验证,并允许轻松地向 API 发送消息。它不帮助您构建或验证 JSON 消息。有关详情,请参阅 SendRegning 文档 http://sendregning.github.io/
此客户端是为 arkon.no 与 sendregning.no 的内部集成而构建的,并用于我们的生产系统。我们与 sendregning.no 没有任何其他关联。
<?php use \ArkonEvent\SendRegningApi\ApiClient; $client = new ApiClient('loginEmail', 'password', 'account-id'); //To execute a get request simply use get and add the path $invoices = $client->get('/invoices/'); //or to get a single invoice $invoice = $client->get('/invoices/14'); //use $queryParameters to send parameters $params = ['from' => '2015-02-01','to' => '2015-06-01']; $invoice = $client->get('/invoices/not-due',$params); //use the callLink method to call links returned in the object $client->callLink($invoice,ApiClient::LINK_SEND_AGAIN); //To send a POST request without body $client->post('/recipients/123456/available'); //To send a POST request with a body, data must be provided in format supported as input for json_encode $data = ['amount' => 0.25]; $client->post('/sales-ledger/123456/loss',$data); ?>