1

For a custom application, I am trying to integrate Rackspace cloud files using php-opencloud library.

This is the link I followed for setup -https://github.com/srijanaravali/php-opencloud/blob/master/docs/getting-started.md

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

# Require php-opencloud as a dependency
php composer.phar require rackspace/php-opencloud:dev-master

However, when I try to instantiate a client object, it throws an error:

Fatal error: Class 'OpenCloud\Rackspace' not found in /var/www/example/Project/sites/all/libraries/php-opencloud/test.php on line 7

Here is the code snippet:

<?php

require 'vendor/autoload.php';
use OpenCloud\Rackspace;

// 1. Instantiate a Rackspace client.
$client = new Rackspace(Rackspace::US_IDENTITY_ENDPOINT, array(
    'username' => getenv('Axxxxxxx'),
    'apiKey'   => getenv('abcxxxxxxxxxxxxxxxxxxxx')
));

print_r($client); die('!!');

Any pointers about whats missing?

fotuzlab
  • 1,436
  • 1
  • 15
  • 19
  • The way I've been installing it via composer is using `composer require rackspace/php-opencloud:dev-master`, via the [Rackspace Developer site](https://developer.rackspace.com/sdks/php/). – Kyle Kelley Sep 01 '14 at 14:54

1 Answers1

0

Got it working. For some strange reason, php-opencloud library was empty under vendors/rackspace/php-opencloud.

Cloned one from github and created a symlink to it from above directory. It is working fine now.

fotuzlab
  • 1,436
  • 1
  • 15
  • 19
  • Glad you got it working but you really should try to install it using composer if you can. After you run `php composer.phar require rackspace/php-opencloud:dev-master`, what is the output of `ls -l vendor/`? – Shaunak Kashyap Sep 05 '14 at 17:22
  • Yes it was. I installed it through composer as mentioned in the question above. Ideally the lib should have downloaded along. It did not for reason unknown to me. Hence, got stumped in first place. – fotuzlab Sep 06 '14 at 10:51