Closed geggleto closed 8 years ago
What is the scope of a Module? Your example
//If Applicable
$slimModuleManager->addModuleRoutes($app, $authModule);
implies that a Module would handle the rendering of pages as well? How would that work?
If you want your site to be rendered using PHP-View, but your Auth Module rendered pages using Twig-View, that seems kind of silly and ludicrous.
There is also the problem of consistency in the styling of the page, since Slim is a framework and doesn't have an existing CSS class selection to abide by, Modules could implement anything, and require CSS which conflicts with your actual sites CSS.
While it sounds like a nice idea, imo it seems kind of out of scope of what a Micro Framework should offer? At Least for your example.
There was talk on slack this morning about adding some sort of Module support for Slim, allowing our users to share chunks of functionality.
Please feel free to comment on the API and the idea itself.
SlimModuleManager
How to use:
Manager Class
Module Config
Usage
What is a module
A module would be itself a self-contained Slim Application or part of it. A module is a set of objects that get loaded into the Slim Application Container, or a set of actions that add to the Slim Application.
How to install a module
You will then need to setup Composer to autoload these packages. Adding a psr-4 autoload directive for each module you include.
Slim Module
File Structure
src/ | app/ | module/
<== Target the PSR-4 namespace