You can do this with a combination of two features in the PHP SDK.
First, checkout the S3Client::uploadDirectory()
method (see user guide). You can upload a while directory's contents like this:
$s3Client->uploadDirectory('/local/directory', 'your-bucket-name');
If you combine this with the S3 Stream Wrapper, then instead of using a local directory as the source, you can specify a bucket.
$s3Client->registerStreamWrapper();
$s3Client->uploadDirectory('s3://your-other-bucket-name', 'your-bucket-name');
This is pretty powerful, because you can even do something across regions if you use a differently configured S3Client
object for the Stream Wrapper than the one doing the uploadDirectory()
.