Class Naming Conventions and the Autoloader

The way classes are named in Magento was taken from the Zend Framework, upon which Magento was developed.

Class names are standardized depending on their location on the file system. This standardization enables automatic class loading. The Magento autoloader is built in /app/Mage.php. Because class names are directly related to a specific path in the file system, the autoloader allows developers to include them without using include_once or require_once. A class named Mage_Page_Helper_Data, for example, would be found at /app/code/core/Mage/Page/Helper/Data.php

Leave a Reply

Your email address will not be published. Required fields are marked *