Download the PHP package drewlabs/psr18 without Composer
On this page you can find all versions of the php package drewlabs/psr18. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download drewlabs/psr18
More information about drewlabs/psr18
Files in drewlabs/psr18
Package psr18
Short Description PSR18 compatible http client based on PHP curl client library
License MIT
Informations about the package psr18
cURL PSR18 compatible client
This project provides a PSR18 client implementation based on the cURL client object.
Installation
Recommended way to install the library is by using PHP package manager composer
running the command below:
composer require drewlabs/psr18
Usage
PSR18 Client
The package comes with a PSR18 compatible Client using the PHP cURL library. To creates an instance of the client:
Client options
Client options, provide developpers with a way to override parameters passed to the Client::sendRequest()
method. The package provide a PHP class for building client option as alternative to using PHP dictionary type (a.k.a PHP array).
-
Creating the client options using a factory function
- Using the fluent API
Alternative to using the factory function, we can use the fluent API for creating a client options. The fluent API attemps to reduce developper typo errors by providing methods to defining option values:
Note API for request options & client option fluent API can be found in the API reference documentation.
Sending a PSR18 request
Sending request is simply as using any PSR18 compatible library:
To send a JSON request, developpers call the Client::json()
method before sending the request to the server:
Alternatively, to send a multipart/form-data
request, developpers call the Client::multipart()
method before sending the request to the server:
All versions of psr18 with dependencies
drewlabs/psr7 Version ^0.1.5|^0.2.0
drewlabs/curl-client Version ^0.4.0