Autoloading with Panda_Loader_Singleton
I just committed a nifty update to the Panda_Loader package: Panda_Loader_Singleton. Essentially, this update just wraps the existing loader with a singleton; but don’t be fooled by the simplicity: this makes for a wicked-simple autoloading mechanism.
Implementing this component in your code is useful only when one style of code organization is used — fortunately, this is the case for most projects. The autoloader simply wraps the existing load() method — but calls it from an instance returned from a static singleton() call.
When bootstrapping your project, simply register the autoload() method and you never have to worry about including dependencies again.
spl_autoload_register(array('Panda_Loader_Singleton', 'autoload'));
Check it out yourself: http://code.google.com/p/panda-php/source/browse/trunk/Panda/Loader/Singleton.php
Tags: Panda_Loader, spl, spl_autoload