spl-autoloader

SPL Autoloading best practices

In my include_path on the server-side I have a reference to a pear directory, in '/usr/share/pear/'. Within my applications I include files from a common library, living in '/usr/share/pear/library/' with require_once 'library/file.php'. I've recently started using the spl autoloader, I noticed in the loader function you have to determ...

PHP spl_autoload

i dont really get the docs for spl_autoload bool spl_autoload_register ([ callback $autoload_function ] ) from my understanding, it will try to run functions registered when php comes across a class not loaded already. so example, public function autoload() { require ('nonLoadedClass.php'); } spl_autoload_register(autoload); $...

Using spl_autoload() not able to load class

I'm playing around with the SPL autoload functionality and seem to be missing something important as I am currently unable to get it to work. Here is the snippet I am currently using: // ROOT_DIRECTORY translates to /home/someuser/public_html/subdomains/test define('ROOT_DIRECTORY', realpath(dirname(__FILE__))); define('INCLUDE_DIRECTOR...