News Feed
Jobs Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Rob Allen's Blog:
Using ZendLoaderAutoloader
February 13, 2012 @ 09:54:43

In a new post to his blog Rob Allen introduces you to the autoloader that comes with the Zend Framework 2 and shows how to use it to load your own classes.

Autoloading is the process in PHP whereby the system attempts to load a class when it is first encountered (via new or via class_exists) if it hasn't already been loaded via a require or include. Autoload works by looking for a method called __autoload or walking through any method registered with spl_autoload_register. Zend Framework 2 provides the ZendLoaderAutoloader component for autoloading of Zend Framework and your own classes.

The PSR-0-standard tool allows you to load files, set up class mapping and allows for multiple autoloading methods to work side-by-side. He shows how to use the standard autoloading functionality to define paths to locate files (with prefixes and namespaces) in both a constructor-based setup and a more programatic approach. He also shows how to use the ClassMapAutoloader to load from a mapping of class name to class file. Wrapping it up, he shows how to combine the two methods into a single ZendLoaderAutoloaderFactory instance.

0 comments voice your opinion now!
zendframework autoloader classmap standard tutorial


blog comments powered by Disqus

Similar Posts

PHPMaster.com: The Single Responsibility Principle

DevShed: Using the Memento Pattern with a File Reading Class

PHPMaster.com: Generating Invoices with Zend_Pdf

Ajaxray.com: Image manipulation in Zend Framework using PHP Thumbnailer Class v2.0

CodePoets.co.uk: How to use PHP and PEAR MDB2 (Tutorial)


Community Events











Don't see your event here?
Let us know!


hhvm performance composer hack code install language facebook introduction security podcast threedevsandamaybe symfony2 application framework package component database release unittest

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework