Skip to content
This repository has been archived by the owner on Jan 15, 2022. It is now read-only.

bronto/php-common-helper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

56 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bronto PHP Common Library

This package is archived and no longer maintained.

This package contains a number of common scripts and utilities used throughout the PHP packages provided by Bronto.

Provided is a set of functional utilties and a chainable object that wraps an associative array.

Transfer

The library ships with a pretty nice cURL transfer impl

<?php

$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();

About

Library wrapping general PHP functions. Released under Apache v2. Not supported. Not accepting contributions.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages