Phalcon autoload
NOTE
All classes are prefixed with Phalcon
Autoload\Exception¶
-
Namespace
Phalcon\Autoload
-
Uses
-
Extends
\Exception
-
Implements
Exceptions thrown in Phalcon\Autoload will use this class
Autoload\Loader¶
-
Namespace
Phalcon\Autoload
-
Uses
Phalcon\Events\AbstractEventsAware
-
Extends
AbstractEventsAware
-
Implements
The Phalcon Autoloader provides an easy way to automatically load classes (namespaced or not) as well as files. It also features extension loading, allowing the user to autoload files with different extensions than .php.
Properties¶
/**
* @var string|null
*/
protected $checkedPath;
/**
* @var array
*/
protected $classes;
/**
* @var array
*/
protected $debug;
/**
* @var array
*/
protected $directories;
/**
* @var array
*/
protected $extensions;
/**
* @var string|callable
*/
protected $fileCheckingCallback = is_file;
/**
* @var array
*/
protected $files;
/**
* @var string|null
*/
protected $foundPath;
/**
* @var bool
*/
protected $isDebug = false;
/**
* @var bool
*/
protected $isRegistered = false;
/**
* @var array
*/
protected $namespaces;
Methods¶
Loader constructor. Adds a class to the internal collection for the mapping Adds a directory for the loaded files Adds an extension for the loaded files Adds a file to be added to the loader Autoloads the registered classes Get the path the loader is checking for a path Returns the class-map currently registered in the autoloader Returns debug information collected Returns the directories currently registered in the autoloader Returns the file extensions registered in the loader Returns the files currently registered in the autoloader Get the path when a class was found Returns the namespaces currently registered in the autoloader returns isRegister Checks if a file exists and then adds the file by doing virtual require Register the autoload method Register classes and their locations Register directories in which "not found" classes could be found Sets an array of file extensions that the loader must try in each attempt to locate the file Sets the file check callback.// Default behavior.
$loader->setFileCheckingCallback("is_file");
// Faster than `is_file()`, but implies some issues if
// the file is removed from the filesystem.
$loader->setFileCheckingCallback("stream_resolve_include_path");
// Do not check file existence.
$loader->setFileCheckingCallback(null);