Thoughts about code and other things that interest me
Auto loading php classes take two

My previous post describing auto loading classes in php, is getting a bit out-dated. Since then, some folks have gotten together to help standardize class loading resulting in PSR-0. Here is their sample implementation:

It works quite well and can work with the old-style psuedo namespaces too. Here is an example of how to use it:

If you are still using php’s __autoload function or some other method of autoloading classes, I highly recommend switching to a PSR-0 compliant autoloader.

blog comments powered by Disqus