Welcome Guest, Not a member yet? Register   Sign In
CodeIgniter4 AutoLoad Library & Access Across App
#1

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?
Reply




Theme © iAndrew 2016 - Forum software by © MyBB