1. Go to this page and download the library: Download clue/packagist-api-react 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/ */
clue / packagist-api-react example snippets
$loop = React\EventLoop\Factory::create();
$browser = new Clue\React\Buzz\Browser($loop);
$client = new Client($browser);
$client->get('clue/phar-composer')->then(function (Package $package) {
var_dump($package->getName(), $package->getDescription());
});
$loop->run();
$loop = React\EventLoop\Factory::create();
$browser = new Clue\React\Buzz\Browser($loop);
$client = new Client($browser);
$client->get('clue/graph-composer')->then(
function ($result) {
// result received for get() function
},
function (Exception $e) {
// an error occured while executing the request
}
});
$promise = $client->get('clue/graph-composer');
$loop->addTimer(2.0, function () use ($promise) {
$promise->cancel();
});
$browser = new Browser($loop);
$browser = $browser->withOptions(array(
'timeout' => 10.0
));
$client = new Client($browser);
$client->get('clue/graph-composer')->then(function ($result) {
// result received within 10 seconds maximum
var_dump($result);
});