Hey! Keep up to date with the project through its beta and public launch by following @getsparks.Tweet
CodeIgniter Starter Project − A Starting Point for Any CI Dev
December 12, 2011
An abstract library that gives support to different cloud storage solutions (Ie. Rackspace & Amazon)
|: Log in to view|
|Author Website||: http://www.cloudmanic.com|
|Spark Website||: https://github.com/cloudmanic/cloudmanic-storage|
|Repository Type||: git|
|Number of Installs||: 1,508|
php tools/spark install -v1.0.4 cloudmanic-storageOr download this version manually: Get cloudmanic-storage-1.0.4.zip
A Codeigniter package for interfacing with different cloud storage solutions such as Rackspace CloudFiles and Amazon S3. Easily switch between providers without having to change your code. This package provides- uniform input and response.
Rackspace Cloudfiles ::: http://www.rackspace.com/cloud/cloudhostingproducts/files/
Amazon.com S3 ::: http://aws.amazon.com/s3/
This package was built to be used with http://getsparks.org/. It should work as a stand alone Codeigniter 3rd party package as well.
Best way to get started is to checkout the example controller in controllers/example.php. You can see complete examples from Amazon & Rackspace.
You can always use a symlink from your controller to the package. For example if you are using http://getsparks.org/ you could do this to run the test controller.
ln -s application/sparks/cloudmanic-storage/1.0.0/controllers/example.php application/controllers/example.php
Don't forget to setup your config/storage.php. You have to enter your different API keys for the different supported providers.
After setting up your keys you need to select a storage driver (or providers)
$this->storage->load_driver('rackspace-cf'); // rackspace-cf or amazon-s3
Create a new container with the provider. Second argument is either "private or public". This would trigger if the container can be accessed publicly without authentication or not. Note: Amazon s3 calls containers buckets, just to clear up any confusion.
Returns an array of container names from the provider.
This function takes 3 arguments the name of the container you are uploading the file to. The full file system path to the file you are uploading, and the name the file will be stored as.
$this->storage->upload_file('container-name', '/tmp/test01.jpg', 'test01.jpg');
This function is primarily for Amazon s3 because Rackspace does not support this feature. You can pass in a container name, file name, and expiration time in seconds. This function then will return a public URL to the file. The url will no longer be available after the expiration time.
Since Rackspace does not support this feature, this function will still work but it calls a custom library method you set in the configuration. The idea behind this is you can create your own controller that downloads the file from Rackspace Cloud Files and delivers the file to the user. You more or less build your own custom authentication layer. For an example of this custom wrapper class check out libraries/rackspacecfurl.php. In this example you would set this config to the following. $config['storage']['cfauthurl'] = array('library' => 'RackspaceCfUrl', 'method' => 'get_url'); It uses the Codeigniter library loader to load this library.
$this->storage->get_authenticated_url('container-name', 'test01.jpg', 60);
This function returns a list files that live within the container that is passed in. Additional data such as name, url, md5 hash, and more is also included.
Delete a file from the provider. We pass in a container name and a file name. This file will be deleted forever.
Delete a container. The files within that container must be deleted first.
php tools/spark install -v1.0.2 cloudmanic-storageOr download this version manually: Get cloudmanic-storage-1.0.2.zip
php tools/spark install -v1.0.1 cloudmanic-storageOr download this version manually: Get cloudmanic-storage-1.0.1.zip
php tools/spark install -v1.0.0 cloudmanic-storageOr download this version manually: Get cloudmanic-storeage-1.0.0.zip