HPCloud-PHP
1.2.0
PHP bindings for HPCloud and OpenStack services.
|
Bootstrapping services. More...
Static Public Member Functions | |
static | useAutoloader () |
Add the autoloader to PHP's autoloader list. | |
static | useStreamWrappers () |
Register stream wrappers for HPCloud. | |
static | setConfiguration ($array) |
Set configuration directives for HPCloud. | |
static | autoload ($klass) |
HPCloud autoloader. | |
static | config ($name=NULL, $default=NULL) |
Get a configuration option. | |
static | hasConfig ($name) |
Check whether the given configuration option is set. | |
static | identity ($force=FALSE) |
Get a HPCloud::Services::IdentityService object from the bootstrap config. |
Static Public Attributes | |
static | $basedir = __DIR__ |
The directory where HPCloud is located. | |
static | $config |
static | $identity = NULL |
Bootstrapping services.
There is no requirement that this class be used. HPCloud is built to be flexible, and any individual component can be used directly, with one caveat: No explicit require
or include
calls are made. See the "autoloaders" discussion below.
This class provides the following services:
Configuration
Configuration directives can be merged into the existing confiuration using the setConfiguration method.
AUTOLOADING
HPCloud comes with a built-in autoloader that can be called like this:
That said, many projects rely upon packages to handle their own class loading. To provide this, this package contains a custom classloader that will load JUST the HPCloud classes. See the Bootstrap::useAutoloader() static method.
See https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md
STREAM WRAPPERS
Stream wrappers allow you to use the built-in file manipulation functions in PHP to interact with other services. Specifically, the HPCloud stream wrappers allow you to use built-in file commands to access Object Storage (Swift) and other HPCloud services using commands like file_get_contents() and fopen().
It's awesome. Trust me.
Definition at line 117 of file Bootstrap.php.
|
static |
HPCloud autoloader.
An implementation of a PHP autoload function. Use HPCloud::useAutoloader() if you want PHP to automatically load classes using this autoloader.
This is a special-purpose autoloader for loading only the HPCloud classes. It will not attempt to autoload anything outside of the HPCloud namespace.
Because this is a special-purpose autoloader, it should be safe to use with other special-purpose autoloaders (and also projects that don't rely upon autoloaders).
string | $klass | The fully qualified name of the class to be autoloaded. |
Definition at line 264 of file Bootstrap.php.
|
static |
Get a configuration option.
Get a configuration option by name, with an optional default.
string | $name | The name of the configuration option to get. |
mixed | $default | The default value to return if the name is not found. |
mixed |
Definition at line 304 of file Bootstrap.php.
References $name.
Referenced by PHPStreamTransport\buildStreamContext(), and CURLTransport\handleDoRequest().
|
static |
Check whether the given configuration option is set.
string | $name | The name of the item to check for. |
boolean |
Definition at line 337 of file Bootstrap.php.
References $name.
Referenced by PHPStreamTransport\buildStreamContext(), PHPStreamTransport\doRequest(), and CURLTransport\handleDoRequest().
|
static |
Get a HPCloud::Services::IdentityService object from the bootstrap config.
A factory helper function that uses the bootstrap configuration to create a ready to use HPCloud::Services::IdentityService object.
bool | $force | Whether to force the generation of a new object even if one is already cached. |
HPCloud::Services::IdentityService |
HPCloud::Exception | When the needed configuration to authenticate is not available. |
Definition at line 356 of file Bootstrap.php.
References $account.
|
static |
Set configuration directives for HPCloud.
This merges the provided associative array into the existing configuration parameters (Bootstrap::$config).
All of the HPCloud classes share the same configuration. This ensures that a stable runtime environment is maintained.
Common configuration directives:
The CURL wrapper supports proxy settings:
array | $array | An associative array of configuration directives. |
Definition at line 236 of file Bootstrap.php.
|
static |
Add the autoloader to PHP's autoloader list.
This will add the internal special-purpose autoloader to the list of autoloaders that PHP will leverage to resolve class paths.
Because HPCloud is PSR-0 compliant, any full PSR-0 classloader should be capable of loading these classes witout issue. You may prefer to use a standard PSR-0 loader instead of this one.
Definition at line 154 of file Bootstrap.php.
|
static |
Register stream wrappers for HPCloud.
This register the ObjectStorage stream wrappers, which allow you to access ObjectStorage through standard file access mechanisms.
Definition at line 180 of file Bootstrap.php.
|
static |
The directory where HPCloud is located.
Definition at line 122 of file Bootstrap.php.
|
static |
Definition at line 124 of file Bootstrap.php.
|
static |
Definition at line 138 of file Bootstrap.php.