The framework that I use (Zend) has an autoloader built it. I think this autoloader takes care of loading, not only Zend itself, but also any other libraries the developer may add to the project.
Is it normal practice for a framework to have an autoloader? Any that don't have?
Is it necessary to have an autoloader?
ZF's Autoloader will by default only load ZF's classes. It can (and is supposed to be) configured to also load your custom classes and you can also add additional Autoloader from other frameworks. ZF 2 will have a classmap autoloader in addition to the PSR-0 autoloader. See the Blog Post by ZF's Matthew Weier O'Phinney on Autoloading Benchmarks
Yes, it's common to have autoloaders because you dont want require statements all over your code. It's not strictly necessary though. The native way to achive autoloading is with spl_autoload_register.
Not it is not necessary, but it is very convenient. You don't need a hell of a lot of includes or requires, and units are only loaded when you need the class it contains. And that helps you stucture your code too, because incorrect naming will cause the autoloader to fail.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With