limingxinleo/x-http-rpc

Rpc library for GuzzleHttp

1.0.2 2018-03-05 01:53 UTC

This package is auto-updated.

Last update: 2024-11-17 18:55:13 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