Uncategorized

PHP AWS S3 Integration Library (Miscellaneous)

By Acty, January 28, 2014

PHP AWS S3 Integration Library provides an easiest way to integrate AWS S3 in a PHP project. Using this library you can use the S3(Simple Storage Service by Amazon) Bucket as a storage for user uploaded files in your project.

Note: In order to use S3 as a storage you do not need to host your project on AWS. You can use S3 service from any hosting server, even from your local Server too.

Features:

  1. Installation wizard helps you to setup AWS configuration very easily.
  2. Upload user uploaded files in S3 bucket directly, without storing on web-server.
  3. Manually upload/copy any web-server file to a S3 bucket.
  4. Copy a S3 file from one Bucket to another or in same Bucket.
  5. Create unlimited S3 Buckets in AWS account.
  6. Easily delete a file from S3 Bucket.
  7. Link any S3 file with a single easy to use function.
  8. Detailed documentation showing every aspect and use of library.

See how easy it is to use, with sample codes.

Using uploaded_file_to_s3() function, the uploaded file will store on same relative location in an S3 Bucket instead of web-server.

//Normal code to upload a file on web-server
move_uploaded_file($_FILES["file"]["tmp_name"], "upload/" . $_FILES["file"]["name"]);
//Change to
uploaded_file_to_s3($_FILES["file"], "uploads", true);

Using site_url_s3() function, File will be referenced from same relative location from S3 Bucket instead of web-server.

//Normal code to refer a file on web-server
<a href="uploads/myphoto.jpg">Download/View</a>
//Change to
<a href="<?php echo site_url_s3(" uploads="">">Download/View</a>

Upload a file manually from the web-server to an S3 bucket

//Upload uploads/myphoto.jpg file to S3 Bucket.
uploaded_file_to_s3_manually("uploads", "myphoto.jpg", "uploads", true);

Copy a S3 file from one Bucket to another or in same Bucket

//Copy S3 File
copy_s3($source, $destination);

To create a S3 Bucket in your AWS account

//Create a S3 Bucket
create_bucket($bucket_name);

Free Support:

I will be more then happy to help and provide support you through any problems you may have, or and features/suggestions that you want to implement. Just send me an email or leave a comment.

Note: AWS/S3 and Codeigniter are the Trademarks of their respective owners.