webCOMAND

loader::add_package_path()

Add a new path to search when looking for packages.  The package path's added last will be searched first.

Prototype

void add_package_path(mixed $new_paths = [])

Parameters

  • new_paths - A string with a single path or an array of strings for multiple paths.  Paths can be absolute or relative to the folder where the initial PHP script was loaded.

Example

require_once('path/to/comand.php');

\io_comand\loader::add_package_path('path/to/packages');

// Look for a class named library in a package named com_example and
// call the static method test().  The path/to/packages will be
// searched first, followed by all preexisting package paths.
\com_example\library::test();