icosillion / slim-controllers
This package is abandoned and no longer maintained.
No replacement package was suggested.
A drop-in controller framework for Slim 4
v1.1.0
2020-05-03 10:46 UTC
Requires
- php: >=7.4
- slim/slim: ^4.0
This package is not auto-updated.
Last update: 2020-05-03 11:44:25 UTC
README
Slim Controllers is an extremely lightweight framework to provide controllers for Slim 4.
Installation
composer require icosillion/slim-controllers
Usage
Use Slim's groups to group your controller actions together in your main Slim file.
<?php use Slim\App; $app = new App(); $app->group('/', function () use ($app) { $controller = new RootController($app); $app->get('', $controller('index')); }); $app->run();
Extend your controller from the Controller
class.
<?php use Icosillion\SlimControllers\Controller; use Slim\Http\Request; use Slim\Http\Response; class RootController extends Controller { public function index(Request $request, Response $response, array $args) { $response->getBody()->write('Hello World!'); return $response; } }
License
This project is licensed under the MIT license. A copy of this is available in the LICENSE file.