PhpRiot
Download Article
Download this article or the entire “Zend Framework 101” series with all listings and files.




More information
Related Books
Zend Framework, A Beginner's Guide

Zend Framework, A Beginner's Guide

Essential Skills--Made Easy! Leverage the power of the Zend Framework to supercharge...

Zend Framework 1.8 Web Application Development

Zend Framework 1.8 Web Application Development

Design, develop, and deploy feature-rich PHP web applications with this MVC framework...
PhpRiot Newsletter
Your Email Address:

More information

Zend Framework 101: Zend_Loader

This article is part of the series “Zend Framework 101”. The Zend Framework 101 series covers many components that make up the Zend Framework in easy to understand articles.. Read more about Zend Framework 101...

Introduction

In this article I will introduce you to Zend_Loader, a Zend Framework class used to automatically load other classes. Typically you would use include_once() or require_once() when you want to load a class but using Zend_Loader you don't have to.

For class auto-loading to work (see http://php.net/autoload for full details), your classes must be named and filed in an orderly fashion. The Zend_Loader class requires all classes to be named in the same fashion as classes in the Zend Framework.

Zend_Loader treats a class name as a file system path, replacing any underscores with a slash and appending .php to the end. For example, the class name Zend_Loader would map to the file system path Zend/Loader.php.

Note: This is relative to your PHP include path, which can be defined with the include_path configuration directive.

This article requires PHP 5.2 or newer and Zend Framework. You can download the Zend Framework from http://framework.zend.com. At time of writing, the current version of Zend Framework is 1.7.6.

In This Article