paipe/phpclient
最新稳定版本:v1.0.3
Composer 安装命令:
composer require paipe/phpclient
包简介
Paipe data
README 文档
README
Paipe PHP client provides an easy interface for Feba data services, it handles authentication from Paipe Auth, pre-authorize services and validate authorized actions.
Installation
composer require paipe/phpclient
Usage
Firstly get instantiate a client then get a service from it. In this example, we're going to use the config:
aaaUrlthe Auth endpoint ashttps://auth.paipe.com.brappKeythe app key asapp-keyappSecretthe app secret asapp-secret
In order to get the client done, above parameter should be shared to the application.
Example to perform GET with query string:
$client = new paipe\phpclient\Client([ 'aaaUrl' => 'https://auth.paipe.com.br', 'appKey' => 'app-key', 'appSecret' => 'app-secret' ]; $response = $client->getService('cep')->request('GET' '/lookup', [ 'query' => ['keyword' => 'av paulista'] ]);
The response comes as Psr\Http\Message\MessageInterface, then you call common functions and the $options parameter are same as GuzzleHttp\RequestOptions
To post to data service as json:
$service = $client->getService('postal-code') $resp = $service->request('POST' '/search', [ 'json' => ['foo' => 'data'] ]);
Injecting a custom header:
$service = $client->getService('postal-code') $resp = $service->request('POST' '/search', [ 'headers' => ['X-My-Header' => 'nice header'], 'json' => ['foo' => 'data'] ]);
© Paipe
统计信息
- 总下载量: 1.14k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2021-12-15