Skip to content

Instantly share code, notes, and snippets.

@phybros
Created September 27, 2013 13:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phybros/6728972 to your computer and use it in GitHub Desktop.
Save phybros/6728972 to your computer and use it in GitHub Desktop.
More advanced usage of the stopwatch class
<?php
// create a new S3 instance
$s3 = new S3('my access key', 'my secret key');
// start the timer
StopWatch::start();
// read & send the file
$f = $s3->inputFile('file_to_upload.zip');
$r = $s3->putObject($f, 'my-bucket-name', 'uploaded_file.zip', S3::ACL_PUBLIC_READ);
if ($r !== false) {
// check how long it took
echo "Elapsed time: " . StopWatch::elapsed() . " seconds";
} else {
echo "S3 Error!";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment