Initially reading the documentation
it appears not to support optional URL parameters Optional URL parameters are now included in the routing docs. But digging into the Fast Route docs it turns out there is some support:
parts of the route enclosed in [...] are considered optional, so that
/foo[bar]will match both
/foobar. Optional parts are only supported in a trailing position, not in the middle of a route.
So you can do something like
It also turns out that Lumen doesn’t strip trailing slashes when parsing URLs so the optional parameters were a useful workaround. I have a few routes like
$app->get('/config[/]', '[email protected]');