Nested Multi-Module app with Phalcon PHP framework?
module, phalcon, php
Solution
yes you can. the first solution what i can think of is this:
while registering your loader in index.php:
$loader = new \Phalcon\Loader();
$loader->registerDirs(array(
$config->application->controllersDir,
$config->application->pluginsDir,
));
$loader->registerPrefixes(
array(
"Model_" => $config->application->modelsDir,
)
);
$loader->registerNamespaces(array(
'RemoteApi' => $config->application->librariesDir . 'RemoteApi/'
));
$loader->register();
notice registerPrefixes. you can register different prefix for different models like:
$loader->registerPrefixes(
array(
"FModel_" => $config->application->forumModels,
"NModel_" => $config->application->newsModels,
)
);
you can register prefixes to other things too. I also added this example
$loader->registerNamespaces(array(
'RemoteApi' => $config->application->librariesDir . 'RemoteApi/'
));
this way you can order your stuff under different namespace's.
Problem
I know the multi module application structure of Phalcon, but is it possible to have a nested module structure like following example shows? I want to have a system, where I can hot-plug new sub-modules (for backend, frontend) to the system. Routes, menu entries etc. should get automatically extended when I copy a new module folder into the sub-module folder. ``` module-backend controllers models etc. sub-modules forum controllers models etc. news controllers models etc. users controllers models etc. module-frontend controllers models sub-modules like backend module structure ``` Is there a way with events to hot-plug such modules to the system?