You are currently browsing
the website for symfony 1

Visit the Symfony2 website

« Back to the Plugins Home


Plugin Information Installation
Plugin image

NOTE: https://github.com/JoshuaEstes/sfAmazonS3Plugin is where you can find the latest code for this plugin as well as submit issues if any. The code contained within the symfony repo is not updated, however the github code is. Please use that code to be sure you are up to date.

This plugin allows you to connect to Amazon s3 services. You should note that you WILL NEED the Zend library for this. It needs to be installed in lib/vendor/Zend

Place this function in the ProjectConfiguration.class.php file:

  static public function registerZend()
    if (!self::$_ZendAutoloader)
      set_include_path(implode(PATH_SEPARATOR, array(

      require_once 'Zend/Loader/Autoloader.php';
      self::$_ZendAutoloader = Zend_Loader_Autoloader::getInstance();
    return self::$_ZendAutoloader;

In the same file add this variable to the top of the class:

  static protected $_ZendAutoloader = false;

If you have already added something similar in this file then you should be good as long as the function 'registerZend()' is in there and it is static.


        enabled: true
        bucket:  BUCKET NAME

        enabled: true
        bucket:  BUCKET NAME

        enabled: true
        bucket:  BUCKET NAME

        access_key: PLACE ACCESS KEY HERE
        secret_key: PLACE SECRET KEY HERE

by default, amazon s3 is configured to be off by default, if you wish to have it turned on by default the set 'enabled: true' for all

In you upload form update the widget that has the widget InputFile or similar widget.

    $this->widgetSchema['image'] = new sfWidgetFormInputFile();
    $this->validatorSchema[image'] = new sfValidatorFile(array(
      'mime_types' => 'web_images',
      'path' => sfConfig::get('sf_upload_write_dir').'/user_uploads',
      'validated_file_class' => 'sfValidatedAmazonS3File'

Please Note: This plugin was created from the presentation by Kris Wallsmith which can be found here http://www.slideshare.net/kriswallsmith/symfony-in-the-cloud


  • can be turned on/off (if disabled uploads goto your web/uploads directory)
  • environmental aware (can have different settings for dev, prod, and test)
  • can upload directly to your s3 bucket (if enabled) or can upload to you local web/uploads (if disabled)

Todo Features

  • add some tasks that allow you to sync files
  • add more helper functions that would allow you to use s3 as a CDN
  • security, since the access_key and secret_key are in the app.yml file, those keys can be viewed while in the dev environment.
  • Do away with the dependence of Zend and use the amazon sdk