Package Class
The Package class allows you to easily load, unload, check if a package is loaded, or get all packages loaded.
The load method allows you to load one or more packages at runtime. If the package cannot be found a PackageNotFoundException will be thrown.
Static |
Yes |
Parameters |
Param |
Default |
Description |
$package |
required |
Name of the package to be loaded, or an array of packages and package paths. |
$path |
PKGPATH |
Path to the folder in which the package is installed. |
|
Returns |
void |
Example |
Package::load('orm');
Package::load('parser', '/path/to/packages/dir/');
Package::load( array('First' => PKGPATH.'my'.DS.'first'.DS, 'Last' => PKGPATH.'my'.DS.'last'.DS) );
Package::load('awesome');
|
The unload method allows you to unload a package at runtime.
Static |
Yes |
Parameters |
Param |
Default |
Description |
$package |
required |
Name of the package to be unloaded. |
|
Returns |
void |
Example |
Package::unload('orm');
|
The loaded method allows you to check if a package is currently loaded. If no package name is given then all loaded packages are returned.
Static |
Yes |
Parameters |
Param |
Default |
Description |
$package |
null |
Name of the package to be checked. |
|
Returns |
bool|array |
Example |
$loaded = Package::loaded('orm');
$loaded = Package::loaded();
|