phpid/lib-api

There is no license information available for the latest version (1.0.0) of this package.

Simple API Client

1.0.0 2020-01-02 06:27 UTC

This package is auto-updated.

Last update: 2024-11-29 05:57:21 UTC


README

Simple HTTP and REST API Client

Usage

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;

Install

Install through composer

# composer require phpid/lib-api