Hi everyone,
Well I have an idea for an extention to the Zend framework that would
allow you to make use of Amazon's S3 storage technology. This is
kind of my idea.
The object on construction would take in the key, shared secret, and
the Amazon S3 Url (which would be optional, in case someone else
mimics S3).
Now one thing I dislike about S3 is that having sub directories in
buckets is not an aspect of S3. I've seen in the past people talk
about ways to fake it using text and S3 Keys but I am not sure how S3
keys works yet, as I am just beginning to go down the S3 road, but
think it would be nice to have something that everyone can use.
Anyway, I want to make it simple for people, I think this is a good
beginning.
// Create the object.
$s3Obj = new Zend_S3($key,$secret);
// Create Bucket.
$s3Obj->createBucket("bucketName);
// Delete Bucket.
$s3Obj->dropBucket("bucketName);
// Upload file
$s3Obj->createFile(bucketName://fileName);
// Get the file
$s3Obj->getFile(bucketName://fileName);
// Delete file
$s3Obj->dropFile(bucketName://fileName);
For a directory path past the bucket I would expect something like
this, and everything would happen in the background to mimic a
directory path
//Upload file
$s3Obj->createFile(bucketName://path/to/file/fileName);
//Get the file
$s3Obj->getFile(bucketName://path/to/file/fileName);
//Delete file
$s3Obj->dropFile(bucketName://path/to/file/fileName);
I am not sure if there are other aspects of the S3 protocol that I am
not aware of that could be included, but I think this could be a
great resource.
I think this is a nice way to keep it simple, and is easy to follow.
What do you think?
James