March 28, 2019 Javier Eguiluz

The Routing component maps HTTP requests to PHP code using some configuration options defined for each of the application routes. In Symfony 4.3 we made some improvements to configure some of those options more easily.

First, we've exposed the Unicode routing support (added back in Symfony 3.2) via a new utf8 option, so you don't have to configure it through the generic options metadata. The following example shows the difference when using each of the supported formats to configure routes:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 // PHP Annotations /** - * @Route("/category/{name}", name="category", options={"utf8": true}) + * @Route("/category/{name}", name="category", utf8=true) */ public function category() // YAML category: path: /category/{name} controller: App\Controller\DefaultController::category - options: - utf8: true + utf8: true // XML - <route id="category" path="/category/{name}" - controller="App\Controller\DefaultController::category"> - <option key="utf8">true</option> - </route> + <route id="category" path="/category/{name}" + controller="App\Controller\DefaultController::category" + utf8="true" />

In addition, we've added two new route options called locale and format to configure the default value of the special routing parameters _locale and _format :