How can I create a route like /something/* where * could be one or mode 'subfolders'? (Using Silex framework)
For example:
/something/foo
or
/something/foo/bar
The purpose: I need to replicate a Webservice and send a POST request to another URL changing 2 $_POST parameters and give it returns back. But it can have one or mode parameters after /something.
The trick is to overwrite the default regex for a url parameter, that doesn't match /
:
$app->post("/something/{the_rest})", function () {
// do stuff
})->assert("the_rest", ".*");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With