Yaf_Loader::getInstance
Retrieve the Yaf_Loader instance
Description
public static Yaf_Loaderfalse Yaf_Loader::getInstance(string $local_library_path = null, string $global_library_path = null)
Retrieve the singleton Yaf_Loader instance.
If the library paths are given, they are applied to the existing instance.
Parameters
-
local_library_path
-
The local library directory, usually the same as the
application.library.directory ini setting.
-
global_library_path
-
The global library directory. If not given, the local one is used.
Return Values
The Yaf_Loader instance, or false if the loader has not been initialized (which is normally done by Yaf_Application).
Examples
Example #1 Yaf_Loader::getInstance example
<?php
$app = new Yaf_Application(__DIR__ . "/conf/application.ini");
/* Yaf_Application has initialized the loader, so the
* singleton instance is available now */
$loader = Yaf_Loader::getInstance();
$loader->registerNamespace("Vendor", APPLICATION_PATH . "/library/Vendor");
?>
Example #2 Yaf_Loader::getInstance before initialization
<?php
/* no Yaf_Application has been created yet */
var_dump(Yaf_Loader::getInstance());
?>
The above example will output
something similar to:
See Also
- Yaf_Loader::setLibraryPath
- Yaf_Loader::getLibraryPath