(Yaf >=1.0.0)
Yaf_Loader::autoload — Autoload a class
Load a class by its name. The class name is converted to a file path: underscores and namespace separators become directory separators.
MVC classes (classes whose names contain _Controller, _Action or _Plugin) are looked up under the application directory, while other classes are looked up in the library directories: the local library for locally registered class prefixes, otherwise the global library.
class_nameThe class name to load.
Example #1 Yaf_Loader::autoload() example
<?php
/*
* autoload() is normally invoked implicitly by the engine
* whenever an undefined class is referenced, but it can also
* be called explicitly to force loading of a class file.
*/
$loader = Yaf_Loader::getInstance("/var/www/shop/application/library");
/* looks up /var/www/shop/application/library/Catalog/PriceService.php */
$loader->autoload("Catalog_PriceService");
/* MVC classes are looked up under the application directory */
$loader->autoload("ProductController");
?>