phpid/lib-api

此软件包最新版本(1.0.0)的许可证信息不可用。

简单API客户端

1.0.0 2020-01-02 06:27 UTC

This package is auto-updated.

Last update: 2024-09-29 05:29:02 UTC


README

简单HTTP和REST API客户端

用法

use Phpid\Adapters\RestApiClient;

$rest = new RestApiClient('https://postman-echo.com');
$payload = [
    'title' => 'Test Payload REST Client',
    'description' => 'none'
];

// GET Request
echo $rest->get('/get')->response('body') . PHP_EOL;
// POST Request
echo $rest->post('/post', $payload)->response('body') . PHP_EOL;
// PUT Request
echo $rest->put('/put', $payload)->response('body') . PHP_EOL;
// DELETE Request
echo $rest->delete('/delete')->response('body') . PHP_EOL;

安装

通过 composer 安装

# composer require phpid/lib-api