The CI library does not have access to the controller resources by default unless the CI $ci = &get_instance()
is called and $ci
is used instead of $this
to access the CI resources, for example, instead of $this->db->query ($sql)
, we shall use $ci->db->query ($sql)
, and so on. We can extend the CI library using the third-party libraries from where CI echo system (the CI community of developers worldwide share knowledge, sources, and solutions for code and open issues), or develop our own libraries from scratch or extending other libraries.
Any application library will be located under application/libraries/
in the project's directory. In addition, optional resources such as the library configuration file that is required for library configurations can be placed under the project root or elsewhere. A good practice is to place them under the project root for enhanced security provided by CI. For example, <PROJECT_ROOT>application/config...