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

Multi module application in 3.x

I've got multi module app. In main index.php, i set route from my ini file:

[index]
pattern         = '/'
module          = front
controller      = index

[allmodules]
pattern         = '/{module:moderator|admin}(.*)'
module          = 1

Next is registring modules, where each module have own Module.php where I've got reading of ini file with routing definitions for module. In phalcon 1.x and 2.x that solution worked, but in 3.x not.

Have you got some idea how make multi module app in 3.x with structure like? :

public/index.php
config/routing.ini
modules/admin/Module.php
modules/admin/config/routing.ini
modules/front/Module.php
modules/front/config/routing.ini

Thanks :)

I have multi module application in 3.0.x. No problems here. What's your problem ?

@Wojciech - have you got routing in one file or load sepearate routing file for each module?

Seperate routing per each module. But im using routing class. How exactly you are loading this routes ?



4.1k
Accepted
answer
edited Oct '16

Well, problem solved. It was problem with \Phalcon\Config\Adapter\Ini. I'm loading my ini files with that class and in 3.x pattern need be defined without apostrophes. So for 1.x and 2.x we have:

pattern  = '/{module:moderator|admin}'

and for 3.x:

pattern  = /{module:moderator|admin}