Welcome Guest, Not a member yet? Register   Sign In
Integrating CodeIgniter libraries
#1

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 login_form view, correct?

The last seems really hacky and seems anti-MVC to me, but maybe I'm wrong.
Reply
#2

You did not mention what version of CodeIgniter you where running, but if your running CodeIgniter 4
I would recommend using the below Auth System

CodeIgniter 4 Shield
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply




Theme © iAndrew 2016 - Forum software by © MyBB