mirror of
https://github.com/symfony/symfony-docs.git
synced 2026-03-24 00:32:14 +01:00
Add PHP config support for routing
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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">
|
||||
|
||||
<when env="dev">
|
||||
<import resource="@FrameworkBundle/Resources/config/routing/errors.xml" prefix="/_error"/>
|
||||
<import resource="@FrameworkBundle/Resources/config/routing/errors.php" type="php" prefix="/_error"/>
|
||||
</when>
|
||||
</routes>
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user