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
Requires
- php: ~7.4|~8.0
- innmind/http: ~4.2
- innmind/immutable: ~3.5
- innmind/json: ^1.1
- innmind/operating-system: ~2.0
- innmind/specification: ~2.0
- innmind/url-resolver: ~4.0
- willdurand/negotiation: ~3.0
Requires (Dev)
- innmind/cli: ~2.0
- innmind/coding-standard: ^1.1
- innmind/object-graph: ~2.0
- phpunit/phpunit: ~9.0
- vimeo/psalm: ~4.4
README
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.