Modules
Instead of generic "controllers", "models", and "views" folders at the root level, Alloy organizes all related controllers, models, and views into a single named folder called a module.
To handle web requests and nested sub-requests, the module folder must contain a "Controller.php" file. The module folder can additionally contain any number of files, classes, or submodules as many levels deep as required to achieve the desired functionality.
The "Module" namespace acts like a library mapped to the "app/Module" directory, and any files contained within can be instantiated and autoloaded automatically with no additional configuration.
An example directory structure might look like:
- alloy/
- app/
- config/
- app.php
- routes.php
- layouts/
- lib/
- Module/
- Blog/
- Controller.php
- Entity.php
- views/
- Events/
- Controller.php
- Entity.php
- views/
- User/
- Controller.php
- Entity.php
- Session/
- Controller.php
- Entity.php
- views/
- views/
- Blog/
- Plugin/
- www/
- config/