Welcome Guest, Not a member yet? Register   Sign In
Can libraries have models and controllers?

Hello guys!

Let's say you have a library called auth, this sits in:
PHP Code:

Now, this is the library class which you can obviously load by doing: (which works perfectly)
PHP Code:

Now, can I have some folders in this library:
PHP Code:

With these folders Is it possible to load a model that is inside the models directory? I just want to keep my files together without having to put all my models in the models folder. As I would like to keep them within the library.

This way inside auth.php maybe I could do:
PHP Code:

which is located in:
PHP Code:

I'm hoping there is a way to do this, let me know thanks


As far as I know there is no way of accomplishing what you want. You will have to put your controllers and models in the regular folder.

Doing that is very common for libraries, an example is Ion Auth that include a model, controller and more.

If you didn't want controllers like that, you could use packages.

Specifically what you ask for sounds like "modules" or HMVC, and there are a number of thread on those topics here.

Theme © iAndrew 2016 - Forum software by © MyBB