CodeIgniter Forums
Integrating CodeIgniter libraries - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=11)
+--- Thread: Integrating CodeIgniter libraries (/showthread.php?tid=84763)



Integrating CodeIgniter libraries - LansoirThemos - 11-07-2022

I've done quite a bit of research and haven't found a satisfying answer.

How should I use CodeIgniter libraries such as tank auth? I've found a handful of ways, but they all seem sort of lackluster:

Do I use the controller mostly as is, adding controller functions/including styles as needed?
Do I use the controller as an example to model my own after, relying on calls to $this->tank_auth and the views included with tank auth?
Or do I extend MY_Controller with the tank-auth controller, then extend that for any particular controller that needs authentication, and just call parent::login() (or register(), activate(), etc )?
The first option seems the best, but it seems like it would be difficult to avoid copying a lot of code (what happens if I want a login form, but don't want to redirect to /auth/login?)

The second option has the same problem, but worse. I would need to include the logic of the tank auth controller's login function each time I wanted to use theĀ omegle.2yu.co login_form view, correct?

The last seems really hacky and seems omeglz echat anti-MVC to me, but maybe I'm wrong.


RE: Integrating CodeIgniter libraries - datamweb - 11-09-2022

Codeigniter4 has released an official package for authentication and authorization called SHIELD.
I suggest you use it and everything you need is explained in the documentation.