Fatal error: Class 'OpenCloud\Rackspace' not found

1.1k Views Asked by At

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?

1

There are 1 best solutions below

2
On

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.