gruentee / flowfact-api-php
围绕 FLOWFACT API 的简单包装器,具有流畅的接口
v0.1.3
2016-07-31 20:48 UTC
Requires
- guzzlehttp/guzzle: ~6.0
- jms/serializer: ^1.1
- monolog/monolog: 1.19.0
- netresearch/jsonmapper: v0.11.0
Requires (Dev)
- phpunit/phpunit: ~5.3.4
This package is not auto-updated.
Last update: 2024-09-14 19:31:15 UTC
README
#flowfact-api-php
围绕 FLOWFACT API 的简单包装器。
##使用示例 建立资源路径(例如,/users/<UUID>/contacs/<UUID>)通过使用以所需资源名称为前缀的链式方法调用。可以通过传递标识符作为参数来指定单个资源,同样也适用于添加查询参数。
通过在链的末尾调用 HTTP 方法来最终发出请求。
// install via Composer composer require gruentee/flowfact-api-php // initialize client $client = new Client('USERNAME', 'PASSWORD', 'CUSTOMER_ID', 'https://api.baseurl.tld/'); // build URL: prefix the desired resource with "get" or "for" // /users/68ed219e-5755-11e6-8b77-86f30ca893d3/contacts $client->getUsers("68ed219e-5755-11e6-8b77-86f30ca893d3") ->getContacts(); // submit request $response = $client->get(); // POST /users/68ed219e-5755-11e6-8b77-86f30ca893d3/contacts $data = [ 'name' => ['lastname' => 'TestUser'] ]; $resp = $client->forUsers('AAC94B33-01F8-3783-B597-AE7456DF1B78') ->forContacts() ->post($data);
##待办事项
- 将 XML 和 JSON 响应映射到对应响应模型的 PHP 类
###感谢 从 [sendgrid/php-http-client](https://github .com/sendgrid/php-http-client/) 中借用了拦截方法调用的想法。 👍
该项目是在科隆大学专业中心和 FLOWFACT GmbH 合作的教育合作项目期间开发的。