定制 paipe/phpclient 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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:

  • aaaUrl the Auth endpoint as https://auth.paipe.com.br
  • appKey the app key as app-key
  • appSecret the app secret as app-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

GitHub 信息

  • Stars: 1
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2021-12-15