router
router copied to clipboard
A lightweight and simple object oriented PHP Router
i tried using HMVC design pattern. my idea is, creating Routes.php for each modules, and then include them in main `Routes.php` my project structure ``` src/ |-Config/Config.php |-Core/ | |-CoreFunctions.php...
I'm Using the Router and extending it in my own class in order to change some methods and update the router without loosing changes. The invoke() method is private and...
Support to catch reflection fail on controller method call from outside the Router. Fixed missing class Handler (due to failed test after adding support for the former catching). According to...
Nice project. Got some ideas for how to resolve this but continued with one similar to the one used before. Hope this helps.
This will allow us to have code like this: ```php $router->set404(function($handledByOtherMethod) { if ($handledByOtherMethod) { header('HTTP/1.1 405 Method Not Allowed'); } else { header('HTTP/1.1 404 Not Found'); } // ......
README was also updated slightly.
Aliasing global functions
Example: ``` $router->mount('/api/v1', function () use ($router) { $router->setNamespace('Source\Api\v1'); $router->mount('/test', function () use ($router) { $router->setNamespace('Source\Api\v1\Test'); }); }); ```
PSR-0 is deprecated per https://www.php-fig.org/psr/psr-0/ notably PSR-4 allows us to remove the entire Bramus folder and put the router in src/Router/Router.php while PSR-0 did not allow us to do that,...