Akelos Modules allow you to group, multiple controllers into an organized manner. So instead of having all your controllers in one single place you can break them into different places.
In order to tell Akelos which modules are available, you need to add a rule to map requests to the new module so it can be dispatched by the specific controller.
Lets say you want to group all your administration controllers and views into an admin module.
You'll need to edit your config/routes.php file to make your application aware of this new module by adding
$Map->connect('/admin/:controller/:action/:id', array('controller' => 'dashboard', 'action' => 'index', 'module' => 'admin'));
before other routes.
Now you can place the dashboard controller at app/controllers/admin/dashboard_controller.php declaring the controller with a new convention. Prefix the controller name with the ModuleName + “_”“
class Admin_DashboardController extends AdminController { //... }
you can either extend from the base ApplicationController or from a module specific controller like we did on the code above. Akelos will look for a controller named after your module in this case at app/controllers/admin_controller.php and if exists it will be loaded so your Admin_DashboardController can extend from it
class AdminController extends ApplicationController { }
Akelos will look for views at be at /app/views/admin/controller_name, and for helpers at /app/helpers/admin/
If you want to have a module specific layout Akelos will set by default app/views/layouts/admin.tpl for you.
Installers can also be scoped to modules. In this case we could have several installers/migrations at app/installers/admin/*_installer.php. The only requirement right now is that you tell the installer which module it belongs to like
app/installers/admin/user_installer.php
class UserInstaller extends AkInstaller { var $module = 'admin'; // *** }
The controller generator supports generating modular controllers doing like this:
./script/generate controller Admin::Users