Skip to main content

lib-instance

The "lib" class instance is the object which is accessible from any part of the application, as $this->lib. It is the loader of all class libraries.

Lib instance image

More than 30 existing libraries. And you can create your or install a new one with composer.

Examples of library usage

Get the "Username" value from $_POST Global array.

$username = $this->lib->filter->post('username');

Call the method 'some_method()' of addon 'test' using the 'addons' class library.

$result = $this->lib->addons->test->some_method();

Get user browser information using the 'client' library.

if($this->lib->client->is_browser()) {
$browser = $this->lib->client->browser();
$browser_version = $this->lib->client->browser_version();
} else {
/* ... */
}

Get a new instance of the 'ini' class library.

$ini_obj = $this->lib->ini->instance('/tmp/test.ini');
$ini_obj->section_set('SOME_SECTION');
$ini_obj->item_set('some_item', 'Some value', 'SOME_SECTION');
$ini_obj->file_save();