-
Notifications
You must be signed in to change notification settings - Fork 0
06_learn_more__00_autoloading
The ClassLoader 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 composer command:
composer dump-autoload -o
The mapClass 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 mapClasses 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 directory method will add an additional path from which the autoloader will try to load PSR-0 compatible classes.
ClassLoader::directory('/path/to/library');
The registerNamespace method allows you to register a PSR-0 compatible namespace with the autoloader.
ClassLoader::registerNamespace('Zend\XmlRpc', MAKO_LIBRARIES_PATH . '/XmlRpc');
You can register class aliases in the app/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',
),
- Getting started: Installation
- Getting started: Configuration
- Getting started: Error handling
- Getting started: Constants
- Getting started: Coding standards
- Controllers: Controllers
- Controllers: Request
- Controllers: Response
- Databases: Basics
- Databases: Query builder
- Databases: Orm
- Databases: Migrations
- Command line: Basics
- Command line: Custom tasks
- Packages: Basics
- Packages: Composer packages
- Learn more: Array helper
- Learn more: Asset manager
- Learn more: Autoloading
- Learn more: Caching
- Learn more: Cookies
- Learn more: Events
- Learn more: File helper
- Learn more: Html helper
- Learn more: Internationalization
- Learn more: Logging
- Learn more: Number helper
- Learn more: Pagination
- Learn more: Redis client
- Learn more: Rest client
- Learn more: Security helpers
- Learn more: Sessions
- Learn more: String helper
- Learn more: Url helper
- Learn more: Uuid helper
- Learn more: Validation
- Learn more: Views