Download the PHP package gamsh/rest-client without Composer
On this page you can find all versions of the php package gamsh/rest-client. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download gamsh/rest-client
More information about gamsh/rest-client
Files in gamsh/rest-client
Informations about the package rest-client
RestClient
RestClient is an interface representing the main entry point for performing REST requests.
RestClient is a handy tool that adds a list of extra features to a Psr/HttpClient (at the same time it is not intended to replace Psr/HttpClient):
- Serializer/Deserialize request/response body.
- Intercept request (allows to modify request before sending or process a response object).
- Retry strategy.
Install
Quick Examples
Create a new REST client
For simplicity, we are using a Guzzle HTTP client, but you are free to use any PSR-18 compliant HTTP client.
Define an application response model
Get an object
Take a look at the example.
Get a list of objects
Take a look at the example.
Intercept request
Use case of interceptor:
- Request header modification
- Request and response logging
- Request denial based on certain request parameters
- Changing the request URL address
Out of the box you can use following interceptors:
- Log request
- Retry
- Add header
- Callable
Did not find a right interceptor? Do not get upset! It's easy to create a new one, just implement the following interface:
Set interceptors
All versions of rest-client with dependencies
ext-json Version *
psr/http-client Version ^1
psr/log Version ^3
guzzlehttp/guzzle Version 7.*
symfony/serializer Version 7.*
symfony/property-access Version 7.*