redreams / slim-annotation-based
Slim application with support annotation based controllers
Installs: 2 140
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: ^7.1|^7.2
- doctrine/annotations: ^1.6
- doctrine/cache: ^1.7
- redreams/class-finder: ^2.0
- slim/slim: ^3.10
Requires (Dev)
- phpunit/phpunit: ^7.2
This package is not auto-updated.
Last update: 2024-11-18 07:25:23 UTC
README
slim-annotation-based composer package
Install
Via Composer
$ composer require redreams/slim-annotation-based
Usage
use Redreams\Slim\App; //front controller (index.php) $config = [];//defaul slim config $config['settings']['routerCacheDir'] = './dirForDoctrineAnnotationReader';//optional $app = new App('./controllersDir', $config); // controllersDir/IndexController.php use Redreams\Slim\AbstractController; use Redreams\Slim\Annotation\Route; /** * @Route("/") */ class IndexController extends AbstractController { /** * @Route("/") * @param Request $request * @param Response $response * * @return Response */ public function indexAction(Request $request, Response $response): Response { return $response->write('index:index'); } /** * @Route("/test") * @param Request $request * @param Response $response * * @return Response */ public function testAction(Request $request, Response $response): Response { return $response->write('index:test'); } /** * @Route("/getonly", methods={"GET"}) * @param Request $request * @param Response $response * * @return Response */ public function getOnlyAction(Request $request, Response $response): Response { return $response->write('index:getOnly'); } /** * @Route("/named", name="namedAction") * @param Request $request * @param Response $response * * @return Response */ public function namedAction(Request $request, Response $response): Response { return $response->write('index:named'); } }
Change log
Please see CHANGELOG for more information on what has changed recently.
Testing
$ composer test
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email dev@gennadyx.tech instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.