optional parameters in routes defined through annotations optional parameters in routes defined through annotations symfony symfony

optional parameters in routes defined through annotations


Symfony has a page on @Route:

E.g maybe you can try.

/** * @Route("/{id}/{lang}/{file}", requirements={"id" = "\d+"}, defaults={"file" = null}) */public function showAction($id, $lang, $file){}

If null doesn't work try an empty string.