CodeIgniter Forums
I can i declare Thirdparty Library globally - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: I can i declare Thirdparty Library globally (/showthread.php?tid=75670)



I can i declare Thirdparty Library globally - samyam - 03-03-2020

I can i declare Library globally

 $this->ionAuth    = new \IonAuth\Libraries\IonAuth();
i want to access $this->ionAuth from anywhere. So how can i declare this globally so that i can access $this->ionAuth form Models, View , and Controller


RE: I can i declare Thirdparty Library globally - InsiteFX - 03-03-2020

This would be a good idea to use a service.

CodeIgniter 4 User Guide - Services


RE: I can i declare Thirdparty Library globally - samyam - 03-04-2020

Solved using service and helper Smile


RE: I can i declare Thirdparty Library globally - samyam - 03-08-2020

(03-04-2020, 02:40 AM)samyam Wrote: Solved using service and helper Smile
you are right but i dind like the way declearing
auth() as function