fillup/guzzle-services
提供了一种使用Guzzle服务描述来描述Web服务、序列化请求并将响应解析为易于使用的模型结构的Guzzle命令库实现。
0.5.1
2016-11-04 16:51 UTC
Requires
- php: >=5.4.0
- guzzlehttp/command: 0.7.*
Requires (Dev)
- phpunit/phpunit: ~4.0
Replaces
- guzzlehttp/guzzle-services: 0.5.0
This package is auto-updated.
Last update: 2024-09-06 09:32:59 UTC
README
提供了一种使用Guzzle服务描述来描述Web服务、序列化请求并将响应解析为易于使用的模型结构的Guzzle命令库实现。
use GuzzleHttp\Client; use GuzzleHttp\Command\Guzzle\GuzzleClient; use GuzzleHttp\Command\Guzzle\Description; $client = new Client(); $description = new Description([ 'baseUrl' => 'http://httpbin.org/', 'operations' => [ 'testing' => [ 'httpMethod' => 'GET', 'uri' => '/get{?foo}', 'responseModel' => 'getResponse', 'parameters' => [ 'foo' => [ 'type' => 'string', 'location' => 'uri' ], 'bar' => [ 'type' => 'string', 'location' => 'query' ] ] ] ], 'models' => [ 'getResponse' => [ 'type' => 'object', 'additionalProperties' => [ 'location' => 'json' ] ] ] ]); $guzzleClient = new GuzzleClient($client, $description); $result = $guzzleClient->testing(['foo' => 'bar']); echo $result['args']['foo']; // bar
安装
此项目可以使用Composer安装。将以下内容添加到您的composer.json文件中:
{ "require": { "guzzlehttp/guzzle-services": "0.5.*" } }
插件
更多文档即将推出。