limingxinleo / x-http-rpc
Rpc library for GuzzleHttp
1.0.2
2018-03-05 01:53 UTC
Requires
- php: >=5.6
- guzzlehttp/guzzle: ^6.3
Requires (Dev)
- limingxinleo/x-trait-common: ^1.0
- phpunit/phpunit: >=5.6
This package is auto-updated.
Last update: 2024-10-17 18:51:11 UTC
README
安装
composer require limingxinleo/x-http-rpc
简单使用
<?php use Psr\Http\Message\ResponseInterface; use Xin\Http\Rpc\Client; use Xin\Http\Rpc\Exceptions\HttpException; use Xin\Traits\Common\InstanceTrait; class TestClient extends Client { // composer require limingxinleo/x-trait-common use InstanceTrait; protected $baseUri = 'http://api.demo.phalcon.lmx0536.cn'; public function testPost() { $params = [ 'name' => 'limx', 'age' => 28 ]; return $this->post('/api/request', [ 'form_params' => $params ]); } } $result = TestClient::getInstance()->testPost();