limingxinleo/x-http-rpc

This package is not installable via Composer 1.x, please make sure you upgrade to Composer 2+. Read more about our Composer 1.x deprecation policy.

Rpc library for GuzzleHttp

1.0.2 2018-03-05 01:53 UTC

This package is auto-updated.

Last update: 2021-05-17 11:51:22 UTC


README

Build Status

安装

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();

复杂使用

x-http-rpc-demo