Download the PHP package phasync/http-client without Composer
On this page you can find all versions of the php package phasync/http-client. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download phasync/http-client
More information about phasync/http-client
Files in phasync/http-client
Package http-client
Short Description An async PSR-18 HTTP Client implementation.
License MIT
Informations about the package http-client
phasync/http-client
The phasync HTTP Client is a powerful, fiber-based HTTP client for PHP, leveraging the concurrency features of PHP Fibers to manage non-blocking requests efficiently. This client is compliant with PSR-18 and allows extensive configuration via cURL options to tailor request handling according to your needs.
Features
- Concurrent HTTP requests: Utilizes PHP fibers to perform non-blocking HTTP requests.
- Full PSR-18 compatibility: Fully compliant with the PSR-18 interface for HTTP clients.
- Extensive configuration: Customize every aspect of HTTP requests using a wide range of cURL options.
Installation
Use Composer to install the Phasync HTTP Client in your project:
Usage
Basic Usage
Here is a simple example of making concurrent GET request:
POST Request
To send a POST request with data:
PSR-18 Client Usage
The client supports the PSR-18 client specification:
Handling Redirects
Automatically handle redirects:
Custom cURL Options
Customize client behavior by setting cURL options:
Configuration Options
The HttpClientOptions
class provides a way to configure a variety of options for handling requests:
userAgent
: Set the 'User-Agent' header.timeoutMs
: Maximum number of milliseconds to allow cURL functions to execute.followLocation
: Follow redirects.sslVerifyPeer
: Verify the peer's SSL certificate.- And many more detailed in the class definition.
Refer to the HttpClientOptions
class for a comprehensive list of all configurable options.
Contributing
Contributions are welcome! Please feel free to submit pull requests or create issues for bugs and feature requests.
License
This project is open-sourced software licensed under the MIT license.