edgetelemetrics / reactphp-http-browser-curl
An async http client using Curl and Fibers
Requires
- php: ^8.1
- ext-curl: *
- psr/http-message: ^1.0.1
- react/event-loop: ^1.2
Requires (Dev)
- phpunit/phpunit: ^9.5
- react/dns: *
- react/http: ^1.6
- ringcentral/psr7: ^1.2
This package is auto-updated.
Last update: 2024-04-26 01:51:31 UTC
README
Implementation of an Async HTTP client using CURL.
*** NOTE *** This is a work in progress, Not 100% compatible replacement for ReactPHP Browser
Why not use package react/http Browser?
Using cURL allows for HTTP/2+3, and the extraction of timing data for the requests. This functionality is not available though the ReactPHP Browser implementation
Requirements
The package is compatible with PHP 8.2+ and requires the cURL extension and react/event-loop library.
Installation
You can add the library as project dependency using Composer:
composer require edgetelemetrics/reactphp-http-browser-curl
Examples
See /examples directory. Examples based on examples from reactphp/http under MIT License
Timing
Request timing values are returned in the PSR7 Response object headers under the key Server-Timing
Configuration
The Browser can be configured with standard CURLOPT_* parameters given via the constructor.
$browser = new Browser([ CURLOPT_TIMEOUT => 20, CURLOPT_DOH_URL, 'https://1.1.1.1/dns-query', CURLOPT_DNS_SERVERS => '1.1.1.1', ]);
License
MIT, see LICENSE file.
Contributing
Bug reports (and small patches) can be submitted via the issue tracker. Forking the repository and submitting a Pull Request is preferred for substantial patches.