php-mvc
php-mvc copied to clipboard
Created generic handler for routes with one or more parameters
Created a generic handler for one or more parameters to avoid need to create each method a route in the application. Need to check for security (special characters).
Thank you for the pull request @WKnak - I'll look into it. At the moment though I'm working on a major update that will change the way the framework works, so I'll take a look at your code but I don't want to update this version of the framework at the moment. Thanks!
Ooooo I look forward to this major update. Any idea when it's gonna be available/if it is available somewhere else to see? Thanks :)
@jackttcoms sorry no idea at the moment when it'll be available (current situation affecting things a bit!) - as soon as I can though!
can't we add a generic route like this?
# /public/index.php
- - - - - - - - - -
/**
* Routing
*/
$router = new Core\Router();
// ...
// generic route -> "example.com/item" routes to "App\Item\indexAction"
$router->add('{controller}', ['action' => 'index']);
// ...
$router->dispatch($_SERVER['QUERY_STRING']);
Passing through arguments to the controller functions like this is a nice idea though. Twig escapes them when it echos them into/onto your page so I don't see a problem there