Magento Certified Developer GuideCategory: 1. BasicsExplain class naming conventions and their relationship with the autoloader
Manish Prakash Staff asked 5 years ago

Magento auto loader is the class Varien_Autoload
This class defines the php function spl_autoload_register() which is used to dynamically require classes.
When php system encounters any class which it not able to resolve, it looks at spl_autoload_register if it can resolve it.

Below is a gist of autoload function

$classFile = str_replace(' ', DIRECTORY_SEPARATOR, ucwords(str_replace('_', ' ', $class)));
$classFile.= '.php';
return include $classFile;

so basically magento explodes class names by “_” and replaces it will “DIRECTORY_SEPARATOR” and the finally includes the files.