martynbiz / slim-module
dev-master
2018-04-05 22:28 UTC
Requires
- php: >=5.3.0
Requires (Dev)
- phpunit/phpunit: 4.8.*
- slim/slim: ~3.0
This package is not auto-updated.
Last update: 2024-12-21 20:30:41 UTC
README
Introduction
Modules for Slim3
Installation
Composer
"require-dev": { "martynbiz/slim3-module": "dev-master" }
Simple Usage
This library expects a modules directory somewhere, and within that module directories:
modules/
├── hello
│ └── module.php
Each module file will contain code required for that module. More advanced setups may include sub-directories.
routes.php
$module = new \MartynBiz\Slim3Module\Module($app, [ 'modules_dir' => APPLICATION_PATH . '/modules', ]); $module->load('hello');
home/module.php
$app->get('/hello/{name}', function (Request $request, Response $response) { $name = $request->getAttribute('name'); $response->getBody()->write("Hello, $name"); return $response; });
Advanced Usage
...
Modules within modules
...