CodeIgniter Forums

Full Version: CodeIgniter4 AutoLoad Library & Access Across App
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi Everyone

So i tried a few things i am not able to achieve what i exactly want so let me created this post, let me explain.

So basically i created a Custom Library Pagination (app\Libraries\Pagination\Pagination.php) 

Code:
<?php namespace App\Libraries\Pagination;
class Pagination{


To use this in my controller i did the following 

Code:
use \App\Libraries\Pagination\Pagination;
$pagination = new Pagination();


And it works.

but my problem is if i want to access this class in My Model i need to initialize this again or pass this class to the method.

i would like to know if it would be possible to maybe load this library in Autoload and make it accessible across application. without initializing it again?