Simple router and Twig parser.
- Define controller routes in
routes.json - Comes with one built-in controller,
ab\Front\Controller\TwigByUriwhich will parse twig by URI. - Controllers should expect
(ServerRequestInterface $request, array $routerArguments) - Controller's
__invoke()argument is called if no method is explicity defined inroutes.json(perLeague\Route). - When using
TwigByUri, drop templates intemplates/names{uriPath}.twig.html, andhome.twig.htmlfor/. - Else, define your own controller and optionally use
\ab\Front\TwigRenderer::loadAndRender()for twig parsing.
Could easily be adapted as an over-arching framework with other more proprietary frameworks living underneath, side-by-side. Or, could be used as a ridiculously simple framework/CMS. Less than 200 lines. Do one thing, and do it well.
dev-router.phpis a mess.- documentation via phpDoc.
- cleaner namespace names, better class names. these will probably change.
MIT license.
(C) Copyright A.B. Carroll [email protected]