guzzlehttp/ringphp
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|---|---|---|---|---|
guzzlehttp/streams | 3.0.0 | 42.49 kB | MIT | prod | 1 |
react/promise | v2.11.0 | - | MIT | prod |
Guzzlehttp/RingPHP is a sophisticated tool that provides a simplified API and specification to abstract HTTP specifics into a solitary function in PHP. Its primary role is to power HTTP clients and servers effectively through a PHP function, aiding both synchronous and asynchronous workflows. This is accomplished through a request hash that's accepted and a response hash returned, utilizing 'promise'. RingPHP's forte lies in abstracting the different HTTP clients and servers' implementation details, enabling the use of flexible HTTP clients and servers without committing your application to a particular implementation.
To use Guzzlehttp/RingPHP, a composer dependency is necessary to include in your project. Use the command 'composer require guzzlehttp/ringphp'. Once installed, you can integrate it into your PHP code. Here's a basic code example:
<?php
require 'vendor/autoload.php';
use GuzzleHttp\Ring\Client\CurlHandler;
$handler = new CurlHandler();
$response = $handler([
'http_method' => 'GET',
'uri' => '/',
'headers' => [
'host' => ['www.google.com'],
'x-foo' => ['baz']
]
]);
$response->then(function (array $response) {
echo $response['status'];
});
$response->wait();
This snippet creates a new cURL handler, sends a GET request to Google's homepage, and after receiving the response, it echoes the HTTP status.
The Guzzlehttp/RingPHP full documentation is available online at http://ringphp.readthedocs.org/. The comprehensive guide covers various aspects, from setup and configuration to different ways of leveraging the capabilities of RingPHP, providing essential details for both newbies and experienced developers alike.