Here are the steps to get Neo4jPHP set up as a CodeIgniter 2 library:
- Copy the 'Everyman' folder to application/libraries
- Create a file called Everyman.php in application/libraries
- Copy the following code into Everyman.php:
<?php class Everyman { public function __construct() { spl_autoload_register(array($this,'autoload')); } public function autoload($sClass) { $sLibPath = __DIR__.DIRECTORY_SEPARATOR; $sClassFile = str_replace('\\',DIRECTORY_SEPARATOR,$sClass).'.php'; $sClassPath = $sLibPath.$sClassFile; if (file_exists($sClassPath)) { require($sClassPath); } } }
- Add the following line to application/config/autoload.php:
$autoload['libraries'] = array('everyman');
This is actually a generic autoloader that will attempt to autoload any namespaced class under application/library where the class name matches the file path.