Orient follows the autoloading standard introduced in PHP 5.3, the PSR-0, so it’s pretty easy to integrate in PSR-0-compliant projects ( Symfony2, Zend Framework 2, PEAR libraries ).
You only need to download the latest stable version of the library and setup the autoloader as the three following steps explain.
This is the main part of the autoloading process, because all the classes used by Orient lie under the Congow\Orient namespace:
$classLoader = new SplClassLoader('Congow\Orient', __DIR__ . "/path/to/src");
$classLoader->register();
This is needed in order to implement lazy loading:
$classLoader = new SplClassLoader('Congow\Orient\Proxy', __DIR__ . "/path/to/proxies");
$classLoader->register();
Doctrine is used in order to map POPOs through annotations and to have a nice interface for the Manager ( interface ObjectManager ) and the Repository ( ObjectRepository ):
$classLoader = new SplClassLoader('Doctrine\Common', '.../Doctrine/Common/lib/');
$classLoader->register();
Once you have done this three steps just make sure you create the proper directory structure for proxies:
mkdir -p /path/to/proxies/Congow/Orient/Proxy
be sure that the proxy directory is writeable by apache or whatever process using Orient.
Now you only need to import Orient’s namespace in your own codebase and you will be able to use any class of the library:
use Congow\Orient;
For example:
$query = new Orient\Query();