php8.5
Home/ Manual/ yaf / yaf_loader/ Yaf_Loader::setLibraryPath

Yaf_Loader::setLibraryPath

PHP function Edit on GitHub ✎

(Yaf >=2.1.4)

Change the library path

Description

Yaf_Loader::setLibraryPath(string $library_path, bool $is_global = false): Yaf_Loader

Change the library directory.

Parameters

library_path

The new library directory.

is_global

Whether to change the global library directory instead of the local one.

Return Values

Returns the loader instance itself.

Examples

Yaf_Loader::setLibraryPath example

php
<?php
$app    = new Yaf_Application(__DIR__ . "/conf/application.ini");
$loader = Yaf_Loader::getInstance();

/* change the local library directory */
$loader->setLibraryPath("/var/www/shop/application/library");

/* change the global library directory */
$loader->setLibraryPath("/usr/local/share/yaf/library", true);

echo $loader->getLibraryPath(), PHP_EOL;
echo $loader->getLibraryPath(true), PHP_EOL;
?>

The above example will output something similar to:

output
/var/www/shop/application/library
/usr/local/share/yaf/library

See Also

  • Yaf_Loader::getLibraryPath

Source: reference/yaf/yaf_loader/setlibrarypath.xml · from the official PHP manual (php/doc-en)