PHP code example of bronto / php-common-helper

1. Go to this page and download the library: Download bronto/php-common-helper 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/ */

    

bronto / php-common-helper example snippets




$json = new \Bronto\Serialize\Json\Standard();
$curls = new \Bronto\Transfer\Curl\Adapter();
$request = $curls->createRequest('GET', 'http://some-resource.com');
$response = $request->respond();

$data = $json->decode($response->body());

$multi = new \Bronto\Transfer\Curl\Multi();
// Below are the defaults
$multi
    ->setMaxConnections(10)
    ->setPipeLining(true)
    ->setExecuteEagerly(true);
foreach ($data as $customer) {
    $request = $curls->createRequest('POST', 'http://some-resource.com')
        ->header('Authorization', 'Bearer: abc123')
        ->header('Content-Type', $json->getMimeType())
        ->body($json->encode($customer))
        ->on('complete', function($response) {
            var_dump($response);
        });
    $multi->add($request);
}
$multi->complete();