PHP code example of topphp / topphp-pool

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

    

topphp / topphp-pool example snippets


$rpcConfig = App::make(RpcConfig::class, []);
if (isset($config) && !empty($config)) {
    $rpcConfig
        ->setNode($this->node)
        ->setOptions($config['options'])
        ->setMinConnections($config['pool']['min_connections'])
        ->setMaxConnections($config['pool']['max_connections'])
        ->setConnectTimeout($config['pool']['connect_timeout'])
        ->setMaxIdleTime($config['pool']['max_idle_time'])
        ->setWaitTimeout($config['pool']['wait_timeout']);
}
/** @var RpcPool $pool */
$pool   = App::make(RpcPool::class, [
    $rpcConfig,
    10
]);
$client = $pool->get();