PHP code example of michabbb / toper

1. Go to this page and download the library: Download michabbb/toper 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/ */

    

michabbb / toper example snippets



use Toper\GuzzleClientFactory;
use Toper\StaticHostPoolProvider;

$hostPollProvider = new StaticHostPoolProvider(
    array("http://service1.com", "http://service2.com")
); 
$guzzleClientFactory = new GuzzleClientFactory();

$toper = new \Toper\Client($hostPollProvider, $guzzleClientFactory);
$response = $toper->get('/')
    ->send();

if($response->getStatusCode() == 200) {
    echo $response->getBody();
}
sh
#install composer
curl -sS https://getcomposer.org/installer | php