1. Go to this page and download the library: Download phprise/http library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
phprise / http example snippets
use Phprise\Http\Connector\Connector;
use Phprise\Http\Client\NativeClient;
use Phprise\Http\Request\ListRequest;
use Phprise\Http\ValueObject\Uri;
$connector = new Connector(new NativeClient());
$request = new ListRequest(new Uri('https://jsonplaceholder.typicode.com/posts'));
$response = $connector->send($request);
echo $response->getStatusCode(); // 200
use Phprise\Http\Connector\AsyncConnector;
use Phprise\Http\Client\NativeClient;
$async = new AsyncConnector(new NativeClient());
$promise = $async->send($request);
$promise->then(function ($response) {
echo $response->getStatusCode();
});
$promise->wait();
use Phprise\Http\Connector\Connector;
$connector = new Connector($anyPsr18Client);
use Phprise\Http\Request\StoreRequest;
use Phprise\Http\ValueObject\Uri;
$request = new StoreRequest(new Uri($url), $myDto);
use Phprise\Http\Connector\EventedConnector;
$connector = new EventedConnector($baseConnector, $eventDispatcher);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.