Getting started
Controllers
Databases
Command line
Packages
Learn more
Autoloading
The phpClassLoader class handles autoloading of classes in the Mako framework.
You'll normally not have to worry about class autoloading as this is done automatically by the framework. You can in some cases optimize class loading by running the following phpcomposer command:
composer dump-autoload -o
Usage
The phpmapClass method will add a class to the autoloader mappings.
ClassLoader::mapClass('FooBar', '/path/to/FooBar.php');
ClassLoader::mapClass('foo\FooBar', '/path/to/foo/FooBar.php');
The phpmapClasses method will add an array of classes to the autoloader mappings.
ClassLoader::mapClasses(array
(
'Foo' => '/path/to/Foo.php',
'Bar' => '/path/to/Bar.php',
));
The phpdirectory method will add an additional path from which the autoloader will try to load PSR-0 compatible classes.
ClassLoader::directory('/path/to/library');
The phpregisterNamespace method allows you to register a PSR-0 compatible namespace with the autoloader.
ClassLoader::registerNamespace('Zend\XmlRpc', MAKO_LIBRARIES_PATH . '/XmlRpc');
Class aliases
You can register class aliases in the phpapp/config/application.php config file. The key is the alias while the value is the actual class name.
'aliases' => array
(
'URL' => 'mako\URL',
'Assets' => 'mako\Assets',
),