2017 © Pedro Peláez
 

symfony-bundle rackspace-cloud-files-bundle

Provides rackspace cloud files support for #Symfony2 Bundles

image

liuggio/rackspace-cloud-files-bundle

Provides rackspace cloud files support for #Symfony2 Bundles

  • Wednesday, April 3, 2013
  • by liuggio
  • Repository
  • 4 Watchers
  • 9 Stars
  • 855 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 14 Forks
  • 1 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Introduction

Rackspace Cloud Files bundle is a simple and easy way to use the namespaced version of php-cloudfiles with Symfony2 applications,, (*1)

but it has also some facilities for handle the static file with the rackspace cloud files., (*2)

This Bundle borns as fork of the escapestudios/EscapeRackspaceCloudFilesBundle, now these two bundles are very different., (*3)

Build Status, (*4)

see the blog post for more detail, (*5)

http://www.welcometothebundle.com/symfony2-assets-on-rackspace-cloud-files/, (*6)

Installation (old school)

see the blog post for more detail, (*7)

deps:, (*8)

[php-cloudfiles]
    git=git://github.com/rackspace/php-cloudfiles.git
    target=/rackspace/php-cloudfiles

[RackspaceCloudFilesBundle]
    git=https://github.com/liuggio/RackspaceCloudFilesBundle.git
    target=/bundles/Liuggio/RackspaceCloudFilesBundle

[RackspaceCloudFilesStreamWrapper]
    git=https://github.com/liuggio/RackspaceCloudFilesStreamWrapper.git
    target=liuggio-rscf-streamwrapper

app/autoload.php, (*9)

$loader->registerNamespaces(array(
    //other namespaces
    'Liuggio\\RackspaceCloudFilesStreamWrapper' =>  __DIR__.'/../vendor/liuggio-rscf-streamwrapper/src',
    'Liuggio\\RackspaceCloudFilesBundle'        =>  __DIR__.'/../vendor/bundles',
  ));

require_once __DIR__.'/../vendor/rackspace/php-cloudfiles/cloudfiles.php';

app/AppKernel.php, (*10)

public function registerBundles()
{
    return array(
        //other bundles
        new Liuggio\RackspaceCloudFilesBundle\LiuggioRackspaceCloudFilesBundle(),
    );
    ...

Installation Composer

  • 1 First, add the dependent bundles to the vendor/bundles directory. Add the following lines to the composer.json file
    "require": {
    # ..
    "liuggio/rackspace-cloud-files-bundle": ">=2.0",
    # ..
    }
  • 2 Then run composer install, (*11)

  • 3 Then add in your app/AppKernel, (*12)

``` yaml, (*13)

class AppKernel extends Kernel { public function registerBundles() { $bundles = array( // ... new Liuggio\RackspaceCloudFilesBundle\LiuggioRackspaceCloudFilesBundle(), // ..., (*14)



## Configuration app/config/config.yml

Rackspace Cloud Files configuration

liuggio_rackspace_cloud_files: service_class: Liuggio\RackspaceCloudFilesStreamWrapper\StreamWrapper\RackspaceCloudFilesStreamWrapper stream_wrapper: register: true # do you want to register stream wrapper?, (*15)

protocol_name: rscf

class: Liuggio\StreamWrapper\RackspaceCloudFilesStreamWrapper

auth:
    username: YOUR-USERNAME
    api_key: YOUR-API-KEY
    host: https://lon.auth.api.rackspacecloud.com # or usa
    container_name: YOUR-CONTAINER-NAME
    region: LON # or DFW or ORD

## Service(s) Get the Rackspace service to work with:

$auth = $this->get('liuggio_rackspace_cloud_files.service'), (*16)


## Usage example without assetic

$conn = $this->get('liuggio_rackspace_cloud_files.service'); $container = $conn->apiGetContainer('container-name');, (*17)

or, (*18)

$container = $this->get('liuggio_rackspace_cloud_files.service')->apiGetContainer('container-name');, (*19)

echo ", (*20)

";
printf("Container %s has %d object(s) consuming %d bytes\n",
    $container->name, $container->count, $container->bytes);
echo "

";, (*21)



## Usage example with assetic see http://www.welcometothebundle.com/symfony2-assets-on-rackspace-cloud-files/ ## Installing bundles assets (public directory) to cloudfiles with `rscf:assets:install` special console command

app/console rscf:assets:install rscf://my_container/my/path, (*22)


This will copy assets just like the `assets:install` command would but directly to cloudfiles. **Note**: For those wondering why this command could be needed, note that assetic mainly handles js/css assets, and when not using the cssembed filter, you still need to install images to your cloudfiles container. This command prevent you from having to do that by hand. ## Installing application assets (public directory) to cloudfiles with `assetic:install` special console command add this into the config.yml

assetic: debug: false use_controller: false write_to: rsfc://%rackspace_container_name%, (*23)


Type to the console

app/console assetic:dump ```, (*24)

Requirements

  • PHP > 5.3.0, (*25)

  • rackspace/php-cloudfiles.git, (*26)

  • liuggio/RackspaceCloudFilesStreamWrapper, (*27)

  • Symfony2, (*28)

Contribute

Please feel free to use the Git issue tracking to report back any problems or errors. You're encouraged to clone the repository and send pull requests if you'd like to contribute actively in developing the library. than add your name to this file under the contributor section, (*29)

Contributor

  • thanks for cystbear for the tips, (*30)

  • the bundle is a reengeneering of the escapestudios/EscapeRackspaceCloudFilesBundle, (*31)

  1. liuggio, (*32)

  2. benjamindulau, (*33)

License

This bundle is under the MIT license. See the complete license in the bundle:, (*34)

Resources/meta/LICENSE

The Versions

03/04 2013

dev-master

9999999-dev

Provides rackspace cloud files support for #Symfony2 Bundles

  Sources   Download

MIT

The Requires

 

cloud rackspace assetic

10/02 2013

v2.0

2.0.0.0

Provides rackspace cloud files support for #Symfony2 Bundles

  Sources   Download

MIT

The Requires

 

cloud rackspace assetic