innmind/rest-client

This package is abandoned and no longer maintained. No replacement package was suggested.

Library to consume REST APIs

8.1.0 2021-02-14 10:51 UTC

This package is auto-updated.

Last update: 2023-01-11 18:03:09 UTC


README

Build Status codecov Type Coverage

This library is intended to consume APIs built with the RestServer.

Installation

composer require innmind/rest-client

Usage

use Innmind\OperatingSystem\Factory;
use Innmind\Url\Path;
use Innmind\UrlResolver\UrlResolver;
use function Innmind\Rest\Client\bootstrap;

$os = Factory::build();
$client = bootstrap(
    $os->remote()->http(),
    new UrlResolver,
    $os->filesystem()->mount(Path::of('/somewhere/to/cache/data')),
);

$client
    ->server('http://example.com/')
    ->capabilities()
    ->names();

This example would return all the resource available through the api of http://example.com/.

Then you can access the following method on any server: all, read, create, update and remove. Check the interface to understand how to use these methods.

Structure