irongit/rackspace-cloud-files-bundle

为#Symfony2 Bundles提供rackspace云文件支持

安装: 18

依赖者: 0

建议者: 0

安全: 0

星星: 0

关注者: 1

分支: 11

类型:symfony-bundle

dev-master 2013-03-26 16:29 UTC

This package is not auto-updated.

Last update: 2024-09-22 03:17:23 UTC


README

Rackspace Cloud Files bundle是一个简单易用的方式,可以在Symfony2应用程序中使用带命名空间的php-cloudfiles版本,

但它也有一些处理rackspace云文件的静态文件的便利设施。

这个Bundle最初是escapestudios/EscapeRackspaceCloudFilesBundle的分支,现在这两个Bundle非常不同。

Build Status

查看博客文章以获取更多详细信息

http://www.welcometothebundle.com/symfony2-assets-on-rackspace-cloud-files/

安装(老式方法)

查看博客文章以获取更多详细信息

依赖项

[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

$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

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

使用Composer安装

  • 1 首先,将依赖的Bundle添加到vendor/bundles目录。将以下行添加到composer.json文件中
    "require": {
    # ..
    "liuggio/rackspace-cloud-files-bundle": ">=2.0",
    # ..
    }
  • 2 然后,运行composer install

  • 3 然后,添加到您的app/AppKernel

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

配置

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?
#        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

服务

获取Rackspace服务以与之协同工作

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

无assetic的使用示例


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

or

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

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

使用assetic的使用示例

查看

http://www.welcometothebundle.com/symfony2-assets-on-rackspace-cloud-files/

使用特殊的控制台命令rscf:assets:install将bundle资产(public目录)安装到云文件中

app/console rscf:assets:install rscf://my_container/my/path

这将像assets:install命令一样复制资产,但直接到云文件中。注意:对于那些想知道为什么需要这个命令的人,请注意,assetic主要处理js/css资产,而且当不使用cssembed过滤器时,您仍然需要将图像安装到您的云文件容器中。此命令可以防止您手动执行此操作。

使用特殊的控制台命令assetic:install将应用程序资产(public目录)安装到云文件中

将其添加到config.yml中

assetic:
    debug: false
    use_controller: false
    write_to: rsfc://%rackspace_container_name%

输入控制台

app/console assetic:dump

需求

  • PHP > 5.3.0

  • rackspace/php-cloudfiles.git

  • liuggio/RackspaceCloudFilesStreamWrapper

  • Symfony2

贡献

请随时使用Git问题跟踪来报告任何问题或错误。如果您想积极开发库,鼓励您克隆存储库并发送pull请求。然后在贡献者部分添加您的姓名

贡献者

  • 感谢cystbear的建议

  • 这个bundle是escapestudios/EscapeRackspaceCloudFilesBundle的重新设计

  1. liuggio

  2. benjamindulau

许可证

此Bundle采用MIT许可证。请参阅Bundle中的完整许可证

Resources/meta/LICENSE