HPCloud-PHP  1.2.0
PHP bindings for HPCloud and OpenStack services.
 All Classes Namespaces Files Functions Variables Pages
documentation.php
Go to the documentation of this file.
1 <?php
2 /** @mainpage About HPCloud-PHP
3  *
4  * This is the documentation for the HPCloud PHP library.
5  *
6  * @section about_package Overview
7  *
8  * <a href="http://hpcloud.com">HPCloud</a> provides public cloud
9  * infrastructure that is business-grade, open source-based, and developer
10  * focused. Built on <a href="http://openstack.org">OpenStack</a>, it provides
11  * many cloud-based services that developers can take advantage of when
12  * building robust and reliable websites.
13  *
14  * The HPCloud-PHP library provides PHP developers with a fully tested,
15  * robust, and feature-rich library for working with the HPCloud services.
16  *
17  * @attention
18  * Making use of this library will require that you have several pieces of
19  * account information for your HPCloud account (or OpenStack account, if you're
20  * using this library with non-HP OpenStack implentations):
21  * - account ID and secret key: For cases where you want account-wide
22  * authentication/authorization.
23  * - username/password: Typically, this is the same username/password you use
24  * to access the HPCloud console.
25  * - tenant ID: This associates an account or user with a bundle of services.
26  * You can find this information in your console.
27  * - endpoint: You will need the URL to the HPCloud endpoint responsible for
28  * <i>authenticating users</i>. This can be found in your console.
29  *
30  * (If you are not sure what the "HPCloud Console" is, head over to
31  * http://docs.hpcloud.com. There you will find some articles and videos
32  * explaining the HPCloud structure.)
33  *
34  * @section where_to_start Where To Start
35  *
36  * Cruising a list of methods and classes is not exactly the best way to get
37  * started with a library. It's better to know where to start. Here's
38  * what we suggest:
39  *
40  *- There are a few tutorials inside this documentation that will help you
41  * get started. One explains [Stream Wrappers](@ref streams-tutorial) and
42  * the other [the library itself](@ref oo-tutorial).
43  *- Connecting and logging in is almost inevitably going to be your first
44  * task. For that, you will want to look at IdentityServices.
45  *- ObjectStorage (a.k.a. swift) is our cloud storage system. There are
46  * two ways to use it:
47  * - You can explore the object oriented API, starting with ObjectStorage.
48  * - You can use the PHP stream wrappers to access your object storage. This
49  * is explained in StreamWrapper.
50  *
51  * @section learn_more Learn More
52  *
53  * This documentation is intended to provide a detailed reference to the
54  * HPCloud-PHP library. But this ain't all we've got. Tutorials, videos,
55  * screencasts, a knowledge base, and active community forums are
56  * just a click away.
57  *
58  * Head over to http://docs.hpcloud.com to find these and other resources.
59  *
60  * Or maybe you'd just like to see a couple of examples.
61  *
62  * @section intro_example_sw Basic Example: Stream Wrappers
63  *
64  * The super-simple stream API:
65  *
66  * @code
67  * <?php
68  * // This is only required if you don't have a PSR-0
69  * // autoloader to do the hard work for you.
70  * require 'HPCloud/Bootstrap.php';
71  *
72  * // If you aren't using a PSR-0 autoloader,
73  * // you might want to use this:
74  * \HPCloud\Bootstrap::useAutoloader();
75  *
76  * // Turn on stream wrappers.
77  * \HPCloud\Bootstrap::useStreamWrappers();
78  *
79  * // Create a stream context. You can get this
80  * // information (including tenant ID) from your
81  * // HPCloud console.
82  * $cxt = stream_context_create(array(
83  * 'username' => 'matthew.butcher@hp.com',
84  * 'password' => 'secret',
85  * 'tenantid' => '123456',
86  * 'endpoint' => 'http://url.from.hpcloud.com/',
87  * ));
88  *
89  *
90  * // Get an object from the remote object storage and read it as a string
91  * // right into $myObject.
92  * $myObject = file_get_contents('swift://mycontainer/foo.txt', FALSE, $cxt);
93  *
94  * ?>
95  * @endcode
96  *
97  * With stream wrapper support, you can transparently read and write files to the
98  * HPCloud ObjectStorage service without using any fancy API at all. Use the
99  * normal file methods like this:
100  *
101  *- fopen()/fclose()
102  *- fread()/fwrite()
103  *- file_get_contents(), stream_get_contents()
104  *- stat()/fstat()
105  *- is_readable()/is_writable()
106  *- And so on (http://us3.php.net/manual/en/ref.filesystem.php).
107  *
108  * Learn more about this at HPCloud::Storage::ObjectStorage::StreamWrapper.
109  *
110  * @section intro_example_ident Basic Example: Identity Services
111  *
112  * Stream wrappers are nice and all, but
113  * some of us love fancy APIs. So here's an example using the full API
114  * to log in and then dump a list of services that are available to you:
115  *
116  * @code
117  * <?php
118  * // This is only required if you don't have a PSR-0
119  * // autoloader to do the hard work for you.
120  * require 'HPCloud/Bootstrap.php';
121  *
122  * // If you aren't using a PSR-0 autoloader,
123  * // you might want to use this:
124  * \HPCloud\Bootstrap::useAutoloader();
125  *
126  * use \HPCloud\Services\IdentityServices;
127  *
128  * // Create a new identity service object, and tell it where to
129  * // go to authenticate. This URL can be found in your HPCloud
130  * // console.
131  * $identity = new IdentityServices('http://get.url.from.hpcloud.com');
132  *
133  * // You can authenticate either with username/password (IdentityServices::authenticateAsUser())
134  * // or as an account/secret key (IdentityServices::authenticateAsAccount()). In either
135  * // case you can get the info you need from the console.
136  * $account = '123456789098765';
137  * $secret = 'dgasgasd';
138  * $tenantId = '56545654';
139  *
140  * // $token will be your authorization key when you connect to other
141  * // services. You can also get it from $identity->token().
142  * $token = $identity->authenticateAsAccount($account, $secret, $tenantId);
143  *
144  * // Get a listing of all of the services you currently have configured on
145  * // HPCloud.
146  * $catalog = $identity->serviceCatalog();
147  *
148  * var_dump($catalog);
149  *
150  * ?>
151  * @endcode
152  *
153  *-# Our classes use PHP namespaces to organize components. If you've never used
154  * them before, don't worry. They're easy to get the hang of.
155  *-# The Bootstrap class handles setting up HPCloud services. Read about it at HPCloud::Bootstrap.
156  *-# The IdentityServices class handles authenticating to HP, discovering services, and providing
157  * access to your account. HPCloud::Services::IdentityServices explains the details, but here are
158  * a few functions you'll want to know:
159  * - HPCloud::Services::IdentityServices::__construct() tells the object where to connect.
160  * - HPCloud::Services::IdentityServices::authenticateAsUser() lets you log
161  * in with username and password.
162  * - HPCloud::Services::IdentityServices::authenticateAsAccount() lets you log
163  * in with account number and secret key.
164  * - HPCloud::Services::IdentityServices::serviceCatalog() tells you about
165  * the services you have activated on this account.
166  *
167  * @section intro_example_swift Basic Example: Object Storage
168  *
169  * Assuming you have an object storage instance available in your service
170  * catalog, we could continue on with something like this:
171  *
172  * @code
173  * <?php
174  * // The explicit way:
175  * // Find out where our ObjectStorage instance lives:
176  * // $storageList = $identity->serviceCatalog('object-storage');
177  * // $objectStorageUrl = storageList[0]['endpoints'][0]['publicURL'];
178  *
179  * // Create a new ObjectStorage instance:
180  * // $objectStore = new \HPCloud\Storage\ObjectStorage($token, $objectStorageUrl);
181  *
182  * // Or let ObjectStorage figure out which instance to use:
183  * $objectStore = \HPCloud\Storage\ObjectStorage::newFromIdentity($identity);
184  *
185  * // List containers:
186  * print_r($objectStore->containers());
187  *
188  * // Get a container named 'stuff':
189  * $container = $objectStore->container('stuff');
190  *
191  * // List all of the objects in that container:
192  * print_r($container->objects());
193  *
194  * // Get an object named 'example.txt'
195  * $obj = $container->object('example.txt');
196  *
197  * // Print that object's contents:
198  * print $obj->content();
199  *
200  * // Actually, since it implements __tostring, we could do this:
201  * print $obj;
202  * ?>
203  * @endcode
204  *
205  * This shows you a few methods for accessing objects and containers on your
206  * HPCloud::Storage::ObjectStorage account. There are many functions for
207  * creating and modifying containers and objects, too.
208  *
209  *- HPCloud::Storage::ObjectStorage is where you will start.
210  *- Container services are in HPCloud::Storage::ObjectStorage::Container
211  *- There are two classes for objects:
212  * - HPCloud::Storage::ObjectStorage::Object is for creating new objects.
213  * - HPCloud::Storage::ObjectStorage::RemoteObject provides better network
214  * performance when reading objects.
215  *
216  */
217 // Note that Doxygen assumes that dot (.) is the namespace separator in
218 // package descriptions.
219 /**
220  * @package HPCloud
221  * The HPCloud PHP library.
222  */
223 /**
224  * @namespace HPCloud.Services
225  * HPCloud classes providing access to various services.
226  *
227  * HPCloud offers a number of services, including Compute (Nova),
228  * IdentityServices, and CDN.
229  *
230  * This package is reserved for classes that provide access to
231  * services.
232  */
233 /**
234  * @package HPCloud.Storage
235  * HPCloud classes for remote storage.
236  *
237  * Services for now and the future:
238  *
239  *- ObjectStorage
240  *- CDN caching of storage
241  *- Others coming.
242  *
243  */
244 /**
245  * @package HPCloud.Storage.ObjectStorage
246  * Classes specific to ObjectStorage.
247  *
248  * The main class is HPCloud::Storage::ObjectStorage.
249  */
250 /*
251  * @package HPCloud.Storage.CDN
252  * Classes specific to CDN.
253  */
254 /**
255  * @package HPCloud.Transport
256  * HTTP/REST/JSON classes.
257  *
258  * HTTP/HTTPS is the transport protocol for OpenStack's RESTful services.
259  *
260  * This library provides both CURL and PHP Streams-based HTTP support,
261  * and this package provides a simple REST client architecture, along
262  * with the minimal JSON processing necessary.
263  *
264  *
265  */
266 ?>