From 40a99acbbeba9f4aa3b2f09821c52443446aa8a2 Mon Sep 17 00:00:00 2001 From: Antoine Lamirault Date: Mon, 28 Apr 2025 12:10:49 +0200 Subject: [PATCH] Add PHP config support for routing --- configuration/micro_kernel_trait.rst | 10 ++++++++-- controller/error_pages.rst | 12 +++++++++--- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/configuration/micro_kernel_trait.rst b/configuration/micro_kernel_trait.rst index f919b1f7a74..c372d876651 100644 --- a/configuration/micro_kernel_trait.rst +++ b/configuration/micro_kernel_trait.rst @@ -297,8 +297,8 @@ Now it looks like this:: { // import the WebProfilerRoutes, only if the bundle is enabled if (isset($this->bundles['WebProfilerBundle'])) { - $routes->import('@WebProfilerBundle/Resources/config/routing/wdt.xml')->prefix('/_wdt'); - $routes->import('@WebProfilerBundle/Resources/config/routing/profiler.xml')->prefix('/_profiler'); + $routes->import('@WebProfilerBundle/Resources/config/routing/wdt.php', 'php')->prefix('/_wdt'); + $routes->import('@WebProfilerBundle/Resources/config/routing/profiler.php', 'php')->prefix('/_profiler'); } // load the routes defined as PHP attributes @@ -310,6 +310,12 @@ Now it looks like this:: // to override the default locations for these directories } + +.. versionadded:: 7.3 + + The ``wdt.php`` and ``profiler.php`` files were introduced in Symfony 7.3. + Previously, you had to import ``wdt.xml`` and ``profiler.xml`` + Before continuing, run this command to add support for the new dependencies: .. code-block:: terminal diff --git a/controller/error_pages.rst b/controller/error_pages.rst index 96856764ece..06087837437 100644 --- a/controller/error_pages.rst +++ b/controller/error_pages.rst @@ -154,7 +154,8 @@ automatically when installing ``symfony/framework-bundle``): # config/routes/framework.yaml when@dev: _errors: - resource: '@FrameworkBundle/Resources/config/routing/errors.xml' + resource: '@FrameworkBundle/Resources/config/routing/errors.php' + type: php prefix: /_error .. code-block:: xml @@ -167,7 +168,7 @@ automatically when installing ``symfony/framework-bundle``): https://symfony.com/schema/routing/routing-1.0.xsd"> - + @@ -178,7 +179,7 @@ automatically when installing ``symfony/framework-bundle``): return function (RoutingConfigurator $routes): void { if ('dev' === $routes->env()) { - $routes->import('@FrameworkBundle/Resources/config/routing/errors.xml') + $routes->import('@FrameworkBundle/Resources/config/routing/errors.php', 'php') ->prefix('/_error') ; } @@ -191,6 +192,11 @@ need to replace ``http://localhost/`` by the host used in your local setup): * ``http://localhost/_error/{statusCode}`` for HTML * ``http://localhost/_error/{statusCode}.{format}`` for any other format +.. versionadded:: 7.3 + + The ``errors.php`` file was introduced in Symfony 7.3. + Previously, you had to import ``errors.xml`` + .. _overriding-non-html-error-output: Overriding Error output for non-HTML formats