2017 © Pedro Peláez
 

library fetcher

image

litek/fetcher

  • Monday, September 24, 2012
  • by litek
  • Repository
  • 1 Watchers
  • 1 Stars
  • 5 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

cURL wrapper for fetching URLs in parallel, (*1)

$google = new Fetcher\Client;
$google->queue('http://google.com/', function($response) {
  // handle response
});

$bing = new Fetcher\Client;
$bing->queue('http://bing.com/', function($response, $bing, $master) {
  // you can also queue a new url for fetching when reacting on a response
  $bing->queue('http://url', function($response) {
    // handle response
  });

  // or even attach another client for parallel retrieval
  $yahoo = $master->createClient();
  $yahoo->queue('http://yahoo.com/', function($response) {
    // handle this response
  });
});

// run in parallel
$master = new Fetcher\Parallel;
$master->run([$google, $bing]);

// will be done after the slowest request chain, instead of the sum of requests
echo "Done.";

Multiple requests queued on the same client will be run sequentially., (*2)

Can also be used as a cURL wrapper for a single request., (*3)

$example = new Fetcher\Client;
$example->queue('http://example.org/', function($response) {
  // handle response
})->run();

The Versions

24/09 2012

dev-master

9999999-dev

  Sources   Download