
Untitled
By: a guest on
Jun 25th, 2012 | syntax:
None | size: 0.58 KB | hits: 13 | expires: Never
<?php
/**
* First the project has a base 'lib' directory.
* If a package namespace is not found, just load the file from that directory.
* The great thing about this is that it does NOT issue I/O requests searching for files.
*/
Package::add('Zend', '/var/lib/git/Zend/lib/');
Package::add('Doctrine', '/user/path/Doctrine/src/');
spl_autoload_Register('Package::autoload');
$a = new \Example\Class\A(); // Loads from ./lib/Example/Class/A.php
$a = new \Zend\A(); // Loads from /var/lib/git/Zend/lib/A.php
$a = new \Doctrine\A(); // Loads from /user/path/Doctrine/src/A.php