Skip to content

File storage on Amazon S3

Victor Jonsson edited this page Apr 24, 2014 · 10 revisions

In this document we will go through how to use Amazon's Simple Storage Service (S3) to store static files via PHP-Rocker. Here you can read more about how to store static files using PHP-Rocker.

1) Setup an Amazon S3 account

First you need to setup an account at amazone S3 (read more at amazon if you haven't done so already).

2) Install Amazone SDK using composer

Open composer.json and add "aws/aws-sdk-php": "2.3.1" to the requirements of your application. Having done so you open the console and navigate to your installation of PHP-Rocker and run composer install.

3) Edit config.php

Having your account up and running and the Amazon SDK installed you change the configuration parameter application.files in config.php, example:

  'application.files' => array(
    'class' => '\\Rocker\\Utils\\FileStorage\\S3',
    's3_key' => 'your aws key',
    's3_secret' => 'your aws secret',
    's3_bucket' => 'name of your bucket',
    's3_endpoint' => 'endpoint for your account',
    'base' => 'http://your-endpoint.s3.amazonaws.com/'
  )