extends abstract class Phalcon\Di\Injectable
implements Phalcon\Events\EventsAwareInterface, Phalcon\Di\InjectionAwareInterface
This component helps to load your project classes automatically based on some conventions
<?php
//Creates the autoloader
$loader = new Phalcon\Loader();
//Register some namespaces
$loader->registerNamespaces(array(
'Example\Base' => 'vendor/example/base/',
'Example\Adapter' => 'vendor/example/adapter/',
'Example' => 'vendor/example/'
));
//register autoloader
$loader->register();
//Requiring this class will automatically include file vendor/example/adapter/Some.php
$adapter = Example\Adapter\Some();
public __construct ()
Phalcon\Loader constructor
public Phalcon\Loader setExtensions (array $extensions)
Sets an array of extensions that the loader must try in each attempt to locate the file
public boolean getExtensions ()
Return file extensions registered in the loader
public Phalcon\Loader registerNamespaces (array $namespaces, [boolean $merge])
Register namespaces and their related directories
public array getNamespaces ()
Return current namespaces registered in the autoloader
public Phalcon\Loader registerPrefixes (array $prefixes, [boolean $merge])
Register directories on which “not found” classes could be found
public getPrefixes ()
Return current prefixes registered in the autoloader
public Phalcon\Loader registerSufixes (array $sufixes, [boolean $merge])
Register directories on which “not found” classes could be found
public getSufixes ()
Return current prefixes registered in the autoloader
public Phalcon\Loader registerDirs (array $directories, [boolean $merge])
Register directories on which “not found” classes could be found
public getDirs ()
Return current directories registered in the autoloader
public Phalcon\Loader registerClasses (array $classes, [boolean $merge])
Register classes and their locations
public getClasses ()
Return the current class-map registered in the autoloader
public Phalcon\Loader register ()
Register the autoload method
public Phalcon\Loader unregister ()
Unregister the autoload method
public boolean findFile (string $className, array|string $directory, array $extensions, [string $ds])
Makes the work of autoload registered classes
public boolean autoLoad (string $className)
Makes the work of autoload registered classes
public string getFoundPath ()
Get the path when a class was found
public string getCheckedPath ()
Get the path the loader is checking for a path
public static Phalcon\Loader getDefault ()
Return the default loader
public setDI (Phalcon\DiInterface $dependencyInjector) inherited from Phalcon\Di\Injectable
Sets the dependency injector
public Phalcon\DiInterface getDI ([unknown $error], [unknown $notUseDefault]) inherited from Phalcon\Di\Injectable
Returns the internal dependency injector
public setEventsManager (Phalcon\Events\ManagerInterface $eventsManager) inherited from Phalcon\Di\Injectable
Sets the event manager
public Phalcon\Events\ManagerInterface getEventsManager () inherited from Phalcon\Di\Injectable
Returns the internal event manager
public boolean fireEvent (string $eventName, [mixed $data], [unknown $cancelable]) inherited from Phalcon\Di\Injectable
Fires an event, implicitly calls behaviors and listeners in the events manager are notified
public mixed fireEventCancel (string $eventName, [mixed $data], [unknown $cancelable]) inherited from Phalcon\Di\Injectable
Fires an event, can stop the event by returning to the false
public boolean hasService (string $name) inherited from Phalcon\Di\Injectable
Check whether the DI contains a service by a name
public Phalcon\Di\ServiceInterface setService (unknown $name) inherited from Phalcon\Di\Injectable
Sets a service from the DI
public object|null getService (unknown $name) inherited from Phalcon\Di\Injectable
Obtains a service from the DI
public mixed getResolveService (string $name, [array $args], [unknown $noerror], [unknown $noshared]) inherited from Phalcon\Di\Injectable
Resolves the service based on its configuration
public attachEvent (string $eventType, Closure $callback) inherited from Phalcon\Di\Injectable
Attach a listener to the events
public __get (unknown $property) inherited from Phalcon\Di\Injectable
Magic method __get
public __sleep () inherited from Phalcon\Di\Injectable
...
public __debugInfo () inherited from Phalcon\Di\Injectable
...