Batch Uploads in Parallel
Leverage the power of parallel requests to get a ton of data into S3 quickly using this straightforward PHP 5 class. Example usage:
<?php
// assumes PEAR-compatible include_path installation
require_once 'Killersoft/Service/Amazon/S3/BatchPut.php';
// from
$source = "/path/to/my/stuff";
// to
$dest = "my-bucket/stuff";
// see source code for additional credential
// population options
$put = new Killersoft_Service_Amazon_S3_BatchPut(
'my_access_key',
'my_secret_key'
);
// oooh, fluid interface!
$results = $put->setSourceDir($source)
->setDestinationBucket($dest)
->debug(true)
->run()
->getResponses();
// will contain response headers, body,
// AND curl_getinfo() data for each
// file
print_r($results);
// Got errors? See what's up
if ($put->hasErrors()) {
var_dump($put->getErrors());
}
Reviews and critique welcomed! My intention is to support this class going forward, and your feedback will help.