We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

How to set up a multi sub modules ?

Hi I m very new to Phalcon, I have a project which I was asked to do in phalcon. I have gone through tutorials and its very fun to work with Phalcon.

I am taking THIS example as a base of my project. But however my project structure is little different. Here it is

    apps
            backend
                    module1
                            controllers
                            models
                            views
                    module2
                            controllers
                            models
                            views

                    and so on.....

            frontend 
                    module1
                            controllers
                            models
                            views

                    module2
                            controllers
                            models
                            views

                    and so on..

    public
            css
            js

As I am beginner in phalcon, i m not being able to set up the things. How to set up the the things like routing, registering namespaces, etc. for the structure like I have?

Thanks

You really dont need that, use only modules for differentiate backend / frontend. Then use just create controllers etc...

Check this out, may help you!

https://github.com/nasrulhazim/phalcon-multi-module-skeleton

Thanks for the reply The reason I want my structure is because

  1. If modules goes on increasing, I have to create Modules.php for each modules. Isn't it possible to create single dynamic module.php for all modules?

  2. There will be many customers to whom the application will be sold. And each of them would have same or different modules enabled. For example Customer A, has paid to get the module "Module 12", but for customer B, he hasn't paid enough to get "Module 12". So before delivering app to Customer B, I can safely delete module 12 folder( without messing any code).

You really dont need that, use only modules for differentiate backend / frontend. Then use just create controllers etc...

Check this out, may help you!

https://github.com/nasrulhazim/phalcon-multi-module-skeleton



16.3k

Hello,

I want to do the same thing, keen to know how to do it cleanly. I had asked a similar query earlier - got some basic input. See if that helps: https://forum.phalcon.io/discussion/2350/creating-a-multi-module-application

Amal

edited May '15

The link provided in your post is very similar to this one https://github.com/phalcon/mvc/tree/master/multiple.

which is not exactly what I want

Hello,

I want to do the same thing, keen to know how to do it cleanly. I had asked a similar query earlier - got some basic input. See if that helps: https://forum.phalcon.io/discussion/2350/creating-a-multi-module-application

Amal