zf php,ZF2 Module for php-opencloud

php-opencloud-zf2

A simple but powerful ZF2 module that allows your web app to communicate easily with Rackspace/OpenStack APIs. You can

manage your cloud account configurations, use Swift helper functions in your view files, monitor your cloud servers, sync

directories with a CDN, update DNS records... In short, you get the full benefit of an SDK without all the overhead.

Installation

Step 1: Install Composer (if you haven't already)

curl -sS https://getcomposer.org/installer | php

Step 2: Install the module

php composer.phar require jamiehannaford/php-opencloud-zf2:dev-master

This will automatically update your composer.json configuration file and force Composer to install the module. Alternatively,

you can manually insert the requirement like so:

{

"require": {

"jamiehannaford/php-opencloud-zf2": "~1.0"

}

}

And then run:

php composer.phar install

Step 3: ZF2 Configuration

You need to update your application.config.php file, and add in the module:

return array(

'modules' => array(

// other modules...

'OpenCloud'

)

);

You then need to make sure you have an opencloud.local.php configuration file in your config/autoload

directory - since this is what holds all your API configuration values. To make life easier, you can copy the dist

version shipped with this project:

cp ./vendor/jamiehannaford/php-opencloud-zf2/config/opencloud.local.php.dist ./config/autoload/opencloud.local.php

If using Rackspace, you must fill in the username and apiKey config options.

If using OpenStack, you must fill in the username, password config options, along with either tenantId or tenantName.

Usage

You can retrieve a Rackspace client object using the Service Manager:

public function indexAction()

{

// get Rackspace client

$rackspace = $this->getServiceLocator()->get('OpenCloud');

// this also works

$rackspace = $this->getServiceLocator()->get('OpenCloud\Rackspace');

// get OpenStack client

$openstack = $this->getServiceLocator()->get('OpenCloud\OpenStack');

}

Once this client object is available, you have full access to the php-opencloud SDK.

View helpers

Please see the CloudFilesHelper wiki

for more information about how you can streamline the process of accessing CDN resources in your HTML views.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值