Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 25th, 2012  |  syntax: None  |  size: 0.58 KB  |  hits: 13  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <?php
  2.  
  3. /**
  4.  * First the project has a base 'lib' directory.
  5.  * If a package namespace is not found, just load the file from that directory.
  6.  * The great thing about this is that it does NOT issue I/O requests searching for files.
  7.  */
  8.  
  9. Package::add('Zend', '/var/lib/git/Zend/lib/');
  10. Package::add('Doctrine', '/user/path/Doctrine/src/');
  11.  
  12. spl_autoload_Register('Package::autoload');
  13.  
  14.  
  15. $a = new \Example\Class\A(); // Loads from ./lib/Example/Class/A.php
  16. $a = new \Zend\A();          // Loads from /var/lib/git/Zend/lib/A.php
  17. $a = new \Doctrine\A();      // Loads from /user/path/Doctrine/src/A.php