Working with libraries

The library instance and usage

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

Examples of library usage

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

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

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

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

Output data to CLI using 'cli' library.


Get user browser information using '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 '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();