diff --git a/best_practices.rst b/best_practices.rst index 7ca5590036a..0850d8b2e87 100644 --- a/best_practices.rst +++ b/best_practices.rst @@ -201,7 +201,7 @@ most services will be configured automatically. However, in some edge cases you'll need to configure services (or parts of them) manually. YAML is the format recommended configuring services because it's friendly to -newcomers and concise, but Symfony also supports XML and PHP configuration. +newcomers and concise, but Symfony also supports PHP configuration. Use Attributes to Define the Doctrine Entity Mapping ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -238,7 +238,7 @@ Use Attributes to Configure Routing, Caching, and Security Using attributes for routing, caching, and security simplifies configuration. You don't need to browse several files created with different -formats (YAML, XML, PHP): all the configuration is just where you require it, +formats (YAML, PHP): all the configuration is just where you require it, and it only uses one format. Use Dependency Injection to Get Services diff --git a/bundles/best_practices.rst b/bundles/best_practices.rst index 34bf24308ef..c52035d6446 100644 --- a/bundles/best_practices.rst +++ b/bundles/best_practices.rst @@ -427,21 +427,6 @@ The end user can provide values in any configuration file: parameters: acme_blog.author.email: 'fabien@example.com' - .. code-block:: xml - - - - - - fabien@example.com - - - - .. code-block:: php // config/services.php diff --git a/bundles/configuration.rst b/bundles/configuration.rst index dedfada2ea2..742d4cf184b 100644 --- a/bundles/configuration.rst +++ b/bundles/configuration.rst @@ -20,23 +20,6 @@ as integration of other related components: framework: form: true - .. code-block:: xml - - - - - - - - - .. code-block:: php // config/packages/framework.php @@ -162,23 +145,6 @@ can add some configuration that looks like this: client_id: 123 client_secret: your_secret - .. code-block:: xml - - - - - - - - - .. code-block:: php // config/packages/acme_social.php @@ -228,7 +194,7 @@ First things first, you have to create an extension class as explained in Whenever a user includes the ``acme_social`` key (which is the DI alias) in a configuration file, the configuration under it is added to an array of configurations and passed to the ``load()`` method of your extension (Symfony -automatically converts XML and YAML to an array). +automatically converts the configuration to an array). For the configuration example in the previous section, the array passed to your ``load()`` method will look like this:: @@ -304,7 +270,7 @@ The ``Configuration`` class to handle the sample configuration looks like:: .. seealso:: The ``Configuration`` class can be much more complicated than shown here, - supporting "prototype" nodes, advanced validation, XML-specific normalization + supporting "prototype" nodes, advanced validation, plural/singular normalization and advanced merging. You can read more about this in :doc:`the Config component documentation `. You can also see it in action by checking out some core Configuration @@ -333,22 +299,18 @@ configuration arrays together. Now, you can use the ``$config`` variable to modify a service provided by your bundle. For example, imagine your bundle has the following example config: -.. code-block:: xml - - - - - - - - - - - +.. code-block:: php + + + namespace Symfony\Component\DependencyInjection\Loader\Configurator; + + use Acme\SocialBundle\TwitterClient; + + return function (ContainerConfigurator $container) { + $container->services() + ->set('acme_social.twitter_client', TwitterClient::class) + ->args([abstract_arg('client_id'), abstract_arg('client_secret')]); + }; In your extension, you can load this and dynamically set its arguments:: @@ -356,12 +318,12 @@ In your extension, you can load this and dynamically set its arguments:: namespace Acme\SocialBundle\DependencyInjection; use Symfony\Component\Config\FileLocator; - use Symfony\Component\DependencyInjection\Loader\XmlFileLoader; + use Symfony\Component\DependencyInjection\Loader\PhpFileLoader; public function load(array $configs, ContainerBuilder $container): void { - $loader = new XmlFileLoader($container, new FileLocator(dirname(__DIR__).'/Resources/config')); - $loader->load('services.xml'); + $loader = new PhpFileLoader($container, new FileLocator(dirname(__DIR__).'/Resources/config')); + $loader->load('services.php'); $configuration = new Configuration(); $config = $this->processConfiguration($configuration, $configs); @@ -401,7 +363,7 @@ In your extension, you can load this and dynamically set its arguments:: Using the Config component is fully optional. The ``load()`` method gets an array of configuration values. You can instead parse these arrays yourself (e.g. by overriding configurations and using :phpfunction:`isset` to check - for the existence of a value). Be aware that it'll be very hard to support XML:: + for the existence of a value):: public function load(array $configs, ContainerBuilder $container): void { @@ -435,105 +397,6 @@ have something different, your ``Extension`` class must override the :method:`Extension::getConfiguration() ` method and return an instance of your ``Configuration``. -Supporting XML --------------- - -Symfony allows people to provide the configuration in three different formats: -Yaml, XML and PHP. Both Yaml and PHP use the same syntax and are supported by -default when using the Config component. Supporting XML requires you to do some -more things. But when sharing your bundle with others, it is recommended that -you follow these steps. - -Make your Config Tree ready for XML -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -The Config component provides some methods by default to allow it to correctly -process XML configuration. See ":ref:`component-config-normalization`" of the -component documentation. However, you can do some optional things as well, this -will improve the experience of using XML configuration: - -Choosing an XML Namespace -~~~~~~~~~~~~~~~~~~~~~~~~~ - -In XML, the `XML namespace`_ is used to determine which elements belong to the -configuration of a specific bundle. The namespace is returned from the -:method:`Extension::getNamespace() ` -method. By convention, the namespace is a URL (it doesn't have to be a valid -URL nor does it need to exist). By default, the namespace for a bundle is -``http://example.org/schema/dic/DI_ALIAS``, where ``DI_ALIAS`` is the DI alias of -the extension. You might want to change this to a more professional URL:: - - // src/DependencyInjection/AcmeHelloExtension.php - namespace Acme\HelloBundle\DependencyInjection; - - // ... - class AcmeHelloExtension extends Extension - { - // ... - - public function getNamespace(): string - { - return 'http://acme_company.com/schema/dic/hello'; - } - } - -Providing an XML Schema -~~~~~~~~~~~~~~~~~~~~~~~ - -XML has a very useful feature called `XML schema`_. This allows you to -describe all possible elements and attributes and their values in an XML Schema -Definition (an XSD file). This XSD file is used by IDEs for auto completion and -it is used by the Config component to validate the elements. - -In order to use the schema, the XML configuration file must provide an -``xsi:schemaLocation`` attribute pointing to the XSD file for a certain XML -namespace. This location always starts with the XML namespace. This XML -namespace is then replaced with the XSD validation base path returned from -:method:`Extension::getXsdValidationBasePath() ` -method. This namespace is then followed by the rest of the path from the base -path to the file itself. - -By convention, the XSD file lives in ``config/schema/`` directory, but you -can place it anywhere you like. You should return this path as the base path:: - - // src/DependencyInjection/AcmeHelloExtension.php - namespace Acme\HelloBundle\DependencyInjection; - - // ... - class AcmeHelloExtension extends Extension - { - // ... - - public function getXsdValidationBasePath(): string - { - return __DIR__.'/../config/schema'; - } - } - -Assuming the XSD file is called ``hello-1.0.xsd``, the schema location will be -``https://acme_company.com/schema/dic/hello/hello-1.0.xsd``: - -.. code-block:: xml - - - - - - - - - - - .. _`FrameworkBundle Configuration`: https://github.com/symfony/symfony/blob/master/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php .. _`TwigBundle Configuration`: https://github.com/symfony/symfony/blob/master/src/Symfony/Bundle/TwigBundle/DependencyInjection/Configuration.php -.. _`XML namespace`: https://en.wikipedia.org/wiki/XML_namespace -.. _`XML schema`: https://en.wikipedia.org/wiki/XML_schema .. _`snake case`: https://en.wikipedia.org/wiki/Snake_case diff --git a/bundles/extension.rst b/bundles/extension.rst index f3cc943e515..e49831686fe 100644 --- a/bundles/extension.rst +++ b/bundles/extension.rst @@ -33,8 +33,8 @@ method to load service definitions from configuration files:: { public function loadExtension(array $config, ContainerConfigurator $container, ContainerBuilder $builder): void { - // load an XML, PHP or YAML file - $container->import('../config/services.xml'); + // load a PHP or YAML file + $container->import('../config/services.php'); // you can also add or replace parameters and services $container->parameters() @@ -143,25 +143,25 @@ container. In the ``load()`` method, you can use PHP code to register service definitions, but it is more common if you put these definitions in a configuration file -(using the YAML, XML or PHP format). +(using the YAML or PHP format). -For instance, assume you have a file called ``services.xml`` in the +For instance, assume you have a file called ``services.php`` in the ``config/`` directory of your bundle, your ``load()`` method looks like:: use Symfony\Component\Config\FileLocator; - use Symfony\Component\DependencyInjection\Loader\XmlFileLoader; + use Symfony\Component\DependencyInjection\Loader\PhpFileLoader; // ... public function load(array $configs, ContainerBuilder $container): void { - $loader = new XmlFileLoader( + $loader = new PhpFileLoader( $container, new FileLocator(__DIR__.'/../../config') ); - $loader->load('services.xml'); + $loader->load('services.php'); } -The other available loaders are ``YamlFileLoader`` and ``PhpFileLoader``. +The other available loader is ``YamlFileLoader``. Using Configuration to Change the Services ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/bundles/prepend_extension.rst b/bundles/prepend_extension.rst index 7425adedaf1..40df06ac834 100644 --- a/bundles/prepend_extension.rst +++ b/bundles/prepend_extension.rst @@ -108,32 +108,6 @@ registered and the ``entity_manager_name`` setting for ``acme_hello`` is set to # ... use_acme_goodbye: false - .. code-block:: xml - - - - - - - non_default - - - - - - - - .. code-block:: php // config/packages/acme_something.php diff --git a/cache.rst b/cache.rst index b56599ca486..560ba6a7e07 100644 --- a/cache.rst +++ b/cache.rst @@ -61,26 +61,6 @@ adapter (template) they use by using the ``app`` and ``system`` key like: app: cache.adapter.filesystem system: cache.adapter.system - .. code-block:: xml - - - - - - - - - .. code-block:: php // config/packages/cache.php @@ -134,30 +114,6 @@ Some of these adapters could be configured via shortcuts. default_memcached_provider: 'memcached://localhost' default_pdo_provider: 'pgsql:host=localhost' - .. code-block:: xml - - - - - - - - - - .. code-block:: php // config/packages/cache.php @@ -219,44 +175,6 @@ You can also create more customized pools: adapter: foobar.cache default_lifetime: 60 - .. code-block:: xml - - - - - - - - - - - - - - - - - - - - - - - - .. code-block:: php // config/packages/cache.php @@ -339,39 +257,6 @@ with either :class:`Symfony\\Contracts\\Cache\\CacheInterface` or tags: - { name: 'cache.pool', namespace: 'my_custom_namespace' } - .. code-block:: xml - - - - - - - - - - - - - - .. code-block:: php - - // config/services.php - namespace Symfony\Component\DependencyInjection\Loader\Configurator; - - return function(ContainerConfigurator $container): void { - $container->services() - // ... - - ->set('app.cache.adapter.redis') - ->parent('cache.adapter.redis') - ->tag('cache.pool', ['namespace' => 'my_custom_namespace']) - ; - }; - Custom Provider Options ----------------------- @@ -401,39 +286,6 @@ and use that when configuring the pool. - 'redis://localhost' - { retry_interval: 2, timeout: 10 } - .. code-block:: xml - - - - - - - - - - - - - - redis://localhost - - 2 - 10 - - - - - .. code-block:: php // config/packages/cache.php @@ -493,30 +345,6 @@ Symfony stores the item automatically in all the missing pools. - cache.adapter.apcu - {name: cache.adapter.redis, provider: 'redis://user:password@example.com'} - .. code-block:: xml - - - - - - - - - - - - - - - .. code-block:: php // config/packages/cache.php @@ -589,28 +417,6 @@ to enable this feature. This could be added by using the following configuration adapter: cache.adapter.redis_tag_aware tags: true - .. code-block:: xml - - - - - - - - - - - .. code-block:: php // config/packages/cache.php @@ -642,29 +448,6 @@ achieved by specifying the adapter. tag_pool: adapter: cache.adapter.apcu - .. code-block:: xml - - - - - - - - - - - - .. code-block:: php // config/packages/cache.php @@ -787,32 +570,6 @@ Then, register the ``SodiumMarshaller`` service using this key: #- ['%env(base64:CACHE_DECRYPTION_KEY)%', '%env(base64:OLD_CACHE_DECRYPTION_KEY)%'] - '@.inner' - .. code-block:: xml - - - - - - - - - - - env(base64:CACHE_DECRYPTION_KEY) - - - - - - - - .. code-block:: php // config/packages/cache.php @@ -918,32 +675,6 @@ a message bus to compute values in a worker: routing: 'Symfony\Component\Cache\Messenger\EarlyExpirationMessage': async_bus - .. code-block:: xml - - - - - - - - - - - %env(MESSENGER_TRANSPORT_DSN)% - - - - - - - .. code-block:: php // config/framework/framework.php diff --git a/components/dependency_injection.rst b/components/dependency_injection.rst index d146f553a0c..3ae645aa289 100644 --- a/components/dependency_injection.rst +++ b/components/dependency_injection.rst @@ -210,22 +210,22 @@ Setting up the Container with Configuration Files ------------------------------------------------- As well as setting up the services using PHP as above you can also use -configuration files. This allows you to use XML or YAML to write the definitions +configuration files. This allows you to use YAML or PHP to write the definitions for the services rather than using PHP to define the services as in the above examples. In anything but the smallest applications it makes sense to organize the service definitions by moving them into one or more configuration files. To do this you also need to install :doc:`the Config component `. -Loading an XML config file:: +Loading a PHP config file:: use Symfony\Component\Config\FileLocator; use Symfony\Component\DependencyInjection\ContainerBuilder; - use Symfony\Component\DependencyInjection\Loader\XmlFileLoader; + use Symfony\Component\DependencyInjection\Loader\PhpFileLoader; $container = new ContainerBuilder(); - $loader = new XmlFileLoader($container, new FileLocator(__DIR__)); - $loader->load('services.xml'); + $loader = new PhpFileLoader($container, new FileLocator(__DIR__)); + $loader->load('services.php'); Loading a YAML config file:: @@ -242,15 +242,6 @@ Loading a YAML config file:: If you want to load YAML config files then you will also need to install :doc:`the Yaml component `. -.. tip:: - - If your application uses unconventional file extensions (for example, your - XML files have a ``.config`` extension) you can pass the file type as the - second optional parameter of the ``load()`` method:: - - // ... - $loader->load('services.config', 'xml'); - If you *do* want to use PHP to create the services then you can move this into a separate config file and load it in a similar way:: @@ -282,32 +273,6 @@ config files: calls: - [setMailer, ['@mailer']] - .. code-block:: xml - - - - - - sendmail - - - - - %mailer.transport% - - - - - - - - - - .. code-block:: php namespace Symfony\Component\DependencyInjection\Loader\Configurator; diff --git a/components/dependency_injection/_imports-parameters-note.rst.inc b/components/dependency_injection/_imports-parameters-note.rst.inc index 1389ca78fe3..41b523afddd 100644 --- a/components/dependency_injection/_imports-parameters-note.rst.inc +++ b/components/dependency_injection/_imports-parameters-note.rst.inc @@ -12,20 +12,6 @@ imports: - { resource: '%kernel.project_dir%/somefile.yaml' } - .. code-block:: xml - - - - - - - - - .. code-block:: php // config/services.php diff --git a/components/dependency_injection/compilation.rst b/components/dependency_injection/compilation.rst index c79281b5c27..763d409ab54 100644 --- a/components/dependency_injection/compilation.rst +++ b/components/dependency_injection/compilation.rst @@ -57,17 +57,17 @@ A very simple extension may just load configuration files into the container:: use Symfony\Component\Config\FileLocator; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Extension\ExtensionInterface; - use Symfony\Component\DependencyInjection\Loader\XmlFileLoader; + use Symfony\Component\DependencyInjection\Loader\PhpFileLoader; class AcmeDemoExtension implements ExtensionInterface { public function load(array $configs, ContainerBuilder $container): void { - $loader = new XmlFileLoader( + $loader = new PhpFileLoader( $container, new FileLocator(__DIR__.'/../Resources/config') ); - $loader->load('services.xml'); + $loader->load('services.php'); } // ... @@ -170,45 +170,6 @@ you could access the config value this way:: // ... } -There are a further two methods you must implement. One to return the XML -namespace so that the relevant parts of an XML config file are passed to -the extension. The other to specify the base path to XSD files to validate -the XML configuration:: - - public function getXsdValidationBasePath(): string - { - return __DIR__.'/../Resources/config/'; - } - - public function getNamespace(): string - { - return 'http://www.example.com/symfony/schema/'; - } - -.. note:: - - XSD validation is optional, returning ``false`` from the ``getXsdValidationBasePath()`` - method will disable it. - -The XML version of the config would then look like this: - -.. code-block:: xml - - - - - fooValue - barValue - - - .. note:: In the Symfony full-stack Framework there is a base Extension class @@ -240,14 +201,14 @@ file but also load a secondary one only if a certain parameter is set:: $processor = new Processor(); $config = $processor->processConfiguration($configuration, $configs); - $loader = new XmlFileLoader( + $loader = new PhpFileLoader( $container, new FileLocator(__DIR__.'/../Resources/config') ); - $loader->load('services.xml'); + $loader->load('services.php'); if ($config['advanced']) { - $loader->load('advanced.xml'); + $loader->load('advanced.php'); } } @@ -256,7 +217,7 @@ about not using them anymore. This helps with the migration across major version of an extension. Deprecation is only possible when using PHP to configure the extension, not when -using XML or YAML. Use the ``ContainerBuilder::deprecateParameter()`` method to +using YAML. Use the ``ContainerBuilder::deprecateParameter()`` method to provide the deprecation details:: public function load(array $configs, ContainerBuilder $containerBuilder) diff --git a/components/uid.rst b/components/uid.rst index 5d4a7e305fc..fcb9fc0c052 100644 --- a/components/uid.rst +++ b/components/uid.rst @@ -204,28 +204,6 @@ You can configure these default values:: time_based_uuid_version: 6 time_based_uuid_node: 121212121212 - .. code-block:: xml - - - - - - - - - - .. code-block:: php // config/packages/uid.php @@ -625,25 +603,6 @@ configuration in your application before using these commands: Symfony\Component\Uid\Command\InspectUlidCommand: ~ Symfony\Component\Uid\Command\InspectUuidCommand: ~ - .. code-block:: xml - - - - - - - - - - - - - - - .. code-block:: php // config/services.php diff --git a/components/var_dumper.rst b/components/var_dumper.rst index c6966a692af..01dbbdec15e 100644 --- a/components/var_dumper.rst +++ b/components/var_dumper.rst @@ -124,21 +124,6 @@ the :ref:`dump_destination option ` of the debug: dump_destination: "tcp://%env(VAR_DUMPER_SERVER)%" - .. code-block:: xml - - - - - - - .. code-block:: php // config/packages/debug.php diff --git a/configuration.rst b/configuration.rst index e46fd28750c..5f6bae9068a 100644 --- a/configuration.rst +++ b/configuration.rst @@ -53,7 +53,7 @@ Configuration Formats ~~~~~~~~~~~~~~~~~~~~~ Unlike other frameworks, Symfony doesn't impose a specific format on you to -configure your applications, but lets you choose between YAML, XML and PHP. +configure your applications, but lets you choose between YAML and PHP. Throughout the Symfony documentation, all configuration examples will be shown in these three formats. @@ -66,21 +66,9 @@ readable. These are the main advantages and disadvantages of each format: * **YAML**: simple, clean and readable, but not all IDEs support autocompletion and validation for it. :doc:`Learn the YAML syntax `; -* **XML**: autocompleted/validated by most IDEs and is parsed natively by PHP, - but sometimes it generates configuration considered too verbose. `Learn the XML syntax`_; * **PHP**: very powerful and it allows you to create dynamic configuration with arrays or a :ref:`ConfigBuilder `. -.. note:: - - By default Symfony loads the configuration files defined in YAML and PHP - formats. If you define configuration in XML format, update the - :method:`Symfony\\Bundle\\FrameworkBundle\\Kernel\\MicroKernelTrait::configureContainer` - and/or - :method:`Symfony\\Bundle\\FrameworkBundle\\Kernel\\MicroKernelTrait::configureRoutes` - methods in the ``src/Kernel.php`` file to add support for the ``.xml`` file - extension. - Importing Configuration Files ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -106,31 +94,6 @@ configuration files, even if they use a different format: # ... - .. code-block:: xml - - - - - - - - - - - - - - - - - - - .. code-block:: php // config/services.php @@ -191,49 +154,6 @@ reusable configuration value. By convention, parameters are defined under the # ... - .. code-block:: xml - - - - - - - - something@example.com - - - true - - true - - - - en - es - fr - - - - VGhpcyBpcyBhIEJlbGwgY2hhciAH - - - GLOBAL_CONSTANT - App\Entity\BlogPost::MAX_ITEMS - - - App\Enum\PostState::Published - - - - - .. code-block:: php // config/services.php @@ -267,27 +187,6 @@ reusable configuration value. By convention, parameters are defined under the // ... -.. warning:: - - By default and when using XML configuration, the values between ```` - tags are not trimmed. This means that the value of the following parameter will be - ``'\n something@example.com\n'``: - - .. code-block:: xml - - - something@example.com - - - If you want to trim the value of your parameter, use the ``trim`` attribute. - When using it, the value of the following parameter will be ``something@example.com``: - - .. code-block:: xml - - - something@example.com - - Once defined, you can reference this parameter value from any other configuration file using a special syntax: wrap the parameter name in two ``%`` (e.g. ``%app.admin_email%``): @@ -301,24 +200,6 @@ configuration file using a special syntax: wrap the parameter name in two ``%`` # any string surrounded by two % is replaced by that parameter value email_address: '%app.admin_email%' - .. code-block:: xml - - - - - - - - - - - .. code-block:: php // config/packages/some_package.php @@ -331,7 +212,7 @@ configuration file using a special syntax: wrap the parameter name in two ``%`` 'email_address' => param('app.admin_email'), // ... but if you prefer it, you can also pass the name as a string - // surrounded by two % (same as in YAML and XML formats) and Symfony will + // surrounded by two % (same as in YAML format) and Symfony will // replace it by that parameter value 'email_address' => '%app.admin_email%', ]); @@ -352,13 +233,6 @@ configuration file using a special syntax: wrap the parameter name in two ``%`` # Parsed as 'https://symfony.com/?foo=%s&bar=%d' url_pattern: 'https://symfony.com/?foo=%%s&bar=%%d' - .. code-block:: xml - - - - http://symfony.com/?foo=%%s&bar=%%d - - .. code-block:: php // config/services.php @@ -479,33 +353,6 @@ files directly in the ``config/packages/`` directory. # ... when@test: *webpack_prod - .. code-block:: xml - - - - - - - - - - - - - - - - - .. code-block:: php // config/packages/framework.php @@ -626,23 +473,6 @@ This example shows how you could configure the application secret using an env v secret: '%env(APP_SECRET)%' # ... - .. code-block:: xml - - - - - - - - - - .. code-block:: php // config/packages/framework.php @@ -693,26 +523,6 @@ To do so, define a parameter with the same name as the env var using this syntax # ... - .. code-block:: xml - - - - - - - - some_secret - - - - - .. code-block:: php // config/packages/framework.php @@ -1169,26 +979,6 @@ doesn't work for parameters: arguments: $contentsDir: '%app.contents_dir%' - .. code-block:: xml - - - - - - - ... - - - - - %app.contents_dir% - - - - .. code-block:: php // config/services.php @@ -1226,26 +1016,6 @@ whenever a service/controller defines a ``$projectDir`` argument, use this: # ... - .. code-block:: xml - - - - - - - - - %kernel.project_dir% - - - - - - .. code-block:: php // config/services.php diff --git a/configuration/env_var_processors.rst b/configuration/env_var_processors.rst index 22d2880dc75..4b7c55f59fc 100644 --- a/configuration/env_var_processors.rst +++ b/configuration/env_var_processors.rst @@ -21,23 +21,6 @@ processor to turn the value of the ``HTTP_PORT`` env var into an integer: router: http_port: '%env(int:HTTP_PORT)%' - .. code-block:: xml - - - - - - - - - - .. code-block:: php // config/packages/framework.php @@ -71,25 +54,6 @@ Symfony provides the following env var processors: framework: secret: '%env(string:SECRET)%' - .. code-block:: xml - - - - - - - some_secret - - - - - .. code-block:: php // config/packages/framework.php @@ -118,25 +82,6 @@ Symfony provides the following env var processors: framework: http_method_override: '%env(bool:HTTP_METHOD_OVERRIDE)%' - .. code-block:: xml - - - - - - - true - - - - - .. code-block:: php // config/packages/framework.php @@ -162,24 +107,6 @@ Symfony provides the following env var processors: parameters: safe_for_production: '%env(not:APP_DEBUG)%' - .. code-block:: xml - - - - - - - %env(not:APP_DEBUG)% - - - - .. code-block:: php // config/services.php @@ -205,27 +132,6 @@ Symfony provides the following env var processors: access_control: - { path: '^/health-check$', methods: '%env(const:HEALTH_CHECK_METHOD)%' } - .. code-block:: xml - - - - - - - Symfony\Component\HttpFoundation\Request::METHOD_HEAD - - - - - - - .. code-block:: php // config/packages/security.php @@ -255,24 +161,6 @@ Symfony provides the following env var processors: env(ALLOWED_LANGUAGES): '["en","de","es"]' app_allowed_languages: '%env(json:ALLOWED_LANGUAGES)%' - .. code-block:: xml - - - - - - - ["en","de","es"] - %env(json:ALLOWED_LANGUAGES)% - - - .. code-block:: php // config/packages/framework.php @@ -301,23 +189,6 @@ Symfony provides the following env var processors: sentry: dsn: '%env(resolve:SENTRY_DSN)%' - .. code-block:: xml - - - - - - - 10.0.0.1 - http://%sentry_host%/project - - - - - .. code-block:: php // config/packages/sentry.php @@ -339,24 +210,6 @@ Symfony provides the following env var processors: env(ALLOWED_LANGUAGES): "en,de,es" app_allowed_languages: '%env(csv:ALLOWED_LANGUAGES)%' - .. code-block:: xml - - - - - - - en,de,es - %env(csv:ALLOWED_LANGUAGES)% - - - .. code-block:: php // config/packages/framework.php @@ -385,30 +238,6 @@ Symfony provides the following env var processors: class: RedisCluster arguments: [null, "%env(shuffle:csv:REDIS_NODES)%"] - .. code-block:: xml - - - - - - - redis://127.0.0.1:6380,redis://127.0.0.1:6381 - - - - - null - %env(shuffle:csv:REDIS_NODES)% - - - - .. code-block:: php // config/services.php @@ -432,25 +261,6 @@ Symfony provides the following env var processors: google: auth: '%env(file:AUTH_FILE)%' - .. code-block:: xml - - - - - - - ../config/auth.json - - - - - .. code-block:: php // config/packages/framework.php @@ -473,25 +283,6 @@ Symfony provides the following env var processors: app: auth: '%env(require:PHP_FILE)%' - .. code-block:: xml - - - - - - - ../config/.runtime-evaluated.php - - - - - .. code-block:: php // config/packages/framework.php @@ -515,25 +306,6 @@ Symfony provides the following env var processors: google: auth: '%env(trim:file:AUTH_FILE)%' - .. code-block:: xml - - - - - - - ../config/auth.json - - - - - .. code-block:: php // config/packages/framework.php @@ -556,24 +328,6 @@ Symfony provides the following env var processors: database_password: '%env(key:database_password:json:file:SECRETS_FILE)%' # if SECRETS_FILE contents are: {"database_password": "secret"} it returns "secret" - .. code-block:: xml - - - - - - - /opt/application/.secrets.json - %env(key:database_password:json:file:SECRETS_FILE)% - - - .. code-block:: php // config/services.php @@ -594,24 +348,6 @@ Symfony provides the following env var processors: private_key: '%env(default:raw_key:file:PRIVATE_KEY)%' raw_key: '%env(PRIVATE_KEY)%' - .. code-block:: xml - - - - - - - %env(default:raw_key:file:PRIVATE_KEY)% - %env(PRIVATE_KEY)% - - - .. code-block:: php // config/services.php @@ -647,23 +383,6 @@ Symfony provides the following env var processors: default: database_name: '%env(key:path:url:MONGODB_URL)%' - .. code-block:: xml - - - - - - - - - - - - - .. code-block:: php // config/packages/mongodb.php @@ -712,20 +431,6 @@ Symfony provides the following env var processors: # ... connectTimeoutMS: '%env(int:key:timeout:query_string:MONGODB_URL)%' - .. code-block:: xml - - - - - - - - - - .. code-block:: php // config/packages/mongodb.php @@ -759,23 +464,6 @@ Symfony provides the following env var processors: parameters: suit: '%env(enum:App\Enum\Suit:CARD_SUIT)%' - .. code-block:: xml - - - - - - - %env(enum:App\Enum\Suit:CARD_SUIT)% - - - .. code-block:: php // config/services.php @@ -796,23 +484,6 @@ Symfony provides the following env var processors: parameters: typed_env: '%env(defined:FOO)%' - .. code-block:: xml - - - - - - - - - - .. code-block:: php // config/services.php @@ -834,24 +505,6 @@ Symfony provides the following env var processors: env(DATABASE_URL): 'mysql://db_user:foo@b$r@127.0.0.1:3306/db_name' encoded_database_url: '%env(urlencode:DATABASE_URL)%' - .. code-block:: xml - - - - - - - mysql://db_user:foo@b$r@127.0.0.1:3306/db_name - %env(urlencode:DATABASE_URL)% - - - .. code-block:: php // config/packages/framework.php @@ -881,29 +534,6 @@ It is also possible to combine any number of processors: # 4. JSON-decodes the content of the file and returns it auth: '%env(json:file:resolve:AUTH_FILE)%' - .. code-block:: xml - - - - - - - %kernel.project_dir%/config/auth.json - - - - - - - - - .. code-block:: php // config/packages/framework.php diff --git a/configuration/front_controllers_and_kernel.rst b/configuration/front_controllers_and_kernel.rst index b55f66afc33..428aa13e871 100644 --- a/configuration/front_controllers_and_kernel.rst +++ b/configuration/front_controllers_and_kernel.rst @@ -166,21 +166,6 @@ parameter used, for example, to turn Twig's debug mode on: twig: debug: '%kernel.debug%' - .. code-block:: xml - - - - - - - - .. code-block:: php // config/packages/twig.php diff --git a/configuration/micro_kernel_trait.rst b/configuration/micro_kernel_trait.rst index 6adee785a7f..947abefc807 100644 --- a/configuration/micro_kernel_trait.rst +++ b/configuration/micro_kernel_trait.rst @@ -357,21 +357,6 @@ because the configuration started to get bigger: secret: S0ME_SECRET profiler: { only_exceptions: false } - .. code-block:: xml - - - - - - - - - - .. code-block:: php // config/framework.php diff --git a/configuration/override_dir_structure.rst b/configuration/override_dir_structure.rst index e5dff35b6d0..1ace31069d3 100644 --- a/configuration/override_dir_structure.rst +++ b/configuration/override_dir_structure.rst @@ -166,24 +166,6 @@ for multiple directories): # ... default_path: "%kernel.project_dir%/resources/views" - .. code-block:: xml - - - - - - - %kernel.project_dir%/resources/views - - - - .. code-block:: php // config/packages/twig.php @@ -210,26 +192,6 @@ configuration option to define your own translations directory (use :ref:`framew # ... default_path: "%kernel.project_dir%/i18n" - .. code-block:: xml - - - - - - - - %kernel.project_dir%/i18n - - - - - .. code-block:: php // config/packages/translation.php diff --git a/configuration/secrets.rst b/configuration/secrets.rst index b0a31e02afe..5e91c82a611 100644 --- a/configuration/secrets.rst +++ b/configuration/secrets.rst @@ -114,26 +114,6 @@ If you stored a ``DATABASE_PASSWORD`` secret, you can reference it by: # ... # ... - .. code-block:: xml - - - - - - - - - - - .. code-block:: php // config/packages/doctrine.php @@ -297,25 +277,6 @@ The secrets system is enabled by default and some of its behavior can be configu #local_dotenv_file: '%kernel.project_dir%/.env.%kernel.environment%.local' #decryption_env_var: 'base64:default::SYMFONY_DECRYPTION_SECRET' - .. code-block:: xml - - - - - - - - - .. code-block:: php // config/packages/framework.php diff --git a/configuration/using_parameters_in_dic.rst b/configuration/using_parameters_in_dic.rst index 3cac5d5049c..1036d404d8f 100644 --- a/configuration/using_parameters_in_dic.rst +++ b/configuration/using_parameters_in_dic.rst @@ -44,31 +44,6 @@ Now, examine the results to see this closely: # The Configurator does not know anything about # "%kernel.debug%" being a parameter. - .. code-block:: xml - - - - - - - - - - - - - - .. code-block:: php $container->loadFromExtension('my_bundle', [ diff --git a/console/commands_as_services.rst b/console/commands_as_services.rst index ed5b99f9cb4..da8e664ba80 100644 --- a/console/commands_as_services.rst +++ b/console/commands_as_services.rst @@ -78,24 +78,6 @@ Or set the ``command`` attribute on the ``console.command`` tag in your service tags: - { name: 'console.command', command: 'app:sunshine' } - .. code-block:: xml - - - - - - - - - - - - - - .. code-block:: php // config/services.php diff --git a/contributing/code/reproducer.rst b/contributing/code/reproducer.rst index c2208b70b09..bc08a353498 100644 --- a/contributing/code/reproducer.rst +++ b/contributing/code/reproducer.rst @@ -70,11 +70,11 @@ to a route definition. Then, after creating your project: see if the bug appears or not. #. If you can see the bug, you're done and you can already share the code with us. #. If you can't see the bug, you must keep making small changes. For example, if - your original route was defined using XML, forget about the previous route - and define the route using XML instead. Or maybe your application - registers some event listeners and that's where the real bug is. In that case, - add an event listener that's similar to your real app to see if you can find - the bug. + your original route was defined in a YAML or PHP file in the ``config/`` folder, + forget about the previous route and define the route using the same pattern. + Or maybe your application registers some event listeners and that's where the + real bug is. In that case, add an event listener that's similar to your real + app to see if you can find the bug. In short, the idea is to keep adding small and incremental changes to a new project until you can reproduce the bug. diff --git a/contributing/documentation/standards.rst b/contributing/documentation/standards.rst index 5e195d008fd..02bc3e3836f 100644 --- a/contributing/documentation/standards.rst +++ b/contributing/documentation/standards.rst @@ -87,8 +87,8 @@ Configuration examples should show all supported formats using :ref:`configuration blocks `. The supported formats (and their orders) are: -* **Configuration** (including services): YAML, XML, PHP -* **Routing**: Attributes, YAML, XML, PHP +* **Configuration** (including services): YAML, PHP +* **Routing**: Attributes, YAML, PHP * **Validation**: Attributes, YAML, XML, PHP * **Doctrine Mapping**: Attributes, YAML, XML, PHP * **Translation**: XML, YAML, PHP diff --git a/controller/error_pages.rst b/controller/error_pages.rst index 8e50fa0d132..7fb7043de82 100644 --- a/controller/error_pages.rst +++ b/controller/error_pages.rst @@ -158,20 +158,6 @@ automatically when installing ``symfony/framework-bundle``): type: php prefix: /_error - .. code-block:: xml - - - - - - - - - - .. code-block:: php // config/routes/framework.php @@ -256,21 +242,6 @@ configuration option to point to it: framework: error_controller: App\Controller\ErrorController::show - .. code-block:: xml - - - - - - - App\Controller\ErrorController::show - - - - .. code-block:: php // config/packages/framework.php diff --git a/controller/service.rst b/controller/service.rst index 3cba131daed..6d78b6dae02 100644 --- a/controller/service.rst +++ b/controller/service.rst @@ -143,19 +143,6 @@ a service like: ``App\Controller\HelloController::index``: controller: App\Controller\HelloController::index methods: GET - .. code-block:: xml - - - - - - - - - .. code-block:: php // config/routes.php @@ -204,21 +191,6 @@ which is a common practice when following the `ADR pattern`_ path: /hello/{name} controller: App\Controller\HelloController - .. code-block:: xml - - - - - - - App\Controller\HelloController - - - - .. code-block:: php use App\Controller\HelloController; diff --git a/controller/upload_file.rst b/controller/upload_file.rst index cb203e6225d..88b8855d4d8 100644 --- a/controller/upload_file.rst +++ b/controller/upload_file.rst @@ -285,21 +285,6 @@ Then, define a service for this class: arguments: $targetDirectory: '%brochures_directory%' - .. code-block:: xml - - - - - - - - %brochures_directory% - - - .. code-block:: php // config/services.php diff --git a/controller/value_resolver.rst b/controller/value_resolver.rst index 835edcfbff9..35f199826a9 100644 --- a/controller/value_resolver.rst +++ b/controller/value_resolver.rst @@ -362,27 +362,6 @@ but you can set it yourself to change its ``priority`` or ``name`` attributes. name: booking_id priority: 150 - .. code-block:: xml - - - - - - - - - - - - controller.argument_value_resolver - - - - - .. code-block:: php // config/services.php diff --git a/create_framework/routing.rst b/create_framework/routing.rst index 71e3a8250e1..1632f2628b3 100644 --- a/create_framework/routing.rst +++ b/create_framework/routing.rst @@ -74,7 +74,7 @@ of default values for route attributes (``['name' => 'World']``). Read the :doc:`Routing documentation ` to learn more about its many features like URL generation, attribute requirements, HTTP - method enforcement, loaders for YAML or XML files, dumpers to PHP or + method enforcement, loaders for YAML or PHP files, dumpers to PHP or Apache rewrite rules for enhanced performance and much more. Based on the information stored in the ``RouteCollection`` instance, a diff --git a/deployment/proxies.rst b/deployment/proxies.rst index d9d974314bf..016ef136412 100644 --- a/deployment/proxies.rst +++ b/deployment/proxies.rst @@ -44,36 +44,6 @@ using the following configuration options: # or, if your proxy instead uses the "Forwarded" header trusted_headers: ['forwarded'] - .. code-block:: xml - - - - - - - - 192.0.0.1,10.0.0.0/8 - - private_ranges - - - x-forwarded-for - x-forwarded-host - x-forwarded-proto - x-forwarded-port - x-forwarded-prefix - - - forwarded - - - .. code-block:: php // config/packages/framework.php diff --git a/doctrine/custom_dql_functions.rst b/doctrine/custom_dql_functions.rst index e5b21819f58..dfb13d5ca0f 100644 --- a/doctrine/custom_dql_functions.rst +++ b/doctrine/custom_dql_functions.rst @@ -23,30 +23,6 @@ In Symfony, you can register your custom DQL functions as follows: datetime_functions: test_datetime: App\DQL\DatetimeFunction - .. code-block:: xml - - - - - - - - - App\DQL\StringFunction - App\DQL\SecondStringFunction - App\DQL\NumericFunction - App\DQL\DatetimeFunction - - - - - .. code-block:: php // config/packages/doctrine.php @@ -89,34 +65,6 @@ In Symfony, you can register your custom DQL functions as follows: datetime_functions: test_datetime: App\DQL\DatetimeFunction - .. code-block:: xml - - - - - - - - - - - - - - App\DQL\DatetimeFunction - - - - - - - .. code-block:: php // config/packages/doctrine.php diff --git a/doctrine/dbal.rst b/doctrine/dbal.rst index 4f47b61eb61..fd6f748401d 100644 --- a/doctrine/dbal.rst +++ b/doctrine/dbal.rst @@ -78,25 +78,6 @@ mapping types, read Doctrine's `Custom Mapping Types`_ section of their document custom_first: App\Type\CustomFirst custom_second: App\Type\CustomSecond - .. code-block:: xml - - - - - - - - - - - - .. code-block:: php // config/packages/doctrine.php @@ -130,24 +111,6 @@ mapping type: mapping_types: enum: string - .. code-block:: xml - - - - - - - string - - - - .. code-block:: php // config/packages/doctrine.php diff --git a/doctrine/events.rst b/doctrine/events.rst index accf424083a..0cd4803ccc7 100644 --- a/doctrine/events.rst +++ b/doctrine/events.rst @@ -177,39 +177,6 @@ with the ``doctrine.orm.entity_listener`` tag as follows: # configure a custom method name with the 'method' option # method: 'checkUserChanges' - .. code-block:: xml - - - - - - - - - - - - - - .. code-block:: php // config/services.php @@ -324,30 +291,6 @@ listener in the Symfony application by creating a new service for it and # you can also restrict listeners to a specific Doctrine connection connection: 'default' - .. code-block:: xml - - - - - - - - - - - - - - .. code-block:: php // config/services.php diff --git a/doctrine/multiple_entity_managers.rst b/doctrine/multiple_entity_managers.rst index 1a56c55ddad..3d295b9939f 100644 --- a/doctrine/multiple_entity_managers.rst +++ b/doctrine/multiple_entity_managers.rst @@ -55,53 +55,6 @@ The following configuration code shows how you can configure two entity managers prefix: 'App\Entity\Customer' alias: Customer - .. code-block:: xml - - - - - - - - - - - - - - - - - - - - - - - - .. code-block:: php // config/packages/doctrine.php diff --git a/doctrine/resolve_target_entity.rst b/doctrine/resolve_target_entity.rst index 9cf54be4b90..1e281f52b62 100644 --- a/doctrine/resolve_target_entity.rst +++ b/doctrine/resolve_target_entity.rst @@ -102,26 +102,6 @@ how to replace the interface with the concrete class: resolve_target_entities: App\Model\InvoiceSubjectInterface: App\Entity\Customer - .. code-block:: xml - - - - - - - - - App\Entity\Customer - - - - .. code-block:: php // config/packages/doctrine.php diff --git a/event_dispatcher.rst b/event_dispatcher.rst index ffa9e67aa0d..1fceb2a872d 100644 --- a/event_dispatcher.rst +++ b/event_dispatcher.rst @@ -71,22 +71,6 @@ notify Symfony that it is an event listener by using a special "tag": App\EventListener\ExceptionListener: tags: [kernel.event_listener] - .. code-block:: xml - - - - - - - - - - - - .. code-block:: php // config/services.php @@ -477,23 +461,6 @@ First, define some token configuration as parameters: client1: pass1 client2: pass2 - .. code-block:: xml - - - - - - - - pass1 - pass2 - - - - .. code-block:: php // config/services.php diff --git a/form/bootstrap4.rst b/form/bootstrap4.rst index eef016aa58a..620a3b78ed8 100644 --- a/form/bootstrap4.rst +++ b/form/bootstrap4.rst @@ -34,24 +34,6 @@ configuration: twig: form_themes: ['bootstrap_4_layout.html.twig'] - .. code-block:: xml - - - - - - - bootstrap_4_layout.html.twig - - - - .. code-block:: php // config/packages/twig.php diff --git a/form/bootstrap5.rst b/form/bootstrap5.rst index db098a1ba09..deb21c23fe2 100644 --- a/form/bootstrap5.rst +++ b/form/bootstrap5.rst @@ -34,24 +34,6 @@ configuration: twig: form_themes: ['bootstrap_5_layout.html.twig'] - .. code-block:: xml - - - - - - - bootstrap_5_layout.html.twig - - - - .. code-block:: php // config/packages/twig.php diff --git a/form/create_custom_field_type.rst b/form/create_custom_field_type.rst index 0d92a967fa0..3fb0ed7edee 100644 --- a/form/create_custom_field_type.rst +++ b/form/create_custom_field_type.rst @@ -376,24 +376,6 @@ add this new template at the end of the list (each theme overrides all the previ - '...' - 'form/custom_types.html.twig' - .. code-block:: xml - - - - - - - ... - form/custom_types.html.twig - - - .. code-block:: php // config/packages/twig.php diff --git a/form/form_themes.rst b/form/form_themes.rst index 8b82982edaa..58aa4b7251f 100644 --- a/form/form_themes.rst +++ b/form/form_themes.rst @@ -67,23 +67,6 @@ want to use another theme for all the forms of your app, configure it in the form_themes: ['bootstrap_5_horizontal_layout.html.twig'] # ... - .. code-block:: xml - - - - - - - bootstrap_5_horizontal_layout.html.twig - - - - .. code-block:: php // config/packages/twig.php @@ -494,23 +477,6 @@ you want to apply the theme globally to all forms, define the form_themes: ['form/my_theme.html.twig'] # ... - .. code-block:: xml - - - - - - - form/my_theme.html.twig - - - - .. code-block:: php // config/packages/twig.php diff --git a/form/type_guesser.rst b/form/type_guesser.rst index 106eb4e7742..59fdfffe37f 100644 --- a/form/type_guesser.rst +++ b/form/type_guesser.rst @@ -191,22 +191,6 @@ and tag it with ``form.type_guesser``: App\Form\TypeGuesser\PhpDocTypeGuesser: tags: [form.type_guesser] - .. code-block:: xml - - - - - - - - - - - - .. code-block:: php // config/services.php diff --git a/forms.rst b/forms.rst index 83065d7524b..3d75efe3c57 100644 --- a/forms.rst +++ b/forms.rst @@ -339,24 +339,6 @@ can set this option to generate forms compatible with the Bootstrap 5 CSS framew twig: form_themes: ['bootstrap_5_layout.html.twig'] - .. code-block:: xml - - - - - - - bootstrap_5_layout.html.twig - - - - .. code-block:: php // config/packages/twig.php diff --git a/frontend/custom_version_strategy.rst b/frontend/custom_version_strategy.rst index 1a0dca3e393..8a20c6acfaa 100644 --- a/frontend/custom_version_strategy.rst +++ b/frontend/custom_version_strategy.rst @@ -105,23 +105,6 @@ After creating the strategy PHP class, register it as a Symfony service. - "%kernel.project_dir%/busters.json" - "%%s?version=%%s" - .. code-block:: xml - - - - - - - %kernel.project_dir%/busters.json - %%s?version=%%s - - - - .. code-block:: php // config/services.php @@ -155,21 +138,6 @@ the :ref:`version_strategy ` option: assets: version_strategy: 'App\Asset\VersionStrategy\GulpBusterVersionStrategy' - .. code-block:: xml - - - - - - - - - - .. code-block:: php // config/packages/framework.php diff --git a/html_sanitizer.rst b/html_sanitizer.rst index 38d7664ccf7..d057dfe2688 100644 --- a/html_sanitizer.rst +++ b/html_sanitizer.rst @@ -168,26 +168,6 @@ You can do this by defining a new HTML sanitizer in the configuration: block_elements: - h1 - .. code-block:: xml - - - - - - - - - - - - - - .. code-block:: php // config/packages/framework.php @@ -240,30 +220,6 @@ Safe elements allow_safe_elements: true allow_static_elements: true - .. code-block:: xml - - - - - - - - - - - - - .. code-block:: php // config/packages/framework.php @@ -317,45 +273,6 @@ attributes from the `W3C Standard Proposal`_ are allowed. # allow the
element with no attributes div: [] - .. code-block:: xml - - - - - - - - - - - - class - data-attr - - - - - src - - - - - * - - - - - - - - - .. code-block:: php // config/packages/framework.php @@ -423,28 +340,6 @@ This can also be used to remove elements from the allow list. # remove
and its children drop_elements: ['figure'] - .. code-block:: xml - - - - - - - - - div - - - figure - - - - .. code-block:: php // config/packages/framework.php @@ -497,32 +392,6 @@ on all elements allowed *before this setting*. # allow "data-attr" on all elements currently allowed data-attr: '*' - .. code-block:: xml - - - - - - - - - - iframe - - - - - * - - - - - .. code-block:: php // config/packages/framework.php @@ -578,37 +447,6 @@ This option allows you to disallow attributes that were allowed before. # disallows "style' on any allowed element style: '*' - .. code-block:: xml - - - - - - - - - - * - - - - - section - - - - - * - - - - - .. code-block:: php // config/packages/framework.php @@ -666,26 +504,6 @@ element (even if the original one didn't contain a ``rel`` attribute): a: rel: noopener noreferrer - .. code-block:: xml - - - - - - - - - noopener noreferrer - - - - - .. code-block:: php // config/packages/framework.php @@ -744,41 +562,6 @@ URLs of ```` elements: # whether to allow relative links (i.e. URLs without scheme and host) allow_relative_links: true - .. code-block:: xml - - - - - - - - - - - http - https - mailto - - - symfony.com - - - - .. code-block:: php // config/packages/framework.php @@ -864,41 +647,6 @@ the HTML sanitizer: ``src``, ``href``, ``lowsrc``, ``background`` and ``ping``. # whether to allow relative URLs (i.e. URLs without scheme and host) allow_relative_medias: true - .. code-block:: xml - - - - - - - - - - - http - https - mailto - - - symfony.com - - - - .. code-block:: php // config/packages/framework.php @@ -971,27 +719,6 @@ increase or decrease this limit: # inputs longer (in characters) than this value will be truncated max_input_length: 30000 # default: 20000 - .. code-block:: xml - - - - - - - - - - 20000 - - - - - .. code-block:: php // config/packages/framework.php @@ -1047,27 +774,6 @@ to enable it for an HTML sanitizer: #without_attribute_sanitizers: # - App\Sanitizer\CustomAttributeSanitizer - .. code-block:: xml - - - - - - - - App\Sanitizer\CustomAttributeSanitizer - - - Symfony\Component\HtmlSanitizer\Visitor\AttributeSanitizer\UrlAttributeSanitizer - - - - .. code-block:: php // config/packages/framework.php diff --git a/http_cache.rst b/http_cache.rst index 1797219c649..2e9feefc945 100644 --- a/http_cache.rst +++ b/http_cache.rst @@ -79,26 +79,6 @@ Use the ``framework.http_cache`` option to enable the proxy for the framework: http_cache: true - .. code-block:: xml - - - - - - - - - - - - - .. code-block:: php // config/packages/framework.php diff --git a/http_cache/cache_invalidation.rst b/http_cache/cache_invalidation.rst index 394c79aed42..712023c18e9 100644 --- a/http_cache/cache_invalidation.rst +++ b/http_cache/cache_invalidation.rst @@ -114,24 +114,6 @@ Then, register the class as a service that :doc:`decorates - - - - - - - - - - - .. code-block:: php // config/services.php diff --git a/http_cache/esi.rst b/http_cache/esi.rst index 588cad424cd..28cfa411d5c 100644 --- a/http_cache/esi.rst +++ b/http_cache/esi.rst @@ -63,24 +63,6 @@ First, to use ESI, be sure to enable it in your application configuration: # ... esi: true - .. code-block:: xml - - - - - - - - - - - .. code-block:: php // config/packages/framework.php @@ -225,24 +207,6 @@ that must be enabled in your configuration: # ... fragments: { path: /_fragment } - .. code-block:: xml - - - - - - - - - - - .. code-block:: php // config/packages/framework.php diff --git a/http_cache/ssi.rst b/http_cache/ssi.rst index 8b280bf75a6..feb205d4e03 100644 --- a/http_cache/ssi.rst +++ b/http_cache/ssi.rst @@ -52,23 +52,6 @@ First, to use SSI, be sure to enable it in your application configuration: framework: ssi: { enabled: true } - .. code-block:: xml - - - - - - - - - - .. code-block:: php // config/packages/framework.php diff --git a/http_client.rst b/http_client.rst index 403c5fa6fef..a3a7ee538ec 100644 --- a/http_client.rst +++ b/http_client.rst @@ -99,24 +99,6 @@ You can configure the global options using the ``default_options`` option: default_options: max_redirects: 7 - .. code-block:: xml - - - - - - - - - - - - .. code-block:: php // config/packages/framework.php @@ -184,24 +166,6 @@ This option cannot be overridden per request: max_host_connections: 10 # ... - .. code-block:: xml - - - - - - - - - - - - .. code-block:: php // config/packages/framework.php @@ -252,39 +216,6 @@ autoconfigure the HTTP client based on the requested URL: Authorization: 'token %env(GITHUB_API_TOKEN)%' # ... - .. code-block:: xml - - - - - - - - - - application/vnd.github.v3+json - token %env(GITHUB_API_TOKEN)% - - - - - application/vnd.github.v3+json - token %env(GITHUB_API_TOKEN)% - - - - - .. code-block:: php // config/packages/framework.php @@ -421,33 +352,6 @@ each request (which overrides any global authentication): # Microsoft NTLM authentication auth_ntlm: 'the-username:the-password' - .. code-block:: xml - - - - - - - - - - - - - .. code-block:: php // config/packages/framework.php @@ -535,26 +439,6 @@ Use the ``headers`` option to define the default headers added to all requests: headers: 'User-Agent': 'My Fancy App' - .. code-block:: xml - - - - - - - - - My Fancy App - - - - - .. code-block:: php // config/packages/framework.php @@ -950,26 +834,6 @@ of your application: vars: - secret: 'secret-token' - .. code-block:: xml - - - - - - - - - secret-token - - - - - .. code-block:: php // config/packages/framework.php @@ -1106,24 +970,6 @@ To force HTTP/2 for ``http`` URLs, you need to enable it explicitly via the default_options: http_version: '2.0' - .. code-block:: xml - - - - - - - - - - - - .. code-block:: php // config/packages/framework.php @@ -1540,37 +1386,6 @@ installed in your application:: limit: 10 rate: { interval: '5 seconds', amount: 10 } - .. code-block:: xml - - - - - - - - - - - - - - - - - - - .. code-block:: php // config/packages/framework.php @@ -2174,35 +1989,6 @@ Then configure Symfony to use your callback: http_client: mock_response_factory: App\Tests\MockClientCallback - .. code-block:: xml - - - - - - - - - - - - - - - - - - - - - .. code-block:: php // config/packages/framework.php diff --git a/lock.rst b/lock.rst index 90881aa05fa..f175dcc7029 100644 --- a/lock.rst +++ b/lock.rst @@ -71,70 +71,6 @@ this behavior by using the ``lock`` key like: invoice: ['semaphore', 'redis://r2.docker'] report: 'semaphore' - .. code-block:: xml - - - - - - - - flock - - flock:///path/to/file - - semaphore - - memcached://m1.docker - - memcached://m1.docker - memcached://m2.docker - - redis://r1.docker - - redis://r1.docker - redis://r2.docker - - zookeeper://z1.docker - - zookeeper://z1.docker,z2.docker - - zookeeper://localhost01,localhost02:2181 - - sqlite:///%kernel.project_dir%/var/lock.db - - mysql:host=127.0.0.1;dbname=app - - pgsql:host=127.0.0.1;dbname=app - - pgsql+advisory:host=127.0.0.1;dbname=app - - sqlsrv:server=127.0.0.1;Database=app - - oci:host=127.0.0.1;dbname=app - - mongodb://127.0.0.1/app?collection=lock - - dynamodb://127.0.0.1/lock - - %env(LOCK_DSN)% - - - snc_redis.default - - - semaphore - redis://r2.docker - semaphore - - - - .. code-block:: php // config/packages/lock.php @@ -259,26 +195,6 @@ provides :ref:`named lock `: invoice: ['semaphore', 'redis://r2.docker'] report: 'semaphore' - .. code-block:: xml - - - - - - - - semaphore - redis://r2.docker - semaphore - - - - .. code-block:: php // config/packages/lock.php diff --git a/logging.rst b/logging.rst index e8c93335038..da40d8b6746 100644 --- a/logging.rst +++ b/logging.rst @@ -133,31 +133,6 @@ to write logs using the :phpfunction:`syslog` function: # log error-level messages and higher level: error - .. code-block:: xml - - - - - - - - - - - - - .. code-block:: php // config/packages/prod/monolog.php @@ -223,41 +198,6 @@ one of the messages reaches an ``action_level``. Take this example: type: syslog level: error - .. code-block:: xml - - - - - - - - - - - - - - - - - .. code-block:: php // config/packages/prod/monolog.php @@ -330,30 +270,6 @@ option of your handler to ``rotating_file``: # defaults to zero, which means infinite files max_files: 10 - .. code-block:: xml - - - - - - - - - - - .. code-block:: php // config/packages/prod/monolog.php diff --git a/logging/channels_handlers.rst b/logging/channels_handlers.rst index 3cac1d01ba5..38b59b93341 100644 --- a/logging/channels_handlers.rst +++ b/logging/channels_handlers.rst @@ -45,36 +45,6 @@ from the ``security`` channel. The following example does that only in the # ... # channels: ['!security'] - .. code-block:: xml - - - - - - - - - security - - - - - - - - - !security - - - - - .. code-block:: php // config/packages/prod/monolog.php @@ -141,24 +111,6 @@ You can also configure additional channels without the need to tag your services monolog: channels: ['foo', 'bar', 'foo_bar'] - .. code-block:: xml - - - - - - foo - bar - foo_bar - - - .. code-block:: php // config/packages/monolog.php diff --git a/logging/formatter.rst b/logging/formatter.rst index 6f2bfc7906c..e285fa65a55 100644 --- a/logging/formatter.rst +++ b/logging/formatter.rst @@ -21,28 +21,6 @@ configure your handler to use it: level: debug formatter: 'monolog.formatter.json' - .. code-block:: xml - - - - - - - - - - .. code-block:: php // config/packages/prod/monolog.php (and/or config/packages/dev/monolog.php) diff --git a/logging/handlers.rst b/logging/handlers.rst index eb2b1ac2c9c..5ed31f0745d 100644 --- a/logging/handlers.rst +++ b/logging/handlers.rst @@ -28,33 +28,6 @@ To use it, declare it as a service: $bubble: true $elasticsearchVersion: '1.0.0' - .. code-block:: xml - - - - - - - - - - - http://127.0.0.1:9200 - monolog - - Monolog\Level::Debug - true - 1.0.0 - - - - .. code-block:: php // config/services.php @@ -91,27 +64,6 @@ each log, an HTTP request will be made to push the log to Elasticsearch: type: service id: Symfony\Bridge\Monolog\Handler\ElasticsearchLogstashHandler - .. code-block:: xml - - - - - - - - - - .. code-block:: php // config/packages/prod/monolog.php @@ -145,32 +97,6 @@ even better performance and fault tolerance, a proper `ELK stack`_ is recommende type: service id: Symfony\Bridge\Monolog\Handler\ElasticsearchLogstashHandler - .. code-block:: xml - - - - - - - - - - - .. code-block:: php // config/packages/prod/monolog.php diff --git a/logging/monolog_console.rst b/logging/monolog_console.rst index 4d007abe854..e4f34688bdb 100644 --- a/logging/monolog_console.rst +++ b/logging/monolog_console.rst @@ -92,29 +92,6 @@ The Monolog console handler is enabled by default: # verbosity_levels: # VERBOSITY_NORMAL: NOTICE - .. code-block:: xml - - - - - - - - - - - !event - !doctrine - !console - - - - - .. code-block:: php // config/packages/dev/monolog.php diff --git a/logging/monolog_email.rst b/logging/monolog_email.rst index d52629e0797..a218deb0ffa 100644 --- a/logging/monolog_email.rst +++ b/logging/monolog_email.rst @@ -41,57 +41,6 @@ it is broken down. formatter: monolog.formatter.html content_type: text/html - .. code-block:: xml - - - - - - - - - - - - error@example.com - - - - - - - .. code-block:: php // config/packages/prod/monolog.php @@ -161,16 +110,6 @@ You can adjust the time period using the ``time`` option: time: 10 handler: symfony_mailer - .. code-block:: xml - - - - - - .. code-block:: php // config/packages/prod/monolog.php @@ -225,61 +164,6 @@ get logged on the server as well as the emails being sent: formatter: monolog.formatter.html content_type: text/html - .. code-block:: xml - - - - - - - - - - - - - - - error@example.com - - - - - - - .. code-block:: php // config/packages/prod/monolog.php diff --git a/logging/monolog_exclude_http_codes.rst b/logging/monolog_exclude_http_codes.rst index ee9fb16c01c..d2d2a0afb52 100644 --- a/logging/monolog_exclude_http_codes.rst +++ b/logging/monolog_exclude_http_codes.rst @@ -18,29 +18,6 @@ logging these HTTP codes based on the MonologBundle configuration: handler: ... excluded_http_codes: [403, 404, { 400: ['^/foo', '^/bar'] }] - .. code-block:: xml - - - - - - - - - ^/foo - ^/bar - - - - - - .. code-block:: php // config/packages/prod/monolog.php diff --git a/logging/processors.rst b/logging/processors.rst index 17044f229e0..719eedc968b 100644 --- a/logging/processors.rst +++ b/logging/processors.rst @@ -69,31 +69,6 @@ information: tags: - { name: monolog.processor } - .. code-block:: xml - - - - - - - - - [%%datetime%%] [%%extra.token%%] %%channel%%.%%level_name%%: %%message%% %%context%% %%extra%% - - - - - - - - .. code-block:: php // config/services.php @@ -123,29 +98,6 @@ Finally, set the formatter to be used on whatever handler you want: level: debug formatter: monolog.formatter.session_request - .. code-block:: xml - - - - - - - - - - .. code-block:: php // config/packages/prod/monolog.php @@ -235,25 +187,6 @@ the ``monolog.processor`` tag: tags: - { name: monolog.processor, handler: main } - .. code-block:: xml - - - - - - - - - - - - .. code-block:: php // config/services.php @@ -279,25 +212,6 @@ to the ``monolog.processor`` tag to only apply a processor for the given channel tags: - { name: monolog.processor, channel: 'app' } - .. code-block:: xml - - - - - - - - - - - - .. code-block:: php // config/services.php diff --git a/mailer.rst b/mailer.rst index 0d264f1a7d2..e2fc3b3195e 100644 --- a/mailer.rst +++ b/mailer.rst @@ -35,22 +35,6 @@ over SMTP by configuring the DSN in your ``.env`` file (the ``user``, mailer: dsn: '%env(MAILER_DSN)%' - .. code-block:: xml - - - - - - - - - - .. code-block:: php // config/packages/mailer.php @@ -790,32 +774,6 @@ and headers. Bcc: 'baz@example.com' X-Custom-Header: 'foobar' - .. code-block:: xml - - - - - - - - - - fabien@example.com - foo@example.com - bar@example.com - - Fabien <fabien@example.com> - baz@example.com - foobar - - - - .. code-block:: php // config/packages/mailer.php @@ -1045,24 +1003,6 @@ image files as usual. First, to simplify things, define a Twig namespace called # point this wherever your images live '%kernel.project_dir%/assets/images': images - .. code-block:: xml - - - - - - - - - %kernel.project_dir%/assets/images - - - .. code-block:: php // config/packages/twig.php @@ -1162,24 +1102,6 @@ called ``styles`` that points to the directory where ``email.css`` lives: # point this wherever your css files live '%kernel.project_dir%/assets/styles': styles - .. code-block:: xml - - - - - - - - - %kernel.project_dir%/assets/styles - - - .. code-block:: php // config/packages/twig.php @@ -1414,34 +1336,6 @@ minimizes repetition and centralizes your configuration for DKIM and S/MIME sign certificate: '%kernel.project_dir%/var/certificates/smime.crt' passphrase: '' - .. code-block:: xml - - - - - - - - - - file://%kernel.project_dir%/var/certificates/dkim.pem - symfony.com - s1 - - - %kernel.project_dir%/var/certificates/smime.pem - %kernel.project_dir%/var/certificates/smime.crt - - - - - - .. code-block:: php // config/packages/mailer.php @@ -1519,27 +1413,6 @@ encrypter that automatically applies to all outgoing messages: smime_encrypter: repository: App\Security\LocalFileCertificateRepository - .. code-block:: xml - - - - - - - - - - App\Security\LocalFileCertificateRepository - - - - - .. code-block:: php // config/packages/mailer.php @@ -1599,26 +1472,6 @@ This can be configured by replacing the ``dsn`` configuration entry with a main: '%env(MAILER_DSN)%' alternative: '%env(MAILER_DSN_IMPORTANT)%' - .. code-block:: xml - - - - - - - - - %env(MAILER_DSN)% - %env(MAILER_DSN_IMPORTANT)% - - - - .. code-block:: php // config/packages/mailer.php @@ -1671,28 +1524,6 @@ you have a transport called ``async``, you can route the message there: routing: 'Symfony\Component\Mailer\Messenger\SendEmailMessage': async - .. code-block:: xml - - - - - - - - %env(MESSENGER_TRANSPORT_DSN)% - - - - - - - .. code-block:: php // config/packages/messenger.php @@ -1748,26 +1579,6 @@ disable asynchronous delivery. mailer: message_bus: app.another_bus - .. code-block:: xml - - - - - - - - - - - .. code-block:: php // config/packages/mailer.php @@ -2036,23 +1847,6 @@ the mailer configuration file (e.g. in the ``dev`` or ``test`` environments): mailer: dsn: 'null://null' - .. code-block:: xml - - - - - - - - - - - .. code-block:: php // config/packages/mailer.php @@ -2086,27 +1880,6 @@ a specific address, instead of the *real* address: envelope: recipients: ['youremail@example.com'] - .. code-block:: xml - - - - - - - - - - youremail@example.com - - - - - .. code-block:: php // config/packages/mailer.php @@ -2139,30 +1912,6 @@ address(es) defined in ``recipients``, as with all other emails: # you can also use regular expression to define allowed recipients - 'internal-.*@example.(com|fr)' - .. code-block:: xml - - - - - - - - - - youremail@example.com - internal@example.com - - internal-.*@example.(com|fr) - - - - - .. code-block:: php // config/packages/mailer.php diff --git a/mercure.rst b/mercure.rst index 459a4f18297..40184b65c21 100644 --- a/mercure.rst +++ b/mercure.rst @@ -142,31 +142,6 @@ MercureBundle provides a more advanced configuration: factory: 'My\Factory' value: 'my.jwt' - .. code-block:: xml - - - - - - - https://example.com/foo1 - https://example.com/foo2 - https://example.com/bar1 - https://example.com/bar2 - - - - .. code-block:: php // config/packages/mercure.php @@ -552,19 +527,6 @@ Then, reference this service in the bundle configuration: jwt: provider: App\Mercure\MyTokenProvider - .. code-block:: xml - - - - - - - - - .. code-block:: php // config/packages/mercure.php diff --git a/messenger.rst b/messenger.rst index deca029a02f..e4eec319525 100644 --- a/messenger.rst +++ b/messenger.rst @@ -151,32 +151,6 @@ that uses this configuration: # dsn: "%env(MESSENGER_TRANSPORT_DSN)%" # options: [] - .. code-block:: xml - - - - - - - - %env(MESSENGER_TRANSPORT_DSN)% - - - - - - - - - .. code-block:: php // config/packages/messenger.php @@ -232,28 +206,6 @@ you can configure them to be sent to a transport: # async is whatever name you gave your transport above 'App\Message\SmsNotification': async - .. code-block:: xml - - - - - - - - - - - - - - - .. code-block:: php // config/packages/messenger.php @@ -272,13 +224,13 @@ matched under ``routing`` will still be handled immediately, i.e. synchronously. .. note:: - If you configure routing with both YAML/XML/PHP configuration files and + If you configure routing with both YAML/PHP configuration files and PHP attributes, the configuration always takes precedence over the class attribute. This behavior allows you to override routing on a per-environment basis. .. note:: - When configuring the routing in separate YAML/XML/PHP files, you can use a partial + When configuring the routing in separate YAML/PHP files, you can use a partial PHP namespace like ``'App\Message\*'`` to match all the messages within the matching namespace. The only requirement is that the ``'*'`` wildcard has to be placed at the end of the namespace. @@ -330,35 +282,6 @@ to multiple transports: 'My\Message\ToBeSentToTwoSenders': [async, audit] - .. code-block:: xml - - - - - - - - - - - - - - - - - - - - - - .. code-block:: php // config/packages/messenger.php @@ -464,31 +387,6 @@ transport and "sending" messages there to be handled immediately: routing: App\Message\SmsNotification: sync - .. code-block:: xml - - - - - - - - - - - - - - - - - - .. code-block:: php // config/packages/messenger.php @@ -648,41 +546,6 @@ different messages to them. For example: 'App\Message\SmsNotification': async_priority_low 'App\Message\NewUserWelcomeEmail': async_priority_high - .. code-block:: xml - - - - - - - - - - - Queue - - - - - - - - - - - - - - - - - .. code-block:: php // config/packages/messenger.php @@ -859,27 +722,6 @@ configuration option: - SIGINT - SIGUSR1 - .. code-block:: xml - - - - - - - - - SIGTERM - SIGINT - SIGUSR1 - - - - .. code-block:: php // config/packages/messenger.php @@ -1031,27 +873,6 @@ by setting its ``rate_limiter`` option: async: rate_limiter: your_rate_limiter_name - .. code-block:: xml - - - - - - - - - - - - - - .. code-block:: php // config/packages/messenger.php @@ -1107,27 +928,6 @@ this is configurable for each transport: # implements Symfony\Component\Messenger\Retry\RetryStrategyInterface # service: null - .. code-block:: xml - - - - - - - - - - - - - - .. code-block:: php // config/packages/messenger.php @@ -1216,28 +1016,6 @@ be discarded. To avoid this happening, you can instead configure a ``failure_tra failed: 'doctrine://default?queue_name=failed' - .. code-block:: xml - - - - - - - - - - - - - - - .. code-block:: php // config/packages/messenger.php @@ -1331,33 +1109,6 @@ override the failure transport for only specific transports: failed_default: 'doctrine://default?queue_name=failed_default' failed_high_priority: 'doctrine://default?queue_name=failed_high_priority' - .. code-block:: xml - - - - - - - - - - - - - - - - - - .. code-block:: php // config/packages/messenger.php @@ -1429,27 +1180,6 @@ options. Options can be passed to the transport via a DSN string or configuratio options: auto_setup: false - .. code-block:: xml - - - - - - - - - - - - - - .. code-block:: php // config/packages/messenger.php @@ -1943,25 +1673,6 @@ override it in the ``test`` environment to use this transport: transports: async_priority_normal: 'in-memory://' - .. code-block:: xml - - - - - - - - - - - - .. code-block:: php // config/packages/test/messenger.php @@ -2149,31 +1860,6 @@ this globally (or for each transport) to a service that implements dsn: # ... serializer: messenger.transport.symfony_serializer - .. code-block:: xml - - - - - - - - - - - - - - - - - - .. code-block:: php // config/packages/messenger.php @@ -2507,24 +2193,6 @@ with ``messenger.message_handler``. # only needed if can't be guessed by type-hint handles: App\Message\SmsNotification - .. code-block:: xml - - - - - - - - - - - - - .. code-block:: php // config/services.php @@ -2775,31 +2443,6 @@ Then, make sure to "route" your message to *both* transports: # ... 'App\Message\UploadedImage': [image_transport, async_priority_normal] - .. code-block:: xml - - - - - - - - - - - - - - - - - - .. code-block:: php // config/packages/messenger.php @@ -2984,36 +2627,6 @@ and a different instance will be created per bus. - 'App\Middleware\MyMiddleware' - 'App\Middleware\AnotherMiddleware' - .. code-block:: xml - - - - - - - - - - - - - messenger.bus.default - - - - - - - - - - .. code-block:: php // config/packages/messenger.php @@ -3078,37 +2691,6 @@ may want to use: # or pass a different entity manager to any #- doctrine_transaction: ['custom'] - .. code-block:: xml - - - - - - - - - - - - - - - - - - - - .. code-block:: php // config/packages/messenger.php @@ -3154,28 +2736,6 @@ to configure the validation groups. - router_context - validation - .. code-block:: xml - - - - - - - - - - - - - - - .. code-block:: php // config/packages/messenger.php @@ -3310,27 +2870,6 @@ transports: dsn: '%env(MY_TRANSPORT_DSN)%' serializer: 'App\Messenger\Serializer\MessageWithTokenDecoder' - .. code-block:: xml - - - - - - - - - - - - - - .. code-block:: php // config/packages/messenger.php @@ -3395,40 +2934,6 @@ an **event bus**. The event bus could have zero or more subscribers. middleware: - validation - .. code-block:: xml - - - - - - - - - - - - - - - - - - - - - - - - - .. code-block:: php // config/packages/messenger.php @@ -3483,22 +2988,6 @@ you can restrict each handler to a specific bus using the ``messenger.message_ha App\MessageHandler\SomeCommandHandler: tags: [{ name: messenger.message_handler, bus: command.bus }] - .. code-block:: xml - - - - - - - - - - - - .. code-block:: php // config/services.php @@ -3534,32 +3023,6 @@ you can determine the message bus based on an implemented interface: tags: - { name: messenger.message_handler, bus: query.bus } - .. code-block:: xml - - - - - - - - - - - - - - - - - - - - .. code-block:: php // config/services.php diff --git a/messenger/custom-transport.rst b/messenger/custom-transport.rst index 7d1698126d1..3afd9d914f1 100644 --- a/messenger/custom-transport.rst +++ b/messenger/custom-transport.rst @@ -146,22 +146,6 @@ Otherwise, add the following: Your\Transport\YourTransportFactory: tags: [messenger.transport_factory] - .. code-block:: xml - - - - - - - - - - - - .. code-block:: php // config/services.php @@ -186,25 +170,6 @@ named transport using your own DSN: transports: yours: 'my-transport://...' - .. code-block:: xml - - - - - - - - - - - - .. code-block:: php // config/packages/messenger.php diff --git a/notifier.rst b/notifier.rst index c359c79f477..83d75e9b25f 100644 --- a/notifier.rst +++ b/notifier.rst @@ -240,27 +240,6 @@ configure the ``texter_transports``: texter_transports: twilio: '%env(TWILIO_DSN)%' - .. code-block:: xml - - - - - - - - - %env(TWILIO_DSN)% - - - - - .. code-block:: php // config/packages/notifier.php @@ -412,27 +391,6 @@ Chatters are configured using the ``chatter_transports`` setting: chatter_transports: slack: '%env(SLACK_DSN)%' - .. code-block:: xml - - - - - - - - - %env(SLACK_DSN)% - - - - - .. code-block:: php // config/packages/notifier.php @@ -508,29 +466,6 @@ notification emails: envelope: sender: 'notifications@example.com' - .. code-block:: xml - - - - - - - - - - - - .. code-block:: php // config/packages/mailer.php @@ -599,27 +534,6 @@ configure the ``texter_transports``: texter_transports: expo: '%env(EXPO_DSN)%' - .. code-block:: xml - - - - - - - - - %env(EXPO_DSN)% - - - - - .. code-block:: php // config/packages/notifier.php @@ -669,27 +583,6 @@ need to add the following manually: texter_transports: jolinotif: '%env(JOLINOTIF)%' - .. code-block:: xml - - - - - - - - - %env(JOLINOTIF)% - - - - - .. code-block:: php // config/packages/notifier.php @@ -767,35 +660,6 @@ transport: # Send notifications to the next scheduled transport calculated by round robin roundrobin: '%env(SLACK_DSN)% && %env(TELEGRAM_DSN)%' - .. code-block:: xml - - - - - - - - - - %env(SLACK_DSN)% || %env(TELEGRAM_DSN)% - - - - - - - - .. code-block:: php // config/packages/notifier.php @@ -901,39 +765,6 @@ specify what channels should be used for specific levels (using medium: ['browser'] low: ['browser'] - .. code-block:: xml - - - - - - - - - - - - sms - chat/slack - email - - - chat/slack - - - browser - browser - - - - - .. code-block:: php // config/packages/notifier.php @@ -1080,19 +911,6 @@ typical alert levels, which you can implement immediately using: notifier.flash_message_importance_mapper: class: Symfony\Component\Notifier\FlashMessage\BootstrapFlashMessageImportanceMapper - .. code-block:: xml - - - - - - - - - .. code-block:: php // config/services.php diff --git a/page_creation.rst b/page_creation.rst index d7833b84bee..01c4ef41fe2 100644 --- a/page_creation.rst +++ b/page_creation.rst @@ -87,7 +87,7 @@ try it out by going to: http://localhost:8000/lucky/number Symfony recommends defining routes as attributes to have the controller code and its route configuration at the same location. However, if you prefer, you can - :doc:`define routes in separate files ` using YAML, XML and PHP formats. + :doc:`define routes in separate files ` using YAML and PHP formats. If you see a lucky number being printed back to you, congratulations! But before you run off to play the lottery, check out how this works. Remember the two steps diff --git a/performance.rst b/performance.rst index 9ec91958060..e1676edddb2 100644 --- a/performance.rst +++ b/performance.rst @@ -62,20 +62,6 @@ container into a single file, which could improve performance when using # ... .container.dumper.inline_factories: true - .. code-block:: xml - - - - - - - - true - - - .. code-block:: php // config/services.php @@ -242,20 +228,6 @@ in performance, you can stop generating the file as follows: # ... debug.container.dump: false - .. code-block:: xml - - - - - - - - false - - - .. code-block:: php // config/services.php diff --git a/profiler.rst b/profiler.rst index 7fc97c8ee33..0946d619269 100644 --- a/profiler.rst +++ b/profiler.rst @@ -163,20 +163,6 @@ create an alias pointing to the existing ``profiler`` service: services: Symfony\Component\HttpKernel\Profiler\Profiler: '@profiler' - .. code-block:: xml - - - - - - - - - - .. code-block:: php // config/services_dev.php @@ -230,22 +216,6 @@ toolbar to be refreshed after each AJAX request by enabling ``ajax_replace`` in toolbar: ajax_replace: true - .. code-block:: xml - - - - - - - - - - .. code-block:: php // config/packages/web_profiler.php @@ -561,28 +531,6 @@ you'll need to configure the data collector explicitly: # optional priority (positive or negative integer; default = 0) # priority: 300 - .. code-block:: xml - - - - - - - - - - - - - - - .. code-block:: php // config/services.php diff --git a/quick_tour/the_architecture.rst b/quick_tour/the_architecture.rst index 3b66570b3d3..c942c917a01 100644 --- a/quick_tour/the_architecture.rst +++ b/quick_tour/the_architecture.rst @@ -243,29 +243,6 @@ using the special ``when@`` keyword: router: strict_requirements: null - .. code-block:: xml - - - - - - - - - - - - - - - - .. code-block:: php // config/packages/framework.php diff --git a/rate_limiter.rst b/rate_limiter.rst index 578cd079e4c..5b6c1a28651 100644 --- a/rate_limiter.rst +++ b/rate_limiter.rst @@ -143,39 +143,6 @@ enforce different levels of service (free or paid): limit: 5000 rate: { interval: '15 minutes', amount: 500 } - .. code-block:: xml - - - - - - - - - - - - - - - - - .. code-block:: php // config/packages/rate_limiter.php @@ -451,33 +418,6 @@ You can use the ``cache_pool`` option to override the cache used by a specific l # use the "cache.anonymous_rate_limiter" cache pool cache_pool: 'cache.anonymous_rate_limiter' - .. code-block:: xml - - - - - - - - - - - - - - - .. code-block:: php // config/packages/rate_limiter.php @@ -530,41 +470,6 @@ at all): # or don't use any lock mechanism lock_factory: null - .. code-block:: xml - - - - - - - - - - - - - - - - - - .. code-block:: php // config/packages/rate_limiter.php @@ -607,42 +512,6 @@ You can configure multiple rate limiters to work together: policy: 'compound' limiters: [two_per_minute, five_per_hour] - .. code-block:: xml - - - - - - - - - - - - - two_per_minute - five_per_hour - - - - - .. code-block:: php // config/packages/rate_limiter.php diff --git a/reference/configuration/debug.rst b/reference/configuration/debug.rst index 6ca05b49bd7..70d47775b5d 100644 --- a/reference/configuration/debug.rst +++ b/reference/configuration/debug.rst @@ -17,12 +17,6 @@ key in your application configuration. # environment variables with their actual values $ php bin/console debug:config --resolve-env debug -.. note:: - - When using XML, you must use the ``http://symfony.com/schema/dic/debug`` - namespace and the related XSD schema is available at: - ``https://symfony.com/schema/dic/debug/debug-1.0.xsd`` - .. _configuration-debug-dump_destination: dump_destination @@ -45,20 +39,6 @@ Typically, you would set this to ``php://stderr``: debug: dump_destination: php://stderr - .. code-block:: xml - - - - - - - - .. code-block:: php // config/packages/debug.php diff --git a/reference/configuration/doctrine.rst b/reference/configuration/doctrine.rst index db6336e1ee6..8f521ed8034 100644 --- a/reference/configuration/doctrine.rst +++ b/reference/configuration/doctrine.rst @@ -14,19 +14,13 @@ configuration. # displays the actual config values used by your application $ php bin/console debug:config doctrine -.. note:: - - When using XML, you must use the ``http://symfony.com/schema/dic/doctrine`` - namespace and the related XSD schema is available at: - ``https://symfony.com/schema/dic/doctrine/doctrine-1.0.xsd`` - .. _`reference-dbal-configuration`: Doctrine DBAL Configuration --------------------------- DoctrineBundle supports all parameters that default Doctrine drivers -accept, converted to the XML or YAML naming standards that Symfony +accept, converted to the YAML or PHP naming standards that Symfony enforces. See the Doctrine `DBAL documentation`_ for more information. The following block shows all possible configuration keys: @@ -63,43 +57,6 @@ The following block shows all possible configuration keys: types: custom: App\DBAL\MyCustomType - .. code-block:: xml - - - - - - - - bar - string - App\DBAL\MyCustomType - - - - .. code-block:: php use Symfony\Config\DoctrineConfig; @@ -456,22 +413,6 @@ directory instead: type: xml dir: SomeResources/config/doctrine - .. code-block:: xml - - - - - - - - - - - .. code-block:: php use Symfony\Config\DoctrineConfig; @@ -510,28 +451,6 @@ namespace in the ``src/Entity`` directory and gives them an ``App`` alias prefix: App\Entity alias: App - .. code-block:: xml - - - - - - - - - - - .. code-block:: php use Symfony\Config\DoctrineConfig; @@ -605,30 +524,6 @@ set up the connection using environment variables for the certificate paths: # SSL CA authority !php/const 'PDO::MYSQL_ATTR_SSL_CA': '%env(MYSQL_SSL_CA)%' - .. code-block:: xml - - - - - - - - %env(MYSQL_SSL_KEY)% - %env(MYSQL_SSL_CERT)% - %env(MYSQL_SSL_CA)% - - - - .. code-block:: php // config/packages/doctrine.php diff --git a/reference/configuration/framework.rst b/reference/configuration/framework.rst index 71786e2bce7..78eb367e7ec 100644 --- a/reference/configuration/framework.rst +++ b/reference/configuration/framework.rst @@ -13,12 +13,6 @@ configured under the ``framework`` key in your application configuration. # displays the actual config values used by your application $ php bin/console debug:config framework -.. note:: - - When using XML, you must use the ``http://symfony.com/schema/dic/symfony`` - namespace and the related XSD schema is available at: - ``https://symfony.com/schema/dic/symfony/symfony-1.0.xsd`` - .. _reference-assets: assets @@ -46,22 +40,6 @@ This option allows you to prepend a base path to the URLs generated for assets: assets: base_path: '/images' - .. code-block:: xml - - - - - - - - - - .. code-block:: php // config/packages/framework.php @@ -99,22 +77,6 @@ collection each time it generates an asset's path: base_urls: - 'http://cdn.example.com/' - .. code-block:: xml - - - - - - - - - - .. code-block:: php // config/packages/framework.php @@ -171,34 +133,6 @@ package: # this package uses the global manifest (the default file is used) base_path: '/images' - .. code-block:: xml - - - - - - - - - - - - - - - - - - - .. code-block:: php // config/packages/framework.php @@ -298,26 +232,6 @@ You can group assets into packages, to specify different base URLs for them: avatars: base_urls: 'http://static_cdn.example.com/avatars' - .. code-block:: xml - - - - - - - - - - - - .. code-block:: php // config/packages/framework.php @@ -389,22 +303,6 @@ Now, activate the ``version`` option: assets: version: 'v2' - .. code-block:: xml - - - - - - - - - - .. code-block:: php // config/packages/framework.php @@ -505,34 +403,6 @@ individually for each asset package: # this package inherits the default strategy base_path: '/images' - .. code-block:: xml - - - - - - - - - - - - - - - - - .. code-block:: php // config/packages/framework.php @@ -663,29 +533,6 @@ To configure a Redis cache pool with a default lifetime of 1 hour, do the follow adapter: cache.adapter.redis default_lifetime: 3600 - .. code-block:: xml - - - - - - - - - - - - - .. code-block:: php // config/packages/framework.php @@ -832,22 +679,6 @@ can also :ref:`disable CSRF protection on individual forms - - - - - - - .. code-block:: php // config/packages/framework.php @@ -926,23 +757,6 @@ performance a bit: framework: enabled_locales: ['en', 'es'] - .. code-block:: xml - - - - - - - en - es - - - .. code-block:: php // config/packages/translation.php @@ -1027,22 +841,6 @@ You can also set ``esi`` to ``true`` to enable it: framework: esi: true - .. code-block:: xml - - - - - - - - - - .. code-block:: php // config/packages/framework.php @@ -1074,28 +872,6 @@ and HTTP status code applied to the exceptions that match the given exception cl status_code: 422 log_channel: 'custom_channel' - .. code-block:: xml - - - - - - - - - - - .. code-block:: php // config/packages/exceptions.php @@ -1405,26 +1181,6 @@ This service can be configured using ``framework.http_client.default_options``: headers: { 'X-Powered-By': 'ACME App' } max_redirects: 7 - .. code-block:: xml - - - - - - - - - ACME App - - - - - .. code-block:: php // config/packages/framework.php @@ -1469,24 +1225,6 @@ these options and can define a few others: auth_bearer: secret_bearer_token # ... - .. code-block:: xml - - - - - - - - - - - - .. code-block:: php // config/packages/framework.php @@ -1998,20 +1736,6 @@ doubling them to prevent Symfony from interpreting them as container parameters) framework: ide: 'myide://open?url=file://%%f&line=%%l' - .. code-block:: xml - - - - - - - - .. code-block:: php // config/packages/framework.php @@ -2107,24 +1831,6 @@ the name as key and DSN or service id as value: framework: lock: '%env(LOCK_DSN)%' - .. code-block:: xml - - - - - - - - %env(LOCK_DSN)% - - - - .. code-block:: php // config/packages/lock.php @@ -2183,26 +1889,6 @@ the `SMTP session`_. This value overrides any other recipient set in the code. envelope: recipients: ['admin@symfony.com', 'lead@symfony.com'] - .. code-block:: xml - - - - - - - - admin@symfony.com - lead@symfony.com - - - - - .. code-block:: php // config/packages/mailer.php @@ -2317,27 +2003,6 @@ This option also accepts a map of PHP errors to log levels: !php/const \E_ERROR: !php/const Psr\Log\LogLevel::CRITICAL !php/const \E_CORE_ERROR: !php/const Psr\Log\LogLevel::CRITICAL - .. code-block:: xml - - - - - - - - - - - - - .. code-block:: php // config/packages/framework.php @@ -2561,28 +2226,6 @@ To configure a ``jsonp`` format: formats: jsonp: 'application/javascript' - .. code-block:: xml - - - - - - - - - - application/javascript - - - - - .. code-block:: php // config/packages/framework.php @@ -2773,24 +2416,6 @@ the name as key and DSN or service id as value: framework: semaphore: '%env(SEMAPHORE_DSN)%' - .. code-block:: xml - - - - - - - - %env(SEMAPHORE_DSN)% - - - - .. code-block:: php // config/packages/semaphore.php @@ -2922,22 +2547,6 @@ Unlike the other session options, ``cache_limiter`` is set as a regular session.storage.options: cache_limiter: 0 - .. code-block:: xml - - - - - - - - 0 - - - - .. code-block:: php // config/services.php @@ -3045,22 +2654,6 @@ Whether to enable the session support in the framework. session: enabled: true - .. code-block:: xml - - - - - - - - - - .. code-block:: php // config/packages/framework.php @@ -3132,26 +2725,6 @@ and also to configure the session handler with a DSN: handler_id: '%env(DATABASE_URL)%' handler_id: 'file://%kernel.project_dir%/var/sessions' - .. code-block:: xml - - - - - - - - - - .. code-block:: php // config/packages/framework.php @@ -3229,22 +2802,6 @@ If ``null``, ``php.ini``'s `session.save_path`_ directive will be relied on: session: save_path: ~ - .. code-block:: xml - - - - - - - - - - .. code-block:: php // config/packages/framework.php @@ -3456,24 +3013,6 @@ the application won't respond and the user will receive a 400 response. framework: trusted_hosts: ['^example\.com$', '^example\.org$'] - .. code-block:: xml - - - - - - - ^example\.com$ - ^example\.org$ - - - - .. code-block:: php // config/packages/framework.php @@ -3535,29 +3074,6 @@ Defines the Doctrine entities that will be introspected to add 'App\Entity\': [] 'Foo\': ['Foo\Some\Entity', 'Foo\Another\Entity'] - .. code-block:: xml - - - - - - - - - - - Foo\Some\Entity - Foo\Another\Entity - - - - - .. code-block:: php // config/packages/framework.php @@ -3641,26 +3157,6 @@ the component will look for additional validation files: paths: - "%kernel.project_dir%/config/validation/" - .. code-block:: xml - - - - - - - - - %kernel.project_dir%/config/validation/ - - - - - .. code-block:: php // config/packages/framework.php @@ -3756,26 +3252,6 @@ A list of workflows to be created by the framework extension: my_workflow: # ... - .. code-block:: xml - - - - - - - - - - - - - .. code-block:: php // config/packages/workflow.php diff --git a/reference/configuration/kernel.rst b/reference/configuration/kernel.rst index b7596182906..0191b4924a8 100644 --- a/reference/configuration/kernel.rst +++ b/reference/configuration/kernel.rst @@ -138,20 +138,6 @@ achieve a strict reproducible build: # ... kernel.container_build_time: '1234567890' - .. code-block:: xml - - - - - - - - 1234567890 - - - .. code-block:: php // config/services.php diff --git a/reference/configuration/monolog.rst b/reference/configuration/monolog.rst index 9c781f4e1e4..d7259303a9d 100644 --- a/reference/configuration/monolog.rst +++ b/reference/configuration/monolog.rst @@ -13,12 +13,6 @@ in your application configuration. # displays the actual config values used by your application $ php bin/console debug:config monolog -.. note:: - - When using XML, you must use the ``http://symfony.com/schema/dic/monolog`` - namespace and the related XSD schema is available at: - ``https://symfony.com/schema/dic/monolog/monolog-1.0.xsd`` - .. tip:: For a full list of handler types and related configuration options, see diff --git a/reference/configuration/security.rst b/reference/configuration/security.rst index bad6136a71b..bf9ce2a6030 100644 --- a/reference/configuration/security.rst +++ b/reference/configuration/security.rst @@ -13,12 +13,6 @@ key in your application configuration. # displays the actual config values used by your application $ php bin/console debug:config security -.. note:: - - When using XML, you must use the ``http://symfony.com/schema/dic/security`` - namespace and the related XSD schema is available at: - ``https://symfony.com/schema/dic/services/services-1.0.xsd`` - **Basic Options**: * `access_denied_url`_ @@ -114,30 +108,6 @@ application: # the rest of options depend on the authentication mechanism # ... - .. code-block:: xml - - - - - - - - - - - - - - - - .. code-block:: php // config/packages/security.php @@ -375,30 +345,6 @@ user logs out: path: null domain: example.com - .. code-block:: xml - - - - - - - - - - - - - - - - - - - .. code-block:: php // config/packages/security.php @@ -446,29 +392,6 @@ It's also possible to use ``*`` as a wildcard for all directives: - cookies - storage - .. code-block:: xml - - - - - - - - - - - - cookies - storage - - - - - .. code-block:: php // config/packages/security.php @@ -597,27 +520,6 @@ The security configuration should be: username_path: security.credentials.login password_path: security.credentials.password - .. code-block:: xml - - - - - - - - - - - - .. code-block:: php // config/packages/security.php @@ -719,32 +621,6 @@ X.509 Authentication credentials: SSL_CLIENT_S_DN user_identifier: emailAddress - .. code-block:: xml - - - - - - - - - - - - - - - .. code-block:: php // config/packages/security.php @@ -810,26 +686,6 @@ Remote User Authentication provider: your_user_provider user: REMOTE_USER - .. code-block:: xml - - - - - - - - - - - - .. code-block:: php // config/packages/security.php @@ -889,28 +745,6 @@ multiple firewalls, the "context" could actually be shared: # ... context: my_context - .. code-block:: xml - - - - - - - - - - - - - - - .. code-block:: php // config/packages/security.php @@ -956,25 +790,6 @@ the session must not be used when authenticating users: # ... stateless: true - .. code-block:: xml - - - - - - - - - - - - .. code-block:: php // config/packages/security.php @@ -1008,25 +823,6 @@ session only if the application actually accesses the User object, (e.g. calling # ... lazy: true - .. code-block:: xml - - - - - - - - - - - - .. code-block:: php // config/packages/security.php @@ -1065,27 +861,6 @@ Firewalls can configure a list of required badges that must be present on the au # ... required_badges: ['CsrfTokenBadge', 'My\Badge'] - .. code-block:: xml - - - - - - - - - CsrfTokenBadge - My\Badge - - - - .. code-block:: php // config/packages/security.php diff --git a/reference/configuration/twig.rst b/reference/configuration/twig.rst index 420df13cdaa..6aede0b2ae6 100644 --- a/reference/configuration/twig.rst +++ b/reference/configuration/twig.rst @@ -13,12 +13,6 @@ under the ``twig`` key in your application configuration. # displays the actual config values used by your application $ php bin/console debug:config twig -.. note:: - - When using XML, you must use the ``http://symfony.com/schema/dic/twig`` - namespace and the related XSD schema is available at: - ``https://symfony.com/schema/dic/twig/twig-1.0.xsd`` - auto_reload ~~~~~~~~~~~ @@ -163,24 +157,6 @@ The value of this option can be a regular expression, a glob, or a string: file_name_pattern: ['*.twig', 'specific_file.html'] # ... - .. code-block:: xml - - - - - - - *.twig - specific_file.html - - - - .. code-block:: php // config/packages/twig.php @@ -214,24 +190,6 @@ all the forms of the application: form_themes: ['bootstrap_5_layout.html.twig', 'form/my_theme.html.twig'] # ... - .. code-block:: xml - - - - - - - bootstrap_5_layout.html.twig - form/my_theme.html.twig - - - - .. code-block:: php // config/packages/twig.php @@ -346,23 +304,6 @@ the directory defined in the :ref:`default_path option - - - - - email/default/templates - backend/templates - - - .. code-block:: php // config/packages/twig.php diff --git a/reference/configuration/web_profiler.rst b/reference/configuration/web_profiler.rst index 3c1b227d643..7c6085827fd 100644 --- a/reference/configuration/web_profiler.rst +++ b/reference/configuration/web_profiler.rst @@ -14,12 +14,6 @@ under the ``web_profiler`` key in your application configuration. # displays the actual config values used by your application $ php bin/console debug:config web_profiler -.. note:: - - When using XML, you must use the ``http://symfony.com/schema/dic/webprofiler`` - namespace and the related XSD schema is available at: - ``https://symfony.com/schema/dic/webprofiler/webprofiler-1.0.xsd`` - .. warning:: The web debug toolbar is not available for responses of type ``StreamedResponse``. diff --git a/reference/constraints/PasswordStrength.rst b/reference/constraints/PasswordStrength.rst index ff1fd650558..916a0d9a9d1 100644 --- a/reference/constraints/PasswordStrength.rst +++ b/reference/constraints/PasswordStrength.rst @@ -176,23 +176,6 @@ service to use your own estimator: Symfony\Component\Validator\Constraints\PasswordStrengthValidator: arguments: [!closure '@custom_password_strength_estimator'] - .. code-block:: xml - - - - - - - - - - - - - - .. code-block:: php // config/services.php diff --git a/reference/dic_tags.rst b/reference/dic_tags.rst index 866aac5774f..08915d26417 100644 --- a/reference/dic_tags.rst +++ b/reference/dic_tags.rst @@ -41,21 +41,6 @@ The name of the package is set in this order: tags: - { name: assets.package, package: avatars } - .. code-block:: xml - - - - - - - - - - - .. code-block:: php use App\Assets\AvatarPackage; @@ -91,24 +76,6 @@ services: app.sqlite_lock: class: App\Lock\SqliteLock - .. code-block:: xml - - - - - - - - - - - .. code-block:: php // config/services.php @@ -149,28 +116,6 @@ the generic ``app.lock`` service can be defined as follows: tags: - { name: auto_alias, format: "app.%database_type%_lock" } - .. code-block:: xml - - - - - - - - - - - - - - - .. code-block:: php // config/services.php @@ -246,21 +191,6 @@ Add this tag to a service and its class won't be preloaded when using App\SomeNamespace\SomeService: tags: ['container.no_preload'] - .. code-block:: xml - - - - - - - - - - - .. code-block:: php use App\SomeNamespace\SomeService; @@ -297,23 +227,6 @@ is restarted): - { name: 'container.preload', class: 'App\Some\OtherClass' } # ... - .. code-block:: xml - - - - - - - - - - - - - .. code-block:: php use App\Some\OtherClass; @@ -434,21 +347,6 @@ can also register it manually: App\Cache\MyClearer: tags: [kernel.cache_clearer] - .. code-block:: xml - - - - - - - - - - - .. code-block:: php use App\Cache\MyClearer; @@ -530,21 +428,6 @@ can also register it manually: tags: - { name: kernel.cache_warmer, priority: 0 } - .. code-block:: xml - - - - - - - - - - - .. code-block:: php use App\Cache\MyCustomWarmer; @@ -660,21 +543,6 @@ can also register it manually: App\Locale\MyCustomLocaleHandler: tags: [kernel.locale_aware] - .. code-block:: xml - - - - - - - - - - - .. code-block:: php use App\Locale\MyCustomLocaleHandler; @@ -731,22 +599,6 @@ channel when injecting the logger in a service. tags: - { name: monolog.logger, channel: app } - .. code-block:: xml - - - - - - - - - - - - .. code-block:: php use App\Log\CustomLogger; @@ -786,21 +638,6 @@ You can add a processor globally: Monolog\Processor\IntrospectionProcessor: tags: [monolog.processor] - .. code-block:: xml - - - - - - - - - - - .. code-block:: php use Monolog\Processor\IntrospectionProcessor; @@ -827,21 +664,6 @@ attribute: tags: - { name: monolog.processor, handler: firephp } - .. code-block:: xml - - - - - - - - - - - .. code-block:: php use Monolog\Processor\IntrospectionProcessor; @@ -864,21 +686,6 @@ You can also add a processor for a specific logging channel by using the tags: - { name: monolog.processor, channel: security } - .. code-block:: xml - - - - - - - - - - - .. code-block:: php use Monolog\Processor\IntrospectionProcessor; @@ -909,21 +716,6 @@ of your configuration and tag it with ``routing.loader``: App\Routing\CustomLoader: tags: [routing.loader] - .. code-block:: xml - - - - - - - - - - - .. code-block:: php use App\Routing\CustomLoader; @@ -1017,21 +809,6 @@ Now, register your loader as a service and tag it with ``translation.loader``: tags: - { name: translation.loader, alias: bin } - .. code-block:: xml - - - - - - - - - - - .. code-block:: php use App\Translation\MyCustomLoader; @@ -1117,21 +894,6 @@ required option: ``alias``, which defines the name of the extractor:: tags: - { name: translation.extractor, alias: foo } - .. code-block:: xml - - - - - - - - - - - .. code-block:: php use App\Translation\CustomExtractor; @@ -1174,21 +936,6 @@ This is the name that's used to determine which dumper should be used. tags: - { name: translation.dumper, alias: json } - .. code-block:: xml - - - - - - - - - - - .. code-block:: php use App\Translation\JsonFileDumper; @@ -1215,21 +962,6 @@ must register your factory as a service and tag it with ``translation.provider_f tags: - { name: translation.provider_factory } - .. code-block:: xml - - - - - - - - - - - .. code-block:: php use App\Translation\CustomProviderFactory; @@ -1265,25 +997,6 @@ the service is auto-registered and auto-tagged. But, you can also register it ma App\Twig\AnotherExtension: tags: [{ name: twig.extension, priority: -100 }] - .. code-block:: xml - - - - - - - - - - - - - - - .. code-block:: php use App\Twig\AnotherExtension; @@ -1324,21 +1037,6 @@ also register it manually: tags: - { name: twig.loader, priority: 0 } - .. code-block:: xml - - - - - - - - - - - .. code-block:: php use App\Twig\CustomLoader; @@ -1373,21 +1071,6 @@ the service is auto-registered and auto-tagged. But, you can also register it ma App\Twig\AppExtension: tags: [twig.runtime] - .. code-block:: xml - - - - - - - - - - - .. code-block:: php use App\Twig\AppExtension; diff --git a/routing.rst b/routing.rst index 16d69c694cf..04f9ca76aa6 100644 --- a/routing.rst +++ b/routing.rst @@ -12,7 +12,7 @@ provides other useful features, like generating SEO-friendly URLs (e.g. Creating Routes --------------- -Routes can be configured in YAML, XML, PHP or using attributes. +Routes can be configured in YAML, PHP or using attributes. All formats provide the same features and performance, so choose your favorite. :ref:`Symfony recommends attributes ` @@ -91,15 +91,15 @@ The route name (``blog_list``) is not important for now, but it will be essential later when :ref:`generating URLs `. You only have to keep in mind that each route name must be unique in the application. -Creating Routes in YAML, XML or PHP Files -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Creating Routes in YAML or PHP Files +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Instead of defining routes in the controller classes, you can define them in a -separate YAML, XML or PHP file. The main advantage is that they don't require +separate YAML or PHP file. The main advantage is that they don't require any extra dependency. The main drawback is that you have to work with multiple files when checking the routing of some controller action. -The following example shows how to define in YAML/XML/PHP a route called +The following example shows how to define in YAML or PHP a route called ``blog_list`` that associates the ``/blog`` URL with the ``list()`` action of the ``BlogController``: @@ -117,24 +117,6 @@ the ``BlogController``: # controller class, you can skip the '::method_name' part: # controller: App\Controller\BlogController - .. code-block:: xml - - - - - - - - - - - .. code-block:: php // config/routes.php @@ -152,12 +134,6 @@ the ``BlogController``: ; }; -.. note:: - - By default, Symfony loads the routes defined in both YAML and PHP formats. - If you define routes in XML format, you need to - :ref:`update the src/Kernel.php file `. - .. _routing-matching-http-methods: Matching HTTP Methods @@ -205,24 +181,6 @@ Use the ``methods`` option to restrict the verbs each route should respond to: controller: App\Controller\BlogApiController::edit methods: PUT - .. code-block:: xml - - - - - - - - - - .. code-block:: php // config/routes.php @@ -291,20 +249,6 @@ given value: path: /tools controller: App\Controller\DefaultController::developerTools - .. code-block:: xml - - - - - - - - - - .. code-block:: php // config/routes.php @@ -382,29 +326,6 @@ arbitrary matching logic: # expressions can retrieve route parameter values using the "params" variable condition: "params['id'] < 1000" - .. code-block:: xml - - - - - - - context.getMethod() in ['GET', 'HEAD'] and request.headers.get('User-Agent') matches '/firefox/i' - - - - - - - - - params['id'] < 1000 - - - .. code-block:: php // config/routes.php @@ -588,19 +509,6 @@ For example, the route to display the blog post contents is defined as ``/blog/{ path: /blog/{slug} controller: App\Controller\BlogController::show - .. code-block:: xml - - - - - - - - .. code-block:: php // config/routes.php @@ -674,23 +582,6 @@ the ``{page}`` parameter using the ``requirements`` option: path: /blog/{slug} controller: App\Controller\BlogController::show - .. code-block:: xml - - - - - - - \d+ - - - - - .. code-block:: php // config/routes.php @@ -815,21 +706,6 @@ concise, but it can decrease route readability when requirements are complex: path: /blog/{page<\d+>} controller: App\Controller\BlogController::list - .. code-block:: xml - - - - - - - - - - .. code-block:: php // config/routes.php @@ -889,24 +765,6 @@ other configuration formats they are defined with the ``defaults`` option: blog_show: # ... - .. code-block:: xml - - - - - - - 1 - - \d+ - - - - - .. code-block:: php // config/routes.php @@ -971,21 +829,6 @@ parameter: path: /blog/{page<\d+>?1} controller: App\Controller\BlogController::list - .. code-block:: xml - - - - - - - - - - .. code-block:: php // config/routes.php @@ -1010,10 +853,10 @@ Priority Parameter Symfony evaluates routes in the order they are defined. If the path of a route matches many different patterns, it might prevent other routes from being -matched. In YAML and XML you can move the route definitions up or down in the -configuration file to control their priority. In routes defined as PHP -attributes this is much harder to do, so you can set the -optional ``priority`` parameter in those routes to control their priority: +matched. In YAML or PHP config files you can move the route definitions up or +down in the configuration file to control their priority. In routes defined as +PHP attributes this is much harder to do, so you can set the optional +``priority`` parameter in those routes to control their priority: .. configuration-block:: @@ -1207,27 +1050,6 @@ and in route imports. Symfony defines some special attributes with the same name _locale: en|fr _format: html|xml - .. code-block:: xml - - - - - - - - en|fr - html|xml - - - - .. code-block:: php // config/routes.php @@ -1285,21 +1107,6 @@ the controllers of the routes: page: 1 title: "Hello world!" - .. code-block:: xml - - - - - - - 1 - Hello world! - - - .. code-block:: php // config/routes.php @@ -1357,20 +1164,6 @@ A possible solution is to change the parameter requirements to be more permissiv requirements: token: .+ - .. code-block:: xml - - - - - - - .+ - - - .. code-block:: php // config/routes.php @@ -1438,18 +1231,6 @@ have been renamed. Let's say you have a route called ``product_show``: path: /product/{id} controller: App\Controller\ProductController::show - .. code-block:: xml - - - - - - - - .. code-block:: php // config/routes.php @@ -1497,20 +1278,6 @@ Instead of duplicating the original route, you can create an alias for it. # "alias" option refers to the name of the route declared above alias: product_show - .. code-block:: xml - - - - - - - - - - .. code-block:: php // config/routes.php @@ -1528,7 +1295,7 @@ be used in the application and will produce the same result. .. note:: - YAML, XML, and PHP configuration formats are the only ways to define an alias + YAML and PHP configuration formats are the only ways to define an alias for a route that you do not own. You can't do this when using PHP attributes. This allows you for example to use your own route name for URL generation, @@ -1617,32 +1384,6 @@ This way, the ``product_show`` alias could be deprecated. version: '1.2' message: 'The "%alias_id%" route alias is deprecated. Please use "product_details" instead.' - .. code-block:: xml - - - - - - - - - - - - - - - - - The "%alias_id%" route alias is deprecated. Please use "product_details" instead. - - - - .. code-block:: php $routes->add('product_details', '/product/{id}') @@ -1733,39 +1474,6 @@ when importing the routes. # (the value must be a string or an array of PHP glob patterns) # exclude: '../../src/Controller/{Debug*Controller.php}' - .. code-block:: xml - - - - - - - - - en|es|fr - - - - - - - - .. code-block:: php // config/routes/attributes.php @@ -1828,25 +1536,6 @@ defined in the class attribute. trailing_slash_on_root: false # ... - .. code-block:: xml - - - - - - - - - - .. code-block:: php // config/routes/attributes.php @@ -1954,40 +1643,6 @@ Use the ``RedirectController`` to redirect to other routes and URLs: path: 'https://legacy.example.com/doc' permanent: true - .. code-block:: xml - - - - - - - doc_page - - index - current - - true - - true - - true - - - - - https://legacy.example.com/doc - - true - - - .. code-block:: php // config/routes.php @@ -2097,23 +1752,6 @@ host name: path: / controller: App\Controller\MainController::homepage - .. code-block:: xml - - - - - - - - - - .. code-block:: php // config/routes.php @@ -2182,26 +1820,6 @@ multi-tenant applications) and these parameters can be validated too with path: / controller: App\Controller\MainController::homepage - .. code-block:: xml - - - - - - - m - m|mobile - - - - - .. code-block:: php // config/routes.php @@ -2294,21 +1912,6 @@ avoids the need for duplicating routes, which also reduces the potential bugs: nl: /over-ons controller: App\Controller\CompanyController::about - .. code-block:: xml - - - - - - - /about-us - /over-ons - - - .. code-block:: php // config/routes.php @@ -2354,22 +1957,6 @@ with a locale. This can be done by defining a different prefix for each locale en: '' # don't prefix URLs for English, the default locale nl: '/nl' - .. code-block:: xml - - - - - - - - - /nl - - - .. code-block:: php // config/routes/attributes.php @@ -2411,20 +1998,6 @@ locale. en: 'www.example.com' nl: 'www.example.nl' - .. code-block:: xml - - - - - - www.example.com - www.example.nl - - - .. code-block:: php // config/routes/attributes.php @@ -2479,17 +2052,6 @@ session shouldn't be used when matching a request: path: / stateless: true - .. code-block:: xml - - - - - - - .. code-block:: php // config/routes.php @@ -2708,25 +2270,6 @@ The solution is to configure the ``default_uri`` option to define the # ... default_uri: 'https://example.org/my/path/' - .. code-block:: xml - - - - - - - - - - - - .. code-block:: php // config/packages/routing.php @@ -2832,22 +2375,6 @@ method) or globally with these configuration parameters: router.request_context.scheme: 'https' asset.request_context.secure: true - .. code-block:: xml - - - - - - - https - true - - - - .. code-block:: php // config/services.php @@ -2887,19 +2414,6 @@ each route explicitly: controller: App\Controller\SecurityController::login schemes: [https] - .. code-block:: xml - - - - - - - - - .. code-block:: php // config/routes.php @@ -2945,18 +2459,6 @@ defined as attributes: type: attribute schemes: [https] - .. code-block:: xml - - - - - - - - .. code-block:: php // config/routes/attributes.php diff --git a/routing/custom_route_loader.rst b/routing/custom_route_loader.rst index b41057a81ed..600dd3c3760 100644 --- a/routing/custom_route_loader.rst +++ b/routing/custom_route_loader.rst @@ -4,8 +4,8 @@ How to Create a custom Route Loader Basic applications can define all their routes in a single configuration file - usually ``config/routes.yaml`` (see :ref:`routing-creating-routes`). However, in most applications it's common to import routes definitions from -different resources: PHP attributes in controller files, YAML, XML -or PHP files stored in some directory, etc. +different resources: PHP attributes in controller files, YAML or PHP files +stored in some directory, etc. Built-in Route Loaders ---------------------- @@ -39,45 +39,15 @@ Symfony provides several route loaders for the most common needs: type: attribute app_directory: - # loads routes from the YAML, XML or PHP files found in that directory + # loads routes from the YAML or PHP files found in that directory resource: '../legacy/routing/' type: directory app_bundle: - # loads routes from the YAML, XML or PHP files found in some bundle directory + # loads routes from the YAML or PHP files found in some bundle directory resource: '@AcmeOtherBundle/Resources/config/routing/' type: directory - .. code-block:: xml - - - - - - - - - - - - - - - - - - - - - - - - - - .. code-block:: php // config/routes.php @@ -101,10 +71,10 @@ Symfony provides several route loaders for the most common needs: // loads routes from the PHP attributes (#[Route(...)]) of the given class $routes->import('App\Controller\MyController', 'attribute'); - // loads routes from the YAML or XML files found in that directory + // loads routes from the YAML or PHP files found in that directory $routes->import('../legacy/routing/', 'directory'); - // loads routes from the YAML or XML files found in some bundle directory + // loads routes from the YAML or PHP files found in some bundle directory $routes->import('@AcmeOtherBundle/Resources/config/routing/', 'directory'); }; @@ -149,18 +119,6 @@ Take these lines from the ``routes.yaml``: resource: ../src/Controller/ type: attribute - .. code-block:: xml - - - - - - - - .. code-block:: php // config/routes.php @@ -181,8 +139,7 @@ containing :class:`Symfony\\Component\\Routing\\Route` objects. .. note:: Routes loaded this way will be cached by the Router the same way as - when they are defined in one of the default formats (e.g. XML, YAML, - PHP file). + when they are defined in one of the default formats (e.g. YAML, PHP files). Loading Routes with a Custom Service ------------------------------------ @@ -203,18 +160,6 @@ and configure the service and method to call: resource: 'admin_route_loader::loadRoutes' type: service - .. code-block:: xml - - - - - - - - .. code-block:: php // config/routes.php @@ -248,7 +193,7 @@ Creating a custom Loader ------------------------ To load routes from some custom source (i.e. from something other than attributes, -YAML or XML files), you need to create a custom route loader. This loader +YAML or PHP files), you need to create a custom route loader. This loader has to implement :class:`Symfony\\Component\\Config\\Loader\\LoaderInterface`. In most cases it is easier to extend from @@ -334,24 +279,6 @@ Now define a service for the ``ExtraLoader``: App\Routing\ExtraLoader: tags: [routing.loader] - .. code-block:: xml - - - - - - - - - - - - - - .. code-block:: php // config/services.php @@ -387,18 +314,6 @@ What remains to do is adding a few lines to the routing configuration: resource: . type: extra - .. code-block:: xml - - - - - - - - .. code-block:: php // config/routes.php @@ -467,7 +382,7 @@ configuration file - you can call the The resource name and type of the imported routing configuration can be anything that would normally be supported by the routing configuration - loader (YAML, XML, PHP, attribute, etc.). + loader (YAML, PHP, attribute, etc.). .. note:: diff --git a/security.rst b/security.rst index 945701d2b2b..ff87c9ea967 100644 --- a/security.rst +++ b/security.rst @@ -239,27 +239,6 @@ for a user provider in your security configuration: class: App\Entity\User property: email - .. code-block:: xml - - - - - - - - - - - - - - .. code-block:: php // config/packages/security.php @@ -370,26 +349,6 @@ have done this for you: # possible hashing algorithm (which currently is "bcrypt") Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: 'auto' - .. code-block:: xml - - - - - - - - - - - - .. code-block:: php // config/packages/security.php @@ -500,39 +459,6 @@ will be able to authenticate (e.g. login form, API token, etc). # https://symfony.com/doc/current/security/impersonating_user.html # switch_user: true - .. code-block:: xml - - - - - - - - - - - - - - - - - - - - - .. code-block:: php // config/packages/security.php @@ -613,8 +539,6 @@ don't accidentally block Symfony's dev tools - which live under URLs like // ... }; - This feature is not supported by the XML configuration format. - A firewall can have many modes of authentication, in other words, it enables many ways to ask the question "Who are you?". Often, the user is unknown (i.e. not logged in) when they first visit your website. If you visit your homepage right now, you *will* @@ -771,27 +695,6 @@ Then, enable the ``FormLoginAuthenticator`` using the ``form_login`` setting: login_path: app_login check_path: app_login - .. code-block:: xml - - - - - - - - - - - - - - .. code-block:: php // config/packages/security.php @@ -954,28 +857,6 @@ First, you need to enable CSRF on the form login: # ... enable_csrf: true - .. code-block:: xml - - - - - - - - - - - - - - - .. code-block:: php // config/packages/security.php @@ -1046,26 +927,6 @@ Enable the authenticator using the ``json_login`` setting: # api_login is a route we will create below check_path: api_login - .. code-block:: xml - - - - - - - - - - - - - .. code-block:: php // config/packages/security.php @@ -1214,26 +1075,6 @@ authentication: http_basic: realm: Secured Area - .. code-block:: xml - - - - - - - - - - - - - .. code-block:: php // config/packages/security.php @@ -1359,28 +1200,6 @@ Then, enable the X.509 authenticator using ``x509`` on your firewall: x509: provider: your_user_provider - .. code-block:: xml - - - - - - - - - - - - - - - .. code-block:: php // config/packages/security.php @@ -1430,25 +1249,6 @@ Enable remote user authentication using the ``remote_user`` key: remote_user: provider: your_user_provider - .. code-block:: xml - - - - - - - - - - - - .. code-block:: php // config/packages/security.php @@ -1508,34 +1308,6 @@ Then, enable this feature using the ``login_throttling`` setting: login_throttling: limiter: app.my_login_rate_limiter - .. code-block:: xml - - - - - - - - - - - - - - - - - - - .. code-block:: php // config/packages/security.php @@ -1618,61 +1390,6 @@ and set the ``limiter`` option to its service ID: login_throttling: limiter: app.login_rate_limiter - .. code-block:: xml - - - - - - - - - - - - - - - - - - - - - - - - - %kernel.secret% - - - - - - - - - - - .. code-block:: php // config/packages/security.php @@ -1798,31 +1515,6 @@ To enable logging out, activate the ``logout`` config parameter under your fire # where to redirect after logout # target: app_any_route - .. code-block:: xml - - - - - - - - - - - - - - - - .. code-block:: php // config/packages/security.php @@ -1861,18 +1553,6 @@ you have imported the logout route loader in your routes: resource: security.route_loader.logout type: service - .. code-block:: xml - - - - - - - - .. code-block:: php // config/routes/security.php @@ -1977,21 +1657,6 @@ current locale). In that case, you have to create this route yourself: fr: /deconnexion methods: GET - .. code-block:: xml - - - - - - - /logout - /deconnexion - - - .. code-block:: php // config/routes.php @@ -2022,27 +1687,6 @@ Then, pass the route name to the ``path`` option: logout: path: app_logout - .. code-block:: xml - - - - - - - - - - - - - - .. code-block:: php // config/packages/security.php @@ -2201,26 +1845,6 @@ rules by creating a role hierarchy: ROLE_ADMIN: ROLE_USER ROLE_SUPER_ADMIN: [ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH] - .. code-block:: xml - - - - - - - - - ROLE_USER - ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH - - - .. code-block:: php // config/packages/security.php @@ -2302,40 +1926,6 @@ start with ``/admin``, you can: # (this one will match URLs like /api/post/7298 and /api/comment/528491) - { path: ^/api/(post|comment)/\d+$, roles: ROLE_USER } - .. code-block:: xml - - - - - - - - - - - - - - - - - - ROLE_ADMIN - IS_AUTHENTICATED_FULLY - - - - - - - .. code-block:: php // config/packages/security.php @@ -2385,26 +1975,6 @@ the list and stops when it finds the first match: # matches /admin/* except for anything matching the above rule - { path: '^/admin', roles: ROLE_ADMIN } - .. code-block:: xml - - - - - - - - - - - - - .. code-block:: php // config/packages/security.php @@ -2711,31 +2281,6 @@ the login page): # but require authentication for all other admin routes - { path: ^/admin, roles: ROLE_ADMIN } - .. code-block:: xml - - - - - - - - - - - - - - - - - - .. code-block:: php // config/packages/security.php @@ -2930,26 +2475,6 @@ for these events. - name: kernel.event_subscriber dispatcher: security.event_dispatcher.main - .. code-block:: xml - - - - - - - - - - - - - - .. code-block:: php // config/services.php diff --git a/security/access_control.rst b/security/access_control.rst index 8e62e8a84c7..3bece6b7210 100644 --- a/security/access_control.rst +++ b/security/access_control.rst @@ -62,48 +62,6 @@ Take the following ``access_control`` entries as an example: - { attributes: {'_route': 'admin'}, roles: ROLE_ADMIN } - { route: 'admin', roles: ROLE_ADMIN } - .. code-block:: xml - - - - - - - 10.0.0.1, 10.0.0.2 - - - - - - - - - - - - - 127.0.0.1 - ::1 - %env(TRUSTED_IPS)% - - - - - - - - admin - - - - - .. code-block:: php // config/packages/security.php @@ -292,31 +250,6 @@ pattern so that it is only accessible by requests from the local server itself: - { path: '^/internal', roles: PUBLIC_ACCESS, ips: [127.0.0.1, ::1, 192.168.0.1/24] } - { path: '^/internal', roles: ROLE_NO_ACCESS } - .. code-block:: xml - - - - - - - - - - - 127.0.0.1 - ::1 - - - - - - .. code-block:: php // config/packages/security.php @@ -383,28 +316,6 @@ key: roles: 'ROLE_ADMIN' allow_if: "'127.0.0.1' == request.getClientIp() or request.headers.has('X-Secure-Access')" - .. code-block:: xml - - - - - - - - - - - - .. code-block:: php // config/packages/security.php @@ -462,27 +373,6 @@ access those URLs via a specific port. This could be useful for example for access_control: - { path: ^/cart/checkout, roles: PUBLIC_ACCESS, port: 8080 } - .. code-block:: xml - - - - - - - - - - - .. code-block:: php // config/packages/security.php @@ -516,27 +406,6 @@ the user will be redirected to ``https``: access_control: - { path: ^/cart/checkout, roles: PUBLIC_ACCESS, requires_channel: https } - .. code-block:: xml - - - - - - - - - - - .. code-block:: php // config/packages/security.php diff --git a/security/access_denied_handler.rst b/security/access_denied_handler.rst index 37490e3120b..94c77479441 100644 --- a/security/access_denied_handler.rst +++ b/security/access_denied_handler.rst @@ -64,25 +64,6 @@ Now, configure this service ID as the entry point for the firewall: # ... entry_point: App\Security\AuthenticationEntryPoint - .. code-block:: xml - - - - - - - - - - - - .. code-block:: php // config/packages/security.php @@ -140,25 +121,6 @@ configure it under your firewall: # ... access_denied_handler: App\Security\AccessDeniedHandler - .. code-block:: xml - - - - - - - - - - - - .. code-block:: php // config/packages/security.php diff --git a/security/access_token.rst b/security/access_token.rst index 836fd75c887..7b2e753e5c3 100644 --- a/security/access_token.rst +++ b/security/access_token.rst @@ -39,25 +39,6 @@ digital signature, etc.). access_token: token_handler: App\Security\AccessTokenHandler - .. code-block:: xml - - - - - - - - - - - - .. code-block:: php // config/packages/security.php @@ -164,31 +145,6 @@ You can also create a custom extractor. The class must implement # or provide the service ID of a custom extractor token_extractors: 'App\Security\CustomTokenExtractor' - .. code-block:: xml - - - - - - - - - - request_body - - - App\Security\CustomTokenExtractor - - - - - .. code-block:: php // config/packages/security.php @@ -226,28 +182,6 @@ important**: the first in the list is called first. - 'header' - 'App\Security\CustomTokenExtractor' - .. code-block:: xml - - - - - - - - - header - App\Security\CustomTokenExtractor - - - - - .. code-block:: php // config/packages/security.php @@ -301,27 +235,6 @@ and configure the service ID as the ``success_handler``: token_handler: App\Security\AccessTokenHandler success_handler: App\Security\Authentication\AuthenticationSuccessHandler - .. code-block:: xml - - - - - - - - - - - - .. code-block:: php // config/packages/security.php @@ -377,27 +290,6 @@ and retrieve the user info: token_handler: oidc_user_info: https://www.example.com/realms/demo/protocol/openid-connect/userinfo - .. code-block:: xml - - - - - - - - - - - - - - .. code-block:: php // config/packages/security.php @@ -436,31 +328,6 @@ Next, configure the ``base_uri`` and ``discovery`` options: discovery: cache: cache.app - .. code-block:: xml - - - - - - - - - - - - - - - - - - .. code-block:: php // config/packages/security.php @@ -494,29 +361,6 @@ identifier by default. To use another claim, specify it on the configuration: claim: email base_uri: https://www.example.com/realms/demo/protocol/openid-connect/userinfo - .. code-block:: xml - - - - - - - - - - - - - - - - .. code-block:: php // config/packages/security.php @@ -549,29 +393,6 @@ specify the service name via the ``client`` option: oidc_user_info: client: oidc.client - .. code-block:: xml - - - - - - - - - - - - - - - - .. code-block:: php // config/packages/security.php @@ -639,41 +460,6 @@ it, and retrieves the user information from it. Optionally, the token can be enc algorithms: ['ECDH-ES', 'A128GCM'] keyset: '{"keys": [...]}' # Encryption private keyset - .. code-block:: xml - - - - - - - - - - - - - - - ES256 - RS256 - https://oidc.example.com - - ECDH-ES - A128GCM - - - - - - - - .. code-block:: php // config/packages/security.php @@ -733,34 +519,6 @@ from the OpenID Connect Discovery), and configure the ``discovery`` option: base_uri: https://www.example.com/realms/demo/ cache: cache.app - .. code-block:: xml - - - - - - - - - - - ES256 - RS256 - https://oidc.example.com - - - - - - - - .. code-block:: php // config/packages/security.php @@ -802,33 +560,6 @@ configuration: audience: 'api-example' issuers: ['https://oidc.example.com'] - .. code-block:: xml - - - - - - - - - - - ES256 - RS256 - https://oidc.example.com - - - - - - - .. code-block:: php // config/packages/security.php @@ -895,29 +626,6 @@ You can configure a ``cas`` token handler as follows: cas: validation_url: https://www.example.com/cas/validate - .. code-block:: xml - - - - - - - - - - - - - - - - .. code-block:: php // config/packages/security.php @@ -950,29 +658,6 @@ specify the service name via the ``http_client`` option: validation_url: https://www.example.com/cas/validate http_client: cas.client - .. code-block:: xml - - - - - - - - - - - - - - - - .. code-block:: php // config/packages/security.php @@ -1005,29 +690,6 @@ By default the token handler will read the validation URL XML response with validation_url: https://www.example.com/cas/validate prefix: cas-example - .. code-block:: xml - - - - - - - - - - - - - - - - .. code-block:: php // config/packages/security.php diff --git a/security/csrf.rst b/security/csrf.rst index ee9aa147735..5e7fdba5ffb 100644 --- a/security/csrf.rst +++ b/security/csrf.rst @@ -61,23 +61,6 @@ for more information): # ... csrf_protection: ~ - .. code-block:: xml - - - - - - - - - - .. code-block:: php // config/packages/framework.php @@ -135,25 +118,6 @@ Globally, you can configure it under the ``framework.form`` option: enabled: true field_name: 'custom_token_name' - .. code-block:: xml - - - - - - - - - - - - .. code-block:: php // config/packages/framework.php @@ -371,27 +335,6 @@ in applications using :ref:`Symfony Flex `. csrf_protection: stateless_token_ids: ['submit', 'authenticate', 'logout'] - .. code-block:: xml - - - - - - - - submit - authenticate - logout - - - - .. code-block:: php // config/packages/csrf.php @@ -439,25 +382,6 @@ own services), and it sets ``submit`` as their default token identifier: csrf_protection: token_id: 'submit' - .. code-block:: xml - - - - - - - - - - - - .. code-block:: php // config/packages/csrf.php diff --git a/security/custom_authenticator.rst b/security/custom_authenticator.rst index 5d318992b06..ae7078cadd2 100644 --- a/security/custom_authenticator.rst +++ b/security/custom_authenticator.rst @@ -118,27 +118,6 @@ should review it: custom_authenticators: - App\Security\ApiKeyAuthenticator - .. code-block:: xml - - - - - - - - - - App\Security\ApiKeyAuthenticator - - - - .. code-block:: php // config/packages/security.php diff --git a/security/entry_point.rst b/security/entry_point.rst index cfbef00ff88..530692d61cb 100644 --- a/security/entry_point.rst +++ b/security/entry_point.rst @@ -30,33 +30,6 @@ You can configure this using the ``entry_point`` setting: # configure the form authentication as the entry point for unauthenticated users entry_point: form_login - .. code-block:: xml - - - - - - - - - - - - - App\Security\SocialConnectAuthenticator - - - - .. code-block:: php // config/packages/security.php @@ -118,34 +91,6 @@ split the configuration into two separate firewalls: - { path: '^/api', roles: ROLE_API_USER } - { path: '^/', roles: ROLE_USER } - .. code-block:: xml - - - - - - - - - App\Security\ApiTokenAuthenticator - - - - - - - - - - - - .. code-block:: php // config/packages/security.php diff --git a/security/firewall_restriction.rst b/security/firewall_restriction.rst index be0237c0e39..1637fd79ab7 100644 --- a/security/firewall_restriction.rst +++ b/security/firewall_restriction.rst @@ -38,26 +38,6 @@ if the request path matches the configured ``pattern``. pattern: ^/admin # ... - .. code-block:: xml - - - - - - - - - - - - - .. code-block:: php // config/packages/security.php @@ -97,26 +77,6 @@ only initialize if the host from the request matches against the configuration. host: ^admin\.example\.com$ # ... - .. code-block:: xml - - - - - - - - - - - - - .. code-block:: php // config/packages/security.php @@ -157,26 +117,6 @@ the provided HTTP methods. methods: [GET, POST] # ... - .. code-block:: xml - - - - - - - - - - - - - .. code-block:: php // config/packages/security.php @@ -215,26 +155,6 @@ If the above options don't fit your needs you can configure any service implemen request_matcher: App\Security\CustomRequestMatcher # ... - .. code-block:: xml - - - - - - - - - - - - - .. code-block:: php // config/packages/security.php diff --git a/security/force_https.rst b/security/force_https.rst index 03d5230ca50..9e8bd60de9a 100644 --- a/security/force_https.rst +++ b/security/force_https.rst @@ -25,27 +25,6 @@ access control: # catch all other URLs - { path: '^/', roles: PUBLIC_ACCESS, requires_channel: https } - .. code-block:: xml - - - - - - - - - - - - - - .. code-block:: php // config/packages/security.php diff --git a/security/form_login.rst b/security/form_login.rst index 2b5eba96340..1ae00479575 100644 --- a/security/form_login.rst +++ b/security/form_login.rst @@ -39,27 +39,6 @@ a relative/absolute URL or a Symfony route name: # ... default_target_path: after_login_route_name - .. code-block:: xml - - - - - - - - - - - - - - .. code-block:: php // config/packages/security.php @@ -96,28 +75,6 @@ previously requested URL and always redirect to the default page: # ... always_use_default_target_path: true - .. code-block:: xml - - - - - - - - - - - - - - - .. code-block:: php // config/packages/security.php @@ -184,28 +141,6 @@ parameter is included in the request, you may use the value of the # ... use_referer: true - .. code-block:: xml - - - - - - - - - - - - - - - .. code-block:: php // config/packages/security.php @@ -251,28 +186,6 @@ option to define a new target via a relative/absolute URL or a Symfony route nam # ... failure_path: login_failure_route_name - .. code-block:: xml - - - - - - - - - - - - - - - .. code-block:: php // config/packages/security.php @@ -327,29 +240,6 @@ redirects can be customized using the ``target_path_parameter`` and target_path_parameter: go_to failure_path_parameter: back_to - .. code-block:: xml - - - - - - - - - - - - - - - - .. code-block:: php // config/packages/security.php diff --git a/security/impersonating_user.rst b/security/impersonating_user.rst index 6f22e7aace6..5625f930bb0 100644 --- a/security/impersonating_user.rst +++ b/security/impersonating_user.rst @@ -27,28 +27,6 @@ listener: # ... switch_user: true - .. code-block:: xml - - - - - - - - - - - - - - - .. code-block:: php // config/packages/security.php @@ -93,26 +71,6 @@ as the value to the current URL: # ... switch_user: { parameter: X-Switch-User } - .. code-block:: xml - - - - - - - - - - - - - .. code-block:: php // config/packages/security.php @@ -211,27 +169,6 @@ also adjust the query parameter name via the ``parameter`` setting: # ... switch_user: { role: ROLE_ADMIN, parameter: _want_to_be_this_user } - .. code-block:: xml - - - - - - - - - - - - - - .. code-block:: php // config/packages/security.php @@ -269,27 +206,6 @@ This feature allows you to control the redirection target route via ``target_rou # ... switch_user: { target_route: app_user_dashboard } - .. code-block:: xml - - - - - - - - - - - - - - .. code-block:: php // config/packages/security.php @@ -325,27 +241,6 @@ be called): # ... switch_user: { role: CAN_SWITCH_USER } - .. code-block:: xml - - - - - - - - - - - - - - .. code-block:: php // config/packages/security.php diff --git a/security/ldap.rst b/security/ldap.rst index 0b007006eea..e5676e04745 100644 --- a/security/ldap.rst +++ b/security/ldap.rst @@ -78,33 +78,6 @@ An LDAP client can be configured using the built-in protocol_version: 3 referrals: false - .. code-block:: xml - - - - - - - - - - - - - my-server - 389 - tls - - 3 - false - - - - - - .. code-block:: php // config/services.php @@ -154,30 +127,6 @@ use the ``ldap`` user provider. uid_key: uid extra_fields: ['email'] - .. code-block:: xml - - - - - - - - - - - - .. code-block:: php // config/packages/security.php @@ -388,26 +337,6 @@ Configuration example for form login service: Symfony\Component\Ldap\Ldap dn_string: 'uid={user_identifier},dc=example,dc=com' - .. code-block:: xml - - - - - - - - - - - - .. code-block:: php // config/packages/security.php @@ -440,28 +369,6 @@ Configuration example for HTTP Basic service: Symfony\Component\Ldap\Ldap dn_string: 'uid={user_identifier},dc=example,dc=com' - .. code-block:: xml - - - - - - - - - - - - - - .. code-block:: php // config/packages/security.php @@ -498,30 +405,6 @@ Configuration example for form login and query_string search_dn: '...' search_password: 'the-raw-password' - .. code-block:: xml - - - - - - - - - - - - - .. code-block:: php // config/packages/security.php diff --git a/security/login_link.rst b/security/login_link.rst index 57d353278c2..c71a02b1a03 100644 --- a/security/login_link.rst +++ b/security/login_link.rst @@ -35,27 +35,6 @@ and ``signature_properties`` (explained below): check_route: login_check signature_properties: ['id'] - .. code-block:: xml - - - - - - - - - id - - - - - .. code-block:: php // config/packages/security.php @@ -106,19 +85,6 @@ intercept requests to this route: login_check: path: /login_check - .. code-block:: xml - - - - - - - - - .. code-block:: php // config/routes.php @@ -338,28 +304,6 @@ seconds). You can customize this using the ``lifetime`` option: # lifetime in seconds lifetime: 300 - .. code-block:: xml - - - - - - - - - - - - - .. code-block:: php // config/packages/security.php @@ -423,28 +367,6 @@ You can add more properties to the ``hash`` by using the check_route: login_check signature_properties: [id, email] - .. code-block:: xml - - - - - - - - - id - email - - - - - .. code-block:: php // config/packages/security.php @@ -493,30 +415,6 @@ cache. Enable this support by setting the ``max_uses`` option: # optionally, configure the cache pool #used_link_cache: 'cache.redis' - .. code-block:: xml - - - - - - - - - - - - - .. code-block:: php // config/packages/security.php @@ -568,28 +466,6 @@ the authenticator only handle HTTP POST methods: check_post_only: true max_uses: 1 - .. code-block:: xml - - - - - - - - - - - - .. code-block:: php // config/packages/security.php @@ -713,30 +589,6 @@ Then, configure this service ID as the ``success_handler``: max_uses: 1 success_handler: App\Security\Authentication\AuthenticationSuccessHandler - .. code-block:: xml - - - - - - - - - - - - .. code-block:: php // config/packages/security.php diff --git a/security/passwords.rst b/security/passwords.rst index e49fc0a6ce5..e22c0d2a727 100644 --- a/security/passwords.rst +++ b/security/passwords.rst @@ -35,35 +35,6 @@ optionally some *algorithm options*: algorithm: 'auto' cost: 15 - .. code-block:: xml - - - - - - - - - - - - - - - .. code-block:: php // config/packages/security.php @@ -353,40 +324,6 @@ on the new hasher to point to the old, legacy hasher(s): - bcrypt # uses the "bcrypt" hasher with the default options - legacy # uses the "legacy" hasher configured above - .. code-block:: xml - - - - - - - - - - - - - - bcrypt - - - legacy - - - - .. code-block:: php // config/packages/security.php @@ -586,27 +523,6 @@ cost. This can be done with named hashers: algorithm: auto cost: 15 - .. code-block:: xml - - - - - - - - - - - .. code-block:: php // config/packages/security.php @@ -683,26 +599,6 @@ you must register a service for it in order to use it as a named hasher: app_hasher: id: 'App\Security\Hasher\MyCustomPasswordHasher' - .. code-block:: xml - - - - - - - - - - - .. code-block:: php // config/packages/security.php @@ -900,27 +796,6 @@ Now, define a password hasher using the ``id`` setting: # the service ID of your custom hasher (the FQCN using the default services.yaml) id: 'App\Security\Hasher\MyCustomPasswordHasher' - .. code-block:: xml - - - - - - - - - - - - .. code-block:: php // config/packages/security.php diff --git a/security/remember_me.rst b/security/remember_me.rst index 649482d8e20..f62fde81d9e 100644 --- a/security/remember_me.rst +++ b/security/remember_me.rst @@ -26,37 +26,6 @@ the session lasts using a cookie with the ``remember_me`` firewall option: # following line to always enable it. #always_remember_me: true - .. code-block:: xml - - - - - - - - - - - - - - - - - - .. code-block:: php // config/packages/security.php @@ -170,31 +139,6 @@ allow users to opt-out. In these cases, you can use the # ... always_remember_me: true - .. code-block:: xml - - - - - - - - - - - - - - - - .. code-block:: php // config/packages/security.php @@ -331,32 +275,6 @@ are fetched from the user object using the # ... signature_properties: ['password', 'updatedAt'] - .. code-block:: xml - - - - - - - - - - - - - password - updatedAt - - - - - .. code-block:: php // config/packages/security.php @@ -414,31 +332,6 @@ You can enable the doctrine token provider using the ``doctrine`` setting: token_provider: doctrine: true - .. code-block:: xml - - - - - - - - - - - - - - - - - - .. code-block:: php // config/packages/security.php @@ -501,31 +394,6 @@ Then, configure the service ID of your custom token provider as ``service``: token_provider: service: App\Security\RememberMe\CustomTokenProvider - .. code-block:: xml - - - - - - - - - - - - - - - - - - .. code-block:: php // config/packages/security.php diff --git a/security/user_checkers.rst b/security/user_checkers.rst index a9d6c155eb3..87bdff06db9 100644 --- a/security/user_checkers.rst +++ b/security/user_checkers.rst @@ -83,28 +83,6 @@ is the service id of your user checker: user_checker: App\Security\UserChecker # ... - .. code-block:: xml - - - - - - - - - - - - - .. code-block:: php // config/packages/security.php @@ -151,29 +129,6 @@ order in which user checkers are called:: tags: - { name: security.user_checker.api, priority: 5 } - .. code-block:: xml - - - - - - - - - - - - - - - - - - - .. code-block:: php // config/services.php @@ -214,33 +169,6 @@ Once your checker services are tagged, next you will need configure your firewal user_checker: security.user_checker.chain.main # ... - .. code-block:: xml - - - - - - - - - - - - - - - - .. code-block:: php // config/packages/security.php diff --git a/security/user_providers.rst b/security/user_providers.rst index 73b723faaaf..9bd87648baa 100644 --- a/security/user_providers.rst +++ b/security/user_providers.rst @@ -45,32 +45,6 @@ the user provider uses :doc:`Doctrine ` to retrieve them. # ... - .. code-block:: xml - - - - - - - - - - - - - - - - - - .. code-block:: php // config/packages/security.php @@ -140,27 +114,6 @@ To finish this, remove the ``property`` key from the user provider in # ... - .. code-block:: xml - - - - - - - - - - - - - - .. code-block:: php // config/packages/security.php @@ -210,30 +163,6 @@ After setting up hashing, you can configure all the user information in # ... - .. code-block:: xml - - - - - - - - - - - - - - - - - .. code-block:: php // config/packages/security.php @@ -297,47 +226,6 @@ providers until the user is found: chain: providers: ['legacy_users', 'users', 'backend_users'] - .. code-block:: xml - - - - - - - - - - - - - - - - - - - - - - - - - - - backend_users - legacy_users - users - - - - - .. code-block:: php // config/packages/security.php @@ -467,27 +355,6 @@ the user provider by adding it in ``security.yaml``: your_custom_user_provider: id: App\Security\UserProvider - .. code-block:: xml - - - - - - - - - - - - - - .. code-block:: php // config/packages/security.php diff --git a/security/voters.rst b/security/voters.rst index c970f97d0c8..8d7a812c341 100644 --- a/security/voters.rst +++ b/security/voters.rst @@ -430,24 +430,6 @@ security configuration: strategy: unanimous allow_if_all_abstain: false - .. code-block:: xml - - - - - - - - - - .. code-block:: php // config/packages/security.php @@ -477,23 +459,6 @@ option to use a custom service (your service must implement the strategy_service: App\Security\MyCustomAccessDecisionStrategy # ... - .. code-block:: xml - - - - - - - - - - .. code-block:: php // config/packages/security.php @@ -524,23 +489,6 @@ must implement the :class:`Symfony\\Component\\Security\\Core\\Authorization\\Ac service: App\Security\MyCustomAccessDecisionManager # ... - .. code-block:: xml - - - - - - - - - - .. code-block:: php // config/packages/security.php diff --git a/serializer.rst b/serializer.rst index b99b21c4954..ea53283c266 100644 --- a/serializer.rst +++ b/serializer.rst @@ -317,26 +317,6 @@ instance to disallow extra fields while deserializing: default_context: allow_extra_attributes: false - .. code-block:: xml - - - - - - - - - false - - - - - .. code-block:: php // config/packages/serializer.php @@ -1228,24 +1208,6 @@ setting the ``name_converter`` setting to serializer: name_converter: 'serializer.name_converter.camel_case_to_snake_case' - .. code-block:: xml - - - - - - - - - - .. code-block:: php // config/packages/serializer.php @@ -1289,24 +1251,6 @@ setting the ``name_converter`` setting to serializer: name_converter: 'serializer.name_converter.snake_case_to_camel_case' - .. code-block:: xml - - - - - - - - - - .. code-block:: php // config/packages/serializer.php @@ -1500,28 +1444,6 @@ like: # register the normalizer with a high priority (called earlier) - { name: 'serializer.normalizer', priority: 500 } - .. code-block:: xml - - - - - - - - - - - - - - - - .. code-block:: php // config/services.php @@ -1611,39 +1533,6 @@ the ``named_serializers`` option: default_context: enable_max_depth: false - .. code-block:: xml - - - - - - - - - - - true - - - - - - false - - - - - - - .. code-block:: php // config/packages/serializer.php @@ -1711,36 +1600,6 @@ or :ref:`serializer.encoder ` tags: # add this normalizer to all serializers, including the default one - serializer.normalizer: { serializer: '*' } - .. code-block:: xml - - - - - - - - - - - - - - - - - - - - - - - .. code-block:: php // config/services.php @@ -1791,30 +1650,6 @@ named serializer by setting the ``include_built_in_normalizers`` and include_built_in_normalizers: false include_built_in_encoders: true - .. code-block:: xml - - - - - - - - - - - - - - .. code-block:: php // config/packages/serializer.php diff --git a/serializer/custom_name_converter.rst b/serializer/custom_name_converter.rst index dd247c43834..8fd6f419eec 100644 --- a/serializer/custom_name_converter.rst +++ b/serializer/custom_name_converter.rst @@ -55,25 +55,6 @@ Then, configure the serializer to use your name converter: # pass the service ID of your name converter name_converter: 'App\Serializer\OrgPrefixNameConverter' - .. code-block:: xml - - - - - - - - - - - .. code-block:: php // config/packages/serializer.php diff --git a/serializer/custom_normalizer.rst b/serializer/custom_normalizer.rst index 4e78d9d394e..84a7cba3c8e 100644 --- a/serializer/custom_normalizer.rst +++ b/serializer/custom_normalizer.rst @@ -86,27 +86,6 @@ If you're not using ``autoconfigure``, you have to tag the service with # register the normalizer with a high priority (called earlier) - { name: 'serializer.normalizer', priority: 500 } - .. code-block:: xml - - - - - - - - - - - - - - - .. code-block:: php // config/services.php diff --git a/serializer/encoders.rst b/serializer/encoders.rst index 139b45c65a3..ba35537332d 100644 --- a/serializer/encoders.rst +++ b/serializer/encoders.rst @@ -362,24 +362,6 @@ to register your class as a service and tag it with App\Serializer\NeonEncoder: tags: ['serializer.encoder'] - .. code-block:: xml - - - - - - - - - - - - - - .. code-block:: php // config/services.php diff --git a/service_container.rst b/service_container.rst index 666e8079042..4629cde9300 100644 --- a/service_container.rst +++ b/service_container.rst @@ -168,31 +168,6 @@ each time you ask for it. # ... - .. code-block:: xml - - - - - - - - - - - - - - - - - - - - .. code-block:: php // config/services.php @@ -240,21 +215,6 @@ each time you ask for it. - '../src/AnotherDirectory/' - '../src/SomeFile.php' - .. code-block:: xml - - - - - - - - - - - .. code-block:: php // config/services.php @@ -417,54 +377,6 @@ as arguments of other services: first: !php/const true second: 'Foo' - .. code-block:: xml - - - - - - - - - Foo - 7 - 3.14 - - Foo - - true - - - E_ALL - PDO::FETCH_NUM - Symfony\Component\HttpKernel\Kernel::VERSION - App\Config\SomeEnum::SomeCase - - - - - - VGhpcyBpcyBhIEJlbGwgY2hhciAH - - - - true - Foo - - - - - - - .. code-block:: php // config/services.php @@ -635,32 +547,6 @@ pass here. No problem! In your configuration, you can explicitly set this argume arguments: $adminEmail: 'manager@example.com' - .. code-block:: xml - - - - - - - - - - - - - - - manager@example.com - - - - .. code-block:: php // config/services.php @@ -700,8 +586,7 @@ all their types (string, boolean, array, binary and PHP constant parameters). However, there is another type of parameter related to services. In YAML config, any string which starts with ``@`` is considered as the ID of a service, instead -of a regular string. In XML config, use the ``type="service"`` type for the -parameter and in PHP config use the ``service()`` function: +of a regular string: .. configuration-block:: @@ -719,22 +604,6 @@ parameter and in PHP config use the ``service()`` function: # the following example would be parsed as the string '@securepassword' # - '@@securepassword' - .. code-block:: xml - - - - - - - - - - - - .. code-block:: php // config/services.php @@ -820,25 +689,6 @@ But, you can control this and pass in a different logger: # and not just the *string* 'monolog.logger.request' $logger: '@monolog.logger.request' - .. code-block:: xml - - - - - - - - - - - - - - - .. code-block:: php // config/services.php @@ -952,26 +802,6 @@ Our configuration looks like this: $logger: '@monolog.logger.request' $generateMessageHash: !closure '@App\Hash\MessageHashGenerator' - .. code-block:: xml - - - - - - - - - - - - - - - - .. code-block:: php // config/services.php @@ -1028,43 +858,6 @@ You can also use the ``bind`` keyword to bind specific arguments by name or type # ... - .. code-block:: xml - - - - - - - - manager@example.com - - - - - manager@example.com - - - - - - - - .. code-block:: php // config/services.php @@ -1129,24 +922,6 @@ the name of the argument and some short description about its purpose: # ... - .. code-block:: xml - - - - - - - - should be defined by Pass - - - - - - .. code-block:: php // config/services.php @@ -1261,23 +1036,6 @@ setting: App\Service\PublicService: public: true - .. code-block:: xml - - - - - - - - - - - - - .. code-block:: php // config/services.php @@ -1331,22 +1089,6 @@ key. For example, the default Symfony configuration contains this: resource: '../src/' exclude: '../src/{DependencyInjection,Entity,Kernel.php}' - .. code-block:: xml - - - - - - - - - - - - .. code-block:: php // config/services.php @@ -1405,23 +1147,6 @@ for classes under the same namespace: resource: '../src/Domain/*' # ... - .. code-block:: xml - - - - - - - - - - - - .. code-block:: php // config/services.php @@ -1497,34 +1222,6 @@ admin email. In this case, each needs to have a unique service id: # the site_update_manager.superadmin will be used App\Service\SiteUpdateManager: '@site_update_manager.superadmin' - .. code-block:: xml - - - - - - - - - - - - superadmin@example.com - - - - - - contact@example.com - - - - - - .. code-block:: php // config/services.php @@ -1662,27 +1359,6 @@ an adapter for a functional interface through configuration: class: App\Service\MessageFormatterInterface from_callable: [!service {class: 'App\Service\MessageUtils'}, 'format'] - .. code-block:: xml - - - - - - - - - - - - - - - - - .. code-block:: php // config/services.php diff --git a/service_container/alias_private.rst b/service_container/alias_private.rst index a22fe2aebe9..b0425469f05 100644 --- a/service_container/alias_private.rst +++ b/service_container/alias_private.rst @@ -35,19 +35,6 @@ You can also control the ``public`` option on a service-by-service basis: App\Service\Foo: public: true - .. code-block:: xml - - - - - - - - - - .. code-block:: php // config/services.php @@ -133,22 +120,6 @@ services. alias: App\Mail\PhpMailer public: true - .. code-block:: xml - - - - - - - - - - - - .. code-block:: php // config/services.php @@ -247,27 +218,6 @@ or you decided not to maintain it anymore), you can deprecate its definition: version: '1.2' message: 'The "%alias_id%" alias is deprecated. Do not use it anymore.' - .. code-block:: xml - - - - - - - - - - - - The "%alias_id%" service alias is deprecated. Don't use it anymore. - - - - - .. code-block:: php $container @@ -313,24 +263,6 @@ The following example shows how to inject an anonymous service into another serv - !service class: App\AnonymousBar - .. code-block:: xml - - - - - - - - - - - - - - .. code-block:: php // config/services.php @@ -364,24 +296,6 @@ Using an anonymous service as a factory looks like this: App\Foo: factory: [ !service { class: App\FooFactory }, 'constructFoo' ] - .. code-block:: xml - - - - - - - - - - - - - - .. code-block:: php // config/services.php @@ -414,21 +328,6 @@ or you decided not to maintain it anymore), you can deprecate its definition: version: '2.8' message: The "%service_id%" service is deprecated since vendor-name/package-name 2.8 and will be removed in 3.0. - .. code-block:: xml - - - - - - - - The "%service_id%" service is deprecated since vendor-name/package-name 2.8 and will be removed in 3.0. - - - - .. code-block:: php // config/services.php diff --git a/service_container/autowiring.rst b/service_container/autowiring.rst index ff5decfb931..6ff0c9c67d6 100644 --- a/service_container/autowiring.rst +++ b/service_container/autowiring.rst @@ -80,25 +80,6 @@ both services: App\Util\Rot13Transformer: autowire: true - .. code-block:: xml - - - - - - - - - - - - - - - - .. code-block:: php // config/services.php @@ -215,22 +196,6 @@ adding a service alias: # an App\Util\Rot13Transformer type-hint is detected App\Util\Rot13Transformer: '@app.rot13.transformer' - .. code-block:: xml - - - - - - - - - - - - - .. code-block:: php // config/services.php @@ -321,22 +286,6 @@ To fix that, add an :ref:`alias `: # an App\Util\TransformerInterface type-hint is detected App\Util\TransformerInterface: '@App\Util\Rot13Transformer' - .. code-block:: xml - - - - - - - - - - - - - .. code-block:: php // config/services.php @@ -476,30 +425,6 @@ the injection:: # $transformer: '@App\Util\UppercaseTransformer' # ... - .. code-block:: xml - - - - - - - - - - - - - - - - - - - .. code-block:: php // config/services.php diff --git a/service_container/calls.rst b/service_container/calls.rst index cb364b59489..67777e25728 100644 --- a/service_container/calls.rst +++ b/service_container/calls.rst @@ -40,25 +40,6 @@ To configure the container to call the ``setLogger`` method, use the ``calls`` k calls: - setLogger: ['@logger'] - .. code-block:: xml - - - - - - - - - - - - - - - .. code-block:: php // config/services.php @@ -112,25 +93,6 @@ The configuration to tell the container it should do so would be like: calls: - withLogger: !returns_clone ['@logger'] - .. code-block:: xml - - - - - - - - - - - - - - - .. code-block:: php // config/services.php diff --git a/service_container/configurators.rst b/service_container/configurators.rst index 7817a383761..460aa65d1d5 100644 --- a/service_container/configurators.rst +++ b/service_container/configurators.rst @@ -136,28 +136,6 @@ all the classes are already loaded as services. All you need to do is specify th App\Mail\GreetingCardManager: configurator: ['@App\Mail\EmailConfigurator', 'configure'] - .. code-block:: xml - - - - - - - - - - - - - - - - - - .. code-block:: php // config/services.php @@ -206,28 +184,6 @@ Services can be configured via invokable configurators (replacing the App\Mail\GreetingCardManager: configurator: '@App\Mail\EmailConfigurator' - .. code-block:: xml - - - - - - - - - - - - - - - - - - .. code-block:: php // config/services.php diff --git a/service_container/definitions.rst b/service_container/definitions.rst index a2a50591668..6240f56e126 100644 --- a/service_container/definitions.rst +++ b/service_container/definitions.rst @@ -6,7 +6,7 @@ build a service. They are not the actual services used by your applications. The container will create the actual class instances based on the configuration in the definition. -Normally, you would use YAML, XML or PHP to describe the service definitions. +Normally, you would use YAML or PHP to describe the service definitions. But if you're doing advanced things with the service container, like working with a :doc:`Compiler Pass ` or creating a :doc:`Dependency Injection Extension `, you may need to diff --git a/service_container/expression_language.rst b/service_container/expression_language.rst index 41c538db468..88a6dd0fa27 100644 --- a/service_container/expression_language.rst +++ b/service_container/expression_language.rst @@ -27,26 +27,6 @@ to another service: ``App\Mailer``. One way to do this is with an expression: # when using double-quoted strings, the backslash needs to be escaped twice (see https://yaml.org/spec/1.2/spec.html#id2787109) # arguments: ["@=service('App\\\\Mail\\\\MailerConfiguration').getMailerMethod()"] - .. code-block:: xml - - - - - - - - - - - - service('App\\Mail\\MailerConfiguration').getMailerMethod() - - - - .. code-block:: php // config/services.php @@ -89,22 +69,6 @@ via a ``container`` variable. Here's another example: # the '@=' prefix is required when using expressions for arguments in YAML files arguments: ["@=container.hasParameter('some_param') ? parameter('some_param') : 'default_value'"] - .. code-block:: xml - - - - - - - - container.hasParameter('some_param') ? parameter('some_param') : 'default_value' - - - - .. code-block:: php // config/services.php diff --git a/service_container/factories.rst b/service_container/factories.rst index 9864287d57a..4ecde32af5e 100644 --- a/service_container/factories.rst +++ b/service_container/factories.rst @@ -49,23 +49,6 @@ create its object: # the first argument is the class and the second argument is the static method factory: ['App\Email\NewsletterManagerStaticFactory', 'createNewsletterManager'] - .. code-block:: xml - - - - - - - - - - - - - .. code-block:: php // config/services.php @@ -132,22 +115,6 @@ You can omit the class on the factory declaration: arguments: $sender: 'fabien@symfony.com' - .. code-block:: xml - - - - - - - - - - - - .. code-block:: php // config/services.php @@ -201,21 +168,6 @@ as the factory class: arguments: $sender: 'fabien@symfony.com' - .. code-block:: xml - - - - - - - - - - - .. code-block:: php // config/services.php @@ -253,29 +205,6 @@ Configuration of the service container then looks like this: App\Email\NewsletterManager: factory: ['@App\Email\NewsletterManagerFactory', 'createNewsletterManager'] - .. code-block:: xml - - - - - - - - - - - - - - - - .. code-block:: php // config/services.php @@ -335,25 +264,6 @@ method name: class: App\Email\NewsletterManager factory: '@App\Email\InvokableNewsletterManagerFactory' - .. code-block:: xml - - - - - - - - - - - - - - .. code-block:: php // config/services.php @@ -393,29 +303,6 @@ e.g. change the service based on a parameter: arguments: - '@App\Email\NewsletterManagerFactory' - .. code-block:: xml - - - - - - - - - - - - - - - - - - - .. code-block:: php // config/services.php @@ -467,25 +354,6 @@ previous examples takes the ``templating`` service as an argument: factory: ['@App\Email\NewsletterManagerFactory', createNewsletterManager] arguments: ['@templating'] - .. code-block:: xml - - - - - - - - - - - - - - - .. code-block:: php // config/services.php diff --git a/service_container/import.rst b/service_container/import.rst index 47af34d3a34..ab1a846045c 100644 --- a/service_container/import.rst +++ b/service_container/import.rst @@ -4,7 +4,7 @@ How to Import Configuration Files/Resources .. tip:: In this section, service configuration files are referred to as *resources*. - While most configuration resources are files (e.g. YAML, XML, PHP), Symfony is + While most configuration resources are files (e.g. YAML, PHP), Symfony is able to load configuration from anywhere (e.g. a database or even via an external web service). @@ -38,24 +38,6 @@ decided to move some configuration to a new file: services: # ... some services - .. code-block:: xml - - - - - - - - - - - - - - .. code-block:: php // config/services/mailer.php @@ -85,30 +67,6 @@ a relative or absolute path to the imported file: # ... - .. code-block:: xml - - - - - - - - - - - - - - - - - - - - .. code-block:: php // config/services.php @@ -173,33 +131,6 @@ from auto-registering classes that are defined manually elsewhere: - '../src/Mailer/' - '../src/SpecificClass.php' - .. code-block:: xml - - - - - - - - - - - - - - - - ../src/Mailer/ - ../src/SpecificClass.php - - - - - - .. code-block:: php // config/services.php @@ -246,34 +177,6 @@ same file. These later definitions will override the auto-registered ones: App\Mailer\MyMailer: arguments: ['%env(MAILER_DSN)%'] - .. code-block:: xml - - - - - - - - - - - - - - - - - - %env(MAILER_DSN)% - - - - - - .. code-block:: php // config/services.php @@ -329,57 +232,6 @@ can override the auto-discovered ones. # definitions here override anything from the imports above # consider keeping most definitions inside imported files - .. code-block:: xml - - - - - - - - - - ../../src/Mailer/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - .. code-block:: php // config/services/autodiscovery.php diff --git a/service_container/injection_types.rst b/service_container/injection_types.rst index 91c2a562d81..48c87e02389 100644 --- a/service_container/injection_types.rst +++ b/service_container/injection_types.rst @@ -44,24 +44,6 @@ service container configuration: App\Mail\NewsletterManager: arguments: ['@mailer'] - .. code-block:: xml - - - - - - - - - - - - - - .. code-block:: php // config/services.php @@ -147,26 +129,6 @@ In order to use this type of injection, don't forget to configure it: calls: - withMailer: !returns_clone ['@mailer'] - .. code-block:: xml - - - - - - - - - - - - - - - - .. code-block:: php // config/services.php @@ -246,26 +208,6 @@ that accepts the dependency:: calls: - setMailer: ['@mailer'] - .. code-block:: xml - - - - - - - - - - - - - - - - .. code-block:: php // config/services.php @@ -330,24 +272,6 @@ Another possibility is setting public fields of the class directly:: properties: mailer: '@mailer' - .. code-block:: xml - - - - - - - - - - - - - - .. code-block:: php // config/services.php diff --git a/service_container/lazy_services.rst b/service_container/lazy_services.rst index f7747be5e12..0959e18ebd1 100644 --- a/service_container/lazy_services.rst +++ b/service_container/lazy_services.rst @@ -42,20 +42,6 @@ You can mark the service as ``lazy`` by manipulating its definition: App\Twig\AppExtension: lazy: true - .. code-block:: xml - - - - - - - - - - .. code-block:: php // config/services.php @@ -161,24 +147,6 @@ specific interfaces. tags: - { name: 'proxy', interface: 'Twig\Extension\ExtensionInterface' } - .. code-block:: xml - - - - - - - - - - - - - - .. code-block:: php // config/services.php diff --git a/service_container/optional_dependencies.rst b/service_container/optional_dependencies.rst index bc8f03cf7e0..ec77a95777f 100644 --- a/service_container/optional_dependencies.rst +++ b/service_container/optional_dependencies.rst @@ -13,24 +13,6 @@ if the service does not exist: .. configuration-block:: - .. code-block:: xml - - - - - - - - - - - - - - .. code-block:: php // config/services.php @@ -69,24 +51,6 @@ call if the service exists and remove the method call if it does not: calls: - setLogger: ['@?logger'] - .. code-block:: xml - - - - - - - - - - - - - - .. code-block:: php // config/services.php diff --git a/service_container/parent_services.rst b/service_container/parent_services.rst index b82222c43af..8112c224f3c 100644 --- a/service_container/parent_services.rst +++ b/service_container/parent_services.rst @@ -78,37 +78,6 @@ avoid duplicated service definitions: # ... - .. code-block:: xml - - - - - - - - - - - - - - - - - - - - - - - .. code-block:: php // config/services.php @@ -184,39 +153,6 @@ the child class: arguments: index_0: '@doctrine.custom_entity_manager' - .. code-block:: xml - - - - - - - - - - - - - - - - - - - - - - - .. code-block:: php // config/services.php diff --git a/service_container/service_closures.rst b/service_container/service_closures.rst index 86c9201be85..73aed59bdd3 100644 --- a/service_container/service_closures.rst +++ b/service_container/service_closures.rst @@ -59,26 +59,6 @@ argument of type ``service_closure``: # the shortcut also works for optional dependencies # arguments: ['@>?mailer'] - .. code-block:: xml - - - - - - - - - - - - - - .. code-block:: php // config/services.php diff --git a/service_container/service_decoration.rst b/service_container/service_decoration.rst index f8560c59a0d..adf27f127ac 100644 --- a/service_container/service_decoration.rst +++ b/service_container/service_decoration.rst @@ -16,23 +16,6 @@ When overriding an existing definition, the original service is lost: App\Mailer: class: App\NewMailer - .. code-block:: xml - - - - - - - - - - - - - .. code-block:: php // config/services.php @@ -84,26 +67,6 @@ but keeps a reference of the old one as ``.inner``: # but that service is still available as ".inner" decorates: App\Mailer - .. code-block:: xml - - - - - - - - - - - - - - .. code-block:: php // config/services.php @@ -173,26 +136,6 @@ automatically changed to ``'.inner'``): # pass the old service as an argument arguments: ['@.inner'] - .. code-block:: xml - - - - - - - - - - - - - - - .. code-block:: php // config/services.php @@ -244,29 +187,6 @@ automatically changed to ``'.inner'``): decoration_inner_name: App\DecoratingMailer.wooz arguments: ['@App\DecoratingMailer.wooz'] - .. code-block:: xml - - - - - - - - - - - - - - - .. code-block:: php // config/services.php @@ -339,28 +259,6 @@ the ``decoration_priority`` option. Its value is an integer that defaults to decoration_priority: 1 arguments: ['@.inner'] - .. code-block:: xml - - - - - - - - - - - - - - - - - - - .. code-block:: php // config/services.php @@ -418,35 +316,6 @@ ordered services, each one decorating the next: - Bar: ~ - Foo: ~ - .. code-block:: xml - - - - - - - - - - - - - - - - - - - - - - - - .. code-block:: php // config/services.php @@ -501,32 +370,6 @@ advanced example of composition: - Bar: ~ - Foo: ~ - .. code-block:: xml - - - - - - - - - - - - - - - - - - - - - .. code-block:: php // config/services.php @@ -580,15 +423,6 @@ The result will be:: Baz: ~ # ... - .. code-block:: xml - - - - - - - - .. code-block:: php // ... @@ -642,24 +476,6 @@ Three different behaviors are available: decoration_on_invalid: ignore arguments: ['@.inner'] - .. code-block:: xml - - - - - - - - - - - - - - - .. code-block:: php // config/services.php diff --git a/service_container/service_subscribers_locators.rst b/service_container/service_subscribers_locators.rst index 4263a31a262..f9f39a70abf 100644 --- a/service_container/service_subscribers_locators.rst +++ b/service_container/service_subscribers_locators.rst @@ -221,23 +221,6 @@ service type to a service. tags: - { name: 'container.service_subscriber', key: 'logger', id: 'monolog.logger.event' } - .. code-block:: xml - - - - - - - - - - - - - - .. code-block:: php // config/services.php @@ -446,7 +429,7 @@ some services into it via a service locator:: } } -Symfony allows you to inject the service locator using YAML/XML/PHP configuration +Symfony allows you to inject the service locator using YAML or PHP configuration or directly via PHP attributes: .. configuration-block:: @@ -479,24 +462,6 @@ or directly via PHP attributes: App\FooCommand: '@app.command_handler.foo' App\BarCommand: '@app.command_handler.bar' - .. code-block:: xml - - - - - - - - - - - - - - - .. code-block:: php // config/services.php @@ -542,31 +507,6 @@ other services. To do so, create a new service definition using the # add the following tag to the service definition: # tags: ['container.service_locator'] - .. code-block:: xml - - - - - - - - - - - - - - - - - - .. code-block:: php // config/services.php @@ -621,23 +561,6 @@ Now you can inject the service locator in any other services: App\CommandBus: arguments: ['@app.command_handler_locator'] - .. code-block:: xml - - - - - - - - - - - - - - .. code-block:: php // config/services.php @@ -726,31 +649,6 @@ to index the services: # inject all services tagged with app.handler as first argument arguments: [!tagged_locator { tag: 'app.handler', index_by: 'key' }] - .. code-block:: xml - - - - - - - - - - - - - - - - - - - - - .. code-block:: php // config/services.php @@ -835,25 +733,6 @@ get the value used to index the services: # inject all services tagged with app.handler as first argument arguments: [!tagged_locator { tag: 'app.handler', default_index_method: 'getLocatorKey' }] - .. code-block:: xml - - - - - - - - - - - - - - - .. code-block:: php // config/services.php diff --git a/service_container/synthetic_services.rst b/service_container/synthetic_services.rst index 09b195db02c..9f60bb7ddaf 100644 --- a/service_container/synthetic_services.rst +++ b/service_container/synthetic_services.rst @@ -41,23 +41,6 @@ configuration: app.synthetic_service: synthetic: true - .. code-block:: xml - - - - - - - - - - - - - .. code-block:: php // config/services.php diff --git a/service_container/tags.rst b/service_container/tags.rst index 594c925a701..5d053fd2519 100644 --- a/service_container/tags.rst +++ b/service_container/tags.rst @@ -14,22 +14,6 @@ example: App\Twig\AppExtension: tags: ['twig.extension'] - .. code-block:: xml - - - - - - - - - - - - .. code-block:: php // config/services.php @@ -81,20 +65,6 @@ If you want to apply tags automatically for your own services, use the tags: ['app.custom_tag'] # ... - .. code-block:: xml - - - - - - - - - - - - - .. code-block:: php // config/services.php @@ -307,20 +277,6 @@ Then, define the chain as a service: services: App\Mail\TransportChain: ~ - .. code-block:: xml - - - - - - - - - - .. code-block:: php // config/services.php @@ -354,28 +310,6 @@ For example, you may add the following transports as services: MailerSendmailTransport: tags: ['app.mail_transport'] - .. code-block:: xml - - - - - - - - %mailer_host% - - - - - - - - - - .. code-block:: php // config/services.php @@ -513,33 +447,6 @@ To answer this, change the service declaration: tags: - { name: 'app.mail_transport', alias: ['sendmail', 'anotherAlias']} - .. code-block:: xml - - - - - - - - %mailer_host% - - - - - - - - sendmail - anotherAlias - - - - - - .. code-block:: php // config/services.php @@ -561,7 +468,7 @@ To answer this, change the service declaration: .. tip:: The ``name`` attribute is used by default to define the name of the tag. - If you want to add a ``name`` attribute to some tag in XML or YAML formats, + If you want to add a ``name`` attribute to some tag in YAML format, you need to use this special syntax: .. configuration-block:: @@ -578,26 +485,6 @@ To answer this, change the service declaration: # this is a tag called 'app.mail_transport' with two attributes ('name' and 'alias') - app.mail_transport: { name: 'arbitrary-value', alias: 'smtp' } - .. code-block:: xml - - - - - - - - %mailer_host% - - - - app.mail_transport - - - - .. tip:: In YAML format, you may provide the tag as a simple string as long as @@ -672,7 +559,7 @@ all services tagged with ``app.handler`` into its constructor argument:: } } -Symfony allows you to inject the services using YAML/XML/PHP configuration or +Symfony allows you to inject the services using YAML or PHP configuration or directly via PHP attributes: .. configuration-block:: @@ -709,31 +596,6 @@ directly via PHP attributes: arguments: - !tagged_iterator app.handler - .. code-block:: xml - - - - - - - - - - - - - - - - - - - - - .. code-block:: php // config/services.php @@ -799,32 +661,6 @@ iterator, add the ``exclude`` option: arguments: - !tagged_iterator { tag: app.handler, exclude: ['App\Handler\Three'] } - .. code-block:: xml - - - - - - - - - - - - - - - - - App\Handler\Three - - - - - .. code-block:: php // config/services.php @@ -882,32 +718,6 @@ disabled by setting the ``exclude_self`` option to ``false``: arguments: - !tagged_iterator { tag: app.handler, exclude: ['App\Handler\Three'], exclude_self: false } - .. code-block:: xml - - - - - - - - - - - - - - - - - App\Handler\Three - - - - - .. code-block:: php // config/services.php @@ -950,22 +760,6 @@ the number, the earlier the tagged service will be located in the collection: tags: - { name: 'app.handler', priority: 20 } - .. code-block:: xml - - - - - - - - - - - - .. code-block:: php // config/services.php @@ -1027,21 +821,6 @@ you can define it in the configuration of the collecting service: arguments: - !tagged_iterator { tag: app.handler, default_priority_method: getPriority } - .. code-block:: xml - - - - - - - - - - - .. code-block:: php // config/services.php @@ -1105,30 +884,6 @@ to index the services: App\HandlerCollection: arguments: [!tagged_iterator { tag: 'app.handler', index_by: 'key' }] - .. code-block:: xml - - - - - - - - - - - - - - - - - - - - .. code-block:: php // config/services.php @@ -1212,27 +967,6 @@ get the value used to index the services: App\HandlerCollection: arguments: [!tagged_iterator { tag: 'app.handler', default_index_method: 'getIndex' }] - .. code-block:: xml - - - - - - - - - - - - - - .. code-block:: php // config/services.php diff --git a/session.rst b/session.rst index 9fc3f71298a..882c264653f 100644 --- a/session.rst +++ b/session.rst @@ -290,32 +290,6 @@ configuration ` in cookie_samesite: lax storage_factory_id: session.storage.factory.native - .. code-block:: xml - - - - - - - - - - - .. code-block:: php // config/packages/framework.php @@ -373,24 +347,6 @@ session metadata files: handler_id: 'session.handler.native_file' save_path: '%kernel.project_dir%/var/sessions/%kernel.environment%' - .. code-block:: xml - - - - - - - - - - .. code-block:: php // config/packages/framework.php @@ -571,46 +527,6 @@ a Symfony service for the connection to the Redis server: # - auth: # - ['%env(REDIS_USER)%','%env(REDIS_PASSWORD)%'] - .. code-block:: xml - - - - - - - - - %env(REDIS_HOST)% - %env(int:REDIS_PORT)% - - - - - - - - - - - - - - .. code-block:: php // config/services.php @@ -649,24 +565,6 @@ configuration option to tell Symfony to use this service as the session handler: session: handler_id: Symfony\Component\HttpFoundation\Session\Storage\Handler\RedisSessionHandler - .. code-block:: xml - - - - - - - - - - - .. code-block:: php // config/packages/framework.php @@ -724,31 +622,6 @@ To use it, first register a new handler service with your database credentials: # - 'mysql:dbname=mydatabase; host=myhost; port=myport' # - { db_username: myuser, db_password: mypassword } - .. code-block:: xml - - - - - - - - %env(DATABASE_URL)% - - - - - - - .. code-block:: php // config/services.php @@ -787,25 +660,6 @@ configuration option to tell Symfony to use this service as the session handler: # ... handler_id: Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler - .. code-block:: xml - - - - - - - - - - - .. code-block:: php // config/packages/framework.php @@ -839,26 +693,6 @@ passed to the ``PdoSessionHandler`` service: - '%env(DATABASE_URL)%' - { db_table: 'customer_session', db_id_col: 'guid' } - .. code-block:: xml - - - - - - - - %env(DATABASE_URL)% - - customer_session - guid - - - - - .. code-block:: php // config/services.php @@ -1034,28 +868,6 @@ the MongoDB connection as argument, and the required parameters: - '@doctrine_mongodb.odm.default_connection' - { database: '%env(MONGODB_DB)%', collection: 'sessions' } - .. code-block:: xml - - - - - - - - doctrine_mongodb.odm.default_connection - - %env('MONGODB_DB')% - sessions - - - - - .. code-block:: php // config/services.php @@ -1087,25 +899,6 @@ configuration option to tell Symfony to use this service as the session handler: # ... handler_id: Symfony\Component\HttpFoundation\Session\Storage\Handler\MongoDbSessionHandler - .. code-block:: xml - - - - - - - - - - - .. code-block:: php // config/packages/framework.php @@ -1153,28 +946,6 @@ configure these values with the second argument passed to the id_field: '_guid' expiry_field: 'eol' - .. code-block:: xml - - - - - - - - doctrine_mongodb.odm.default_connection - - %env('MONGODB_DB')% - sessions - _guid - eol - - - - - .. code-block:: php // config/services.php @@ -1267,18 +1038,6 @@ You need to pass the TTL in the options array of the session handler you are usi - '@Redis' - { 'ttl': 600 } - .. code-block:: xml - - - - - - - 600 - - - - .. code-block:: php // config/services.php @@ -1317,23 +1076,6 @@ has to return an integer which will be used as TTL. # Inject whatever dependencies you need to be able to resolve a TTL for the current session - '@security' - .. code-block:: xml - - - - - - - - - - - - - - - - .. code-block:: php // config/services.php @@ -1434,25 +1176,6 @@ via some "Change Locale" route & controller), or create a route with the # uncomment the next line if you are not using autoconfigure # tags: [kernel.event_subscriber] - .. code-block:: xml - - - - - - - - %kernel.default_locale% - - - - - - - .. code-block:: php // config/services.php @@ -1563,21 +1286,6 @@ Symfony to use your session handler instead of the default one: # ... handler_id: App\Session\CustomSessionHandler - .. code-block:: xml - - - - - - - - - - .. code-block:: php // config/packages/framework.php @@ -1662,25 +1370,6 @@ Then, register the ``SodiumMarshaller`` service using this key: - ['%env(file:resolve:SESSION_DECRYPTION_FILE)%'] - '@.inner' - .. code-block:: xml - - - - - - - - env(file:resolve:SESSION_DECRYPTION_FILE) - - - - - - .. code-block:: php // config/services.php @@ -1771,23 +1460,6 @@ for the ``handler_id``: storage_factory_id: session.storage.factory.php_bridge handler_id: ~ - .. code-block:: xml - - - - - - - - - - .. code-block:: php // config/packages/framework.php @@ -1831,23 +1503,6 @@ the example below: storage_factory_id: session.storage.factory.php_bridge handler_id: session.handler.native_file - .. code-block:: xml - - - - - - - - - - .. code-block:: php // config/packages/framework.php diff --git a/templates.rst b/templates.rst index 34af75cd51a..e5a89eb59eb 100644 --- a/templates.rst +++ b/templates.rst @@ -230,24 +230,6 @@ Consider the following routing configuration: path: /article/{slug} controller: App\Controller\BlogController::show - .. code-block:: xml - - - - - - - - - - .. code-block:: php // config/routes.php @@ -416,24 +398,6 @@ inside the main Twig configuration file: globals: ga_tracking: 'UA-xxxxx-x' - .. code-block:: xml - - - - - - - - UA-xxxxx-x - - - .. code-block:: php // config/packages/twig.php @@ -474,24 +438,6 @@ in container parameters `: # the value is the service's id uuid: '@App\Generator\UuidGenerator' - .. code-block:: xml - - - - - - - - - - - .. code-block:: php // config/packages/twig.php @@ -739,43 +685,6 @@ provided by Symfony: Content-Type: 'text/html' foo: 'bar' - .. code-block:: xml - - - - - - - - static/privacy.html.twig - - - 200 - - - 86400 - 86400 - - - true - - - - ACME - dark - - - - - text/html - - - - .. code-block:: php // config/routes.php @@ -1073,23 +982,6 @@ template fragments. Configure that special URL in the ``fragments`` option: # ... fragments: { path: /_fragment } - .. code-block:: xml - - - - - - - - - - - .. code-block:: php // config/packages/framework.php @@ -1146,23 +1038,6 @@ default content rendering some template: fragments: hinclude_default_template: hinclude.html.twig - .. code-block:: xml - - - - - - - - - - - .. code-block:: php // config/packages/framework.php @@ -1392,25 +1267,6 @@ the ``value`` is the Twig namespace, which is explained later: 'email/default/templates': ~ 'backend/templates': ~ - .. code-block:: xml - - - - - - - - email/default/templates - backend/templates - - - .. code-block:: php // config/packages/twig.php @@ -1450,23 +1306,6 @@ configuration to define a namespace for each template directory: 'email/default/templates': 'email' 'backend/templates': 'admin' - .. code-block:: xml - - - - - - - email/default/templates - backend/templates - - - .. code-block:: php // config/packages/twig.php diff --git a/testing.rst b/testing.rst index 82fb031ecb2..7fb028219ca 100644 --- a/testing.rst +++ b/testing.rst @@ -170,21 +170,6 @@ code to production: twig: strict_variables: true - .. code-block:: xml - - - - - - - - .. code-block:: php // config/packages/test/twig.php diff --git a/testing/profiling.rst b/testing/profiling.rst index 085cd100c2d..59fa76cfb3e 100644 --- a/testing/profiling.rst +++ b/testing/profiling.rst @@ -24,23 +24,6 @@ tests significantly. That's why Symfony disables it by default: framework: profiler: { enabled: true, collect: false } - .. code-block:: xml - - - - - - - - - - - - .. code-block:: php // config/packages/test/web_profiler.php diff --git a/translation.rst b/translation.rst index 88a222bd617..fa0c592593d 100644 --- a/translation.rst +++ b/translation.rst @@ -77,25 +77,6 @@ are located: translator: default_path: '%kernel.project_dir%/translations' - .. code-block:: xml - - - - - - - - - - .. code-block:: php // config/packages/translation.php @@ -460,31 +441,6 @@ of your main configuration file using either ``%...%`` or ``{...}`` syntax: '{app_version}': '1.2.3' '{url}': { message: 'url', parameters: { scheme: 'https://' }, domain: 'global' } - .. code-block:: xml - - - - - - - - - - My application - - - https:// - - - - - .. code-block:: php // config/packages/translator.php @@ -654,25 +610,6 @@ if you're generating translations with specialized programs or teams. paths: - '%kernel.project_dir%/custom/path/to/translations' - .. code-block:: xml - - - - - - - - %kernel.project_dir%/custom/path/to/translations - - - - .. code-block:: php // config/packages/translation.php @@ -776,31 +713,6 @@ configure the ``providers`` option: domains: ['messages'] locales: ['en', 'fr'] - .. code-block:: xml - - - - - - - - - messages - - en - fr - - - - - - .. code-block:: php # config/packages/translation.php @@ -999,21 +911,6 @@ A better policy is to include the locale in the URL using the requirements: _locale: en|fr|de - .. code-block:: xml - - - - - - - controller="App\Controller\ContactController::index"> - en|fr|de - - - .. code-block:: php // config/routes.php @@ -1060,21 +957,6 @@ the framework: framework: default_locale: en - .. code-block:: xml - - - - - - - - .. code-block:: php // config/packages/translation.php @@ -1141,26 +1023,6 @@ checks translation resources for several locales: fallbacks: ['en'] # ... - .. code-block:: xml - - - - - - - - en - - - - - .. code-block:: php // config/packages/translation.php @@ -1582,37 +1444,6 @@ it in the translator configuration: # also translate the contents of these HTML attributes localizable_html_attributes: ['title'] - .. code-block:: xml - - - - - - - - - - - - - - title - - - - - .. code-block:: php // config/packages/translation.php diff --git a/validation/translations.rst b/validation/translations.rst index db2cd518eb7..37defea81fc 100644 --- a/validation/translations.rst +++ b/validation/translations.rst @@ -169,25 +169,6 @@ The default translation domain can be changed globally using the validation: translation_domain: validation_errors - .. code-block:: xml - - - - - - - - - - .. code-block:: php // config/packages/validator.php diff --git a/webhook.rst b/webhook.rst index 0beceae2cb7..77c04b22f94 100644 --- a/webhook.rst +++ b/webhook.rst @@ -63,26 +63,6 @@ component routing: service: 'mailer.webhook.request_parser.mailgun' secret: '%env(MAILER_MAILGUN_SECRET)%' - .. code-block:: xml - - - - - - - - mailer.webhook.request_parser.mailgun - %env(MAILER_MAILGUN_SECRET)% - - - - - .. code-block:: php // config/packages/framework.php diff --git a/workflow.rst b/workflow.rst index f203a8a5402..270a6b071a2 100644 --- a/workflow.rst +++ b/workflow.rst @@ -76,50 +76,6 @@ follows: from: reviewed to: rejected - .. code-block:: xml - - - - - - - - - - - currentPlace - - App\Entity\BlogPost - draft - - - draft - reviewed - rejected - published - - - draft - reviewed - - - reviewed - published - - - reviewed - rejected - - - - - .. code-block:: php // config/packages/workflow.php @@ -336,43 +292,6 @@ and transitions: from: !php/enum App\Enumeration\BlogPostStatus::Reviewed to: !php/enum App\Enumeration\BlogPostStatus::Rejected - .. code-block:: xml - - - - - - - - - - status - - App\Entity\BlogPost - draft - - - draft - reviewed - - - reviewed - published - - - reviewed - rejected - - - - - .. code-block:: php // config/packages/workflow.php @@ -450,29 +369,6 @@ when needed and vice-versa when working with your objects:: # ... - .. code-block:: xml - - - - - - - - places="App\Workflow\MyWorkflow::PLACE_*" - - places="App\Enumeration\BlogPostStatus::*"> - - - - - .. code-block:: php // config/packages/workflow.php @@ -866,30 +762,6 @@ to :ref:`Guard events `, which are always fired: # ... - .. code-block:: xml - - - - - - - - workflow.leave - workflow.completed - - - - - - - - - .. code-block:: php // config/packages/workflow.php @@ -1021,49 +893,6 @@ transition. The value of this option is any valid expression created with the from: reviewed to: rejected - .. code-block:: xml - - - - - - - - - - - - - is_granted("ROLE_REVIEWER") - draft - reviewed - - - - - is_authenticated - reviewed - published - - - - - is_granted("ROLE_ADMIN") and subject.isStatusReviewed() - reviewed - rejected - - - - - - - .. code-block:: php // config/packages/workflow.php @@ -1186,24 +1015,6 @@ it: marking_store: service: 'App\Workflow\MarkingStore\BlogPostMarkingStore' - .. code-block:: xml - - - - - - - - - - - - .. code-block:: php // config/packages/workflow.php @@ -1319,47 +1130,6 @@ be only the title of the workflow or very complex objects: hour_limit: 20 explanation: 'You can not publish after 8 PM.' - .. code-block:: xml - - - - - - - - Blog Publishing Workflow - - - - - 500 - - - - - draft - review - - 0.5 - - - - reviewed - published - - 20 - You can not publish after 8 PM. - - - - - - .. code-block:: php // config/packages/workflow.php @@ -1531,24 +1301,6 @@ After implementing your validator, configure your workflow to use it: definition_validators: - App\Workflow\Validator\BlogPublishingValidator - .. code-block:: xml - - - - - - - - App\Workflow\Validator\BlogPublishingValidator - - - - .. code-block:: php // config/packages/workflow.php diff --git a/workflow/dumping-workflows.rst b/workflow/dumping-workflows.rst index 8262fefd6c1..971cf6abec4 100644 --- a/workflow/dumping-workflows.rst +++ b/workflow/dumping-workflows.rst @@ -161,104 +161,6 @@ Below is the configuration for the pull request state machine with styling added from: closed to: review - .. code-block:: xml - - - - - - - - - method - currentPlace - - - App\Entity\PullRequest - - start - - start - coding - test - - - Human review - - - merged - - - DeepSkyBlue - - - - - start - - test - - - - coding - test - review - - test - - - Turquoise - - - - - test - - review - - - Orange - - - - - review - - coding - - - - review - - merged - - - Accept PR - - - - - review - - closed - - - - closed - - review - - - - - - - .. code-block:: php // config/packages/workflow.php diff --git a/workflow/workflow-and-state-machine.rst b/workflow/workflow-and-state-machine.rst index 661eaae315e..3992e7cfa2f 100644 --- a/workflow/workflow-and-state-machine.rst +++ b/workflow/workflow-and-state-machine.rst @@ -115,82 +115,6 @@ Below is the configuration for the pull request state machine. from: closed to: review - .. code-block:: xml - - - - - - - - start - - - - - App\Entity\PullRequest - - start - coding - test - review - merged - closed - - - start - - test - - - - coding - test - review - - test - - - - test - - review - - - - review - - coding - - - - review - - merged - - - - review - - closed - - - - closed - - review - - - - - - - .. code-block:: php // config/packages/workflow.php