From 291cded9c71731284f03ab10d9bcb7da0ca26420 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Thu, 1 Jun 2023 11:36:26 +0200 Subject: [PATCH 001/477] Upgrade the minimum PHP version requirement for Symfony 7.0 --- setup.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.rst b/setup.rst index 7bb5a8010a2..b75335c9dd6 100644 --- a/setup.rst +++ b/setup.rst @@ -14,7 +14,7 @@ Technical Requirements Before creating your first Symfony application you must: -* Install PHP 8.1 or higher and these PHP extensions (which are installed and +* Install PHP 8.2 or higher and these PHP extensions (which are installed and enabled by default in most PHP 8 installations): `Ctype`_, `iconv`_, `PCRE`_, `Session`_, `SimpleXML`_, and `Tokenizer`_; * `Install Composer`_, which is used to install PHP packages. From 68f135862f28f388b90ae9196380697f80e7ba08 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Mon, 5 Jun 2023 08:37:14 +0200 Subject: [PATCH 002/477] Update setup docs for Symfony 7.0 --- setup.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/setup.rst b/setup.rst index e8f3ee791a2..0ad060d8480 100644 --- a/setup.rst +++ b/setup.rst @@ -46,10 +46,10 @@ application: .. code-block:: terminal # run this if you are building a traditional web application - $ symfony new my_project_directory --version="6.4.*@dev" --webapp + $ symfony new my_project_directory --version="7.0.*@dev" --webapp # run this if you are building a microservice, console application or API - $ symfony new my_project_directory --version="6.4.*@dev" + $ symfony new my_project_directory --version="7.0.*@dev" The only difference between these two commands is the number of packages installed by default. The ``--webapp`` option installs all the packages that you @@ -61,12 +61,12 @@ Symfony application using Composer: .. code-block:: terminal # run this if you are building a traditional web application - $ composer create-project symfony/skeleton:"6.4.*@dev" my_project_directory + $ composer create-project symfony/skeleton:"7.0.*@dev" my_project_directory $ cd my_project_directory $ composer require webapp # run this if you are building a microservice, console application or API - $ composer create-project symfony/skeleton:"6.4.*@dev" my_project_directory + $ composer create-project symfony/skeleton:"7.0.*@dev" my_project_directory No matter which command you run to create the Symfony application. All of them will create a new ``my_project_directory/`` directory, download some dependencies From 2d674cf6abd9716fbfc71e3c00e6f54f56a1f78f Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Fri, 30 Jun 2023 14:04:31 +0200 Subject: [PATCH 003/477] [Console] Remove occurrences of `$defaultName` and `$defaultDescription` --- console.rst | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/console.rst b/console.rst index 4038c16f83e..edac5545e9e 100644 --- a/console.rst +++ b/console.rst @@ -146,13 +146,12 @@ You can optionally define a description, help message and the // ... class CreateUserCommand extends Command { - // the command description shown when running "php bin/console list" - protected static $defaultDescription = 'Creates a new user.'; - // ... protected function configure(): void { $this + // the command description shown when running "php bin/console list" + ->setDescription('Creates a new user.') // the command help shown when running the command with the "--help" option ->setHelp('This command allows you to create a user...') ; @@ -161,15 +160,16 @@ You can optionally define a description, help message and the .. tip:: - Defining the ``$defaultDescription`` static property instead of using the - ``setDescription()`` method allows to get the command description without + Using the ``#[AsCommand]`` attribute to define a description instead of + using the ``setDescription()`` method allows to get the command description without instantiating its class. This makes the ``php bin/console list`` command run much faster. If you want to always run the ``list`` command fast, add the ``--short`` option to it (``php bin/console list --short``). This will avoid instantiating command classes, but it won't show any description for commands that use the - ``setDescription()`` method instead of the static property. + ``setDescription()`` method instead of the attribute to define the command + description. The ``configure()`` method is called automatically at the end of the command constructor. If your command defines its own constructor, set the properties @@ -216,8 +216,6 @@ You can register the command by adding the ``AsCommand`` attribute to it:: use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; - // the "name" and "description" arguments of AsCommand replace the - // static $defaultName and $defaultDescription properties #[AsCommand( name: 'app:create-user', description: 'Creates a new user.', From 1a68fb07e9ecb73b108dad68183f04aaf2aae2ed Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Fri, 30 Jun 2023 18:05:09 +0200 Subject: [PATCH 004/477] [HttpKernel] Remove `ContainerAwareInterface` occurrence --- components/http_kernel.rst | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/components/http_kernel.rst b/components/http_kernel.rst index 90e0194f529..937028c28a4 100644 --- a/components/http_kernel.rst +++ b/components/http_kernel.rst @@ -258,18 +258,6 @@ on the request's information. b) A new instance of your controller class is instantiated with no constructor arguments. - c) If the controller implements :class:`Symfony\\Component\\DependencyInjection\\ContainerAwareInterface`, - ``setContainer()`` is called on the controller object and the container - is passed to it. This step is also specific to the :class:`Symfony\\Bundle\\FrameworkBundle\\Controller\\ControllerResolver` - sub-class used by the Symfony Framework. - -.. deprecated:: 6.4 - - :class:`Symfony\\Component\\DependencyInjection\\ContainerAwareInterface` and - :class:`Symfony\\Component\\DependencyInjection\\ContainerAwareTrait` are - deprecated since Symfony 6.4. Dependency injection should be used instead to - access the service container. - .. _component-http-kernel-kernel-controller: 3) The ``kernel.controller`` Event From e46a7a0a28d9740ed8590d4bc67522c644f8c3b7 Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Fri, 30 Jun 2023 19:48:14 +0200 Subject: [PATCH 005/477] Remove deprecated directive --- reference/forms/types/options/model_timezone.rst.inc | 6 ------ 1 file changed, 6 deletions(-) diff --git a/reference/forms/types/options/model_timezone.rst.inc b/reference/forms/types/options/model_timezone.rst.inc index 44050e89219..0ef0efe1b56 100644 --- a/reference/forms/types/options/model_timezone.rst.inc +++ b/reference/forms/types/options/model_timezone.rst.inc @@ -6,10 +6,4 @@ Timezone that the input data is stored in. This must be one of the `PHP supported timezones`_. -.. deprecated:: 6.4 - - Starting from Symfony 6.4, it's deprecated to pass ``DateTime`` or ``DateTimeImmutable`` - values to this form field with a different timezone than the one configured with - the ``model_timezone`` option. - .. _`PHP supported timezones`: https://www.php.net/manual/en/timezones.php From ba5059e10fa24b62501e79f0fd9f2e81ba321fb2 Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Tue, 4 Jul 2023 10:13:58 +0200 Subject: [PATCH 006/477] [ExpressionLanguage] `in` and `not in` operators are using strict comparison --- reference/formats/expression_language.rst | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/reference/formats/expression_language.rst b/reference/formats/expression_language.rst index 18811c0ca44..ebb7574922c 100644 --- a/reference/formats/expression_language.rst +++ b/reference/formats/expression_language.rst @@ -352,12 +352,9 @@ For example:: The ``$inGroup`` would evaluate to ``true``. -.. deprecated:: 6.3 +.. note:: - In Symfony versions previous to 6.3, ``in`` and ``not in`` operators - were using loose comparison. Using these operators with variables of - different types is now deprecated, and these operators will be using - strict comparison from Symfony 7.0. + The ``in`` and ``not in`` operators are using strict comparison. Numeric Operators ~~~~~~~~~~~~~~~~~ From b44d4c41f5cb0247639f745ec983c60b1328b531 Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Tue, 4 Jul 2023 14:12:02 +0200 Subject: [PATCH 007/477] [Validator] Remove deprecated `ExpressionLanguageSyntax` constraint --- .../constraints/ExpressionLanguageSyntax.rst | 127 ------------------ reference/constraints/ExpressionSyntax.rst | 6 - 2 files changed, 133 deletions(-) delete mode 100644 reference/constraints/ExpressionLanguageSyntax.rst diff --git a/reference/constraints/ExpressionLanguageSyntax.rst b/reference/constraints/ExpressionLanguageSyntax.rst deleted file mode 100644 index f10956c4046..00000000000 --- a/reference/constraints/ExpressionLanguageSyntax.rst +++ /dev/null @@ -1,127 +0,0 @@ -ExpressionLanguageSyntax -======================== - -.. deprecated:: 6.1 - - This constraint is deprecated since Symfony 6.1. Instead, use the - :doc:`ExpressionSyntax ` constraint. - -This constraint checks that the value is valid as an `ExpressionLanguage`_ -expression. - -========== =================================================================== -Applies to :ref:`property or method ` -Class :class:`Symfony\\Component\\Validator\\Constraints\\ExpressionLanguageSyntax` -Validator :class:`Symfony\\Component\\Validator\\Constraints\\ExpressionLanguageSyntaxValidator` -========== =================================================================== - -Basic Usage ------------ - -The following constraints ensure that: - -* the ``promotion`` property stores a value which is valid as an - ExpressionLanguage expression; -* the ``shippingOptions`` property also ensures that the expression only uses - certain variables. - -.. configuration-block:: - - .. code-block:: php-attributes - - // src/Entity/Order.php - namespace App\Entity; - - use Symfony\Component\Validator\Constraints as Assert; - - class Order - { - #[Assert\ExpressionLanguageSyntax] - protected string $promotion; - - #[Assert\ExpressionLanguageSyntax( - allowedVariables: ['user', 'shipping_centers'], - )] - protected string $shippingOptions; - } - - .. code-block:: yaml - - # config/validator/validation.yaml - App\Entity\Order: - properties: - promotion: - - ExpressionLanguageSyntax: ~ - shippingOptions: - - ExpressionLanguageSyntax: - allowedVariables: ['user', 'shipping_centers'] - - .. code-block:: xml - - - - - - - - - - - - - - - - - - .. code-block:: php - - // src/Entity/Student.php - namespace App\Entity; - - use Symfony\Component\Validator\Constraints as Assert; - use Symfony\Component\Validator\Mapping\ClassMetadata; - - class Order - { - // ... - - public static function loadValidatorMetadata(ClassMetadata $metadata): void - { - $metadata->addPropertyConstraint('promotion', new Assert\ExpressionLanguageSyntax()); - - $metadata->addPropertyConstraint('shippingOptions', new Assert\ExpressionLanguageSyntax([ - 'allowedVariables' => ['user', 'shipping_centers'], - ])); - } - } - -Options -------- - -allowedVariables -~~~~~~~~~~~~~~~~ - -**type**: ``array`` or ``null`` **default**: ``null`` - -If this option is defined, the expression can only use the variables whose names -are included in this option. Unset this option or set its value to ``null`` to -allow any variables. - -.. include:: /reference/constraints/_groups-option.rst.inc - -message -~~~~~~~ - -**type**: ``string`` **default**: ``This value should be a valid expression.`` - -This is the message displayed when the validation fails. - -.. include:: /reference/constraints/_payload-option.rst.inc - -.. _`ExpressionLanguage`: https://symfony.com/components/ExpressionLanguage diff --git a/reference/constraints/ExpressionSyntax.rst b/reference/constraints/ExpressionSyntax.rst index 2a603eaa616..c1d086790c1 100644 --- a/reference/constraints/ExpressionSyntax.rst +++ b/reference/constraints/ExpressionSyntax.rst @@ -4,12 +4,6 @@ ExpressionSyntax This constraint checks that the value is valid as an `ExpressionLanguage`_ expression. -.. versionadded:: 6.1 - - This constraint was introduced in Symfony 6.1 and deprecates the previous - :doc:`ExpressionLanguageSyntax ` - constraint. - ========== =================================================================== Applies to :ref:`property or method ` Class :class:`Symfony\\Component\\Validator\\Constraints\\ExpressionSyntax` From fc0b8994ec5e153c3fb8e2572c832a142d6cc30f Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Tue, 4 Jul 2023 14:15:16 +0200 Subject: [PATCH 008/477] [Security] Remove `{username}` occurrence --- security/ldap.rst | 5 ----- 1 file changed, 5 deletions(-) diff --git a/security/ldap.rst b/security/ldap.rst index b2f5a3e753c..21ea66f480e 100644 --- a/security/ldap.rst +++ b/security/ldap.rst @@ -290,11 +290,6 @@ string will be replaced by the value of the ``uid_key`` configuration value (by default, ``sAMAccountName``), and the ``{user_identifier}`` string will be replaced by the user identified you are trying to load. -.. deprecated:: 6.2 - - Starting from Symfony 6.2, the ``{username}`` string was deprecated in favor - of ``{user_identifier}``. - For example, with a ``uid_key`` of ``uid``, and if you are trying to load the user ``fabpot``, the final string will be: ``(uid=fabpot)``. From f24c16038a8410b66f8d45553a1659084687af95 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 5 Jul 2023 09:10:28 +0200 Subject: [PATCH 009/477] [Validator] Remove the deprecated VALIDATION_MODE_LOOSE --- reference/configuration/framework.rst | 7 +------ reference/constraints/Email.rst | 10 +--------- 2 files changed, 2 insertions(+), 15 deletions(-) diff --git a/reference/configuration/framework.rst b/reference/configuration/framework.rst index 74de9fc1094..5c7eafe5531 100644 --- a/reference/configuration/framework.rst +++ b/reference/configuration/framework.rst @@ -2619,12 +2619,7 @@ constraint verifies the submitted string entropy is matching the minimum entropy email_validation_mode ..................... -**type**: ``string`` **default**: ``loose`` - -.. deprecated:: 6.2 - - The ``loose`` default value is deprecated since Symfony 6.2. Starting from - Symfony 7.0, the default value of this option will be ``html5``. +**type**: ``string`` **default**: ``html5`` Sets the default value for the :ref:`"mode" option of the Email validator `. diff --git a/reference/constraints/Email.rst b/reference/constraints/Email.rst index 19b1579b88a..3f4207471c1 100644 --- a/reference/constraints/Email.rst +++ b/reference/constraints/Email.rst @@ -104,13 +104,10 @@ Parameter Description ``mode`` ~~~~~~~~ -**type**: ``string`` **default**: (see below) +**type**: ``string`` **default**: ``html5`` This option defines the pattern used to validate the email address. Valid values are: -* ``loose`` uses a simple regular expression (just checks that at least one ``@`` - character is present, etc.). This validation is too simple and it's recommended - to use one of the other modes instead; * ``html5`` uses the regular expression of the `HTML5 email input element`_, except it enforces a tld to be present. * ``html5-allow-no-tld`` uses exactly the same regular expression as the `HTML5 email input element`_, @@ -133,11 +130,6 @@ The default value used by this option is set in the :ref:`framework.validation.email_validation_mode ` configuration option. -.. deprecated:: 6.2 - - The ``loose`` value is deprecated since Symfony 6.2. Starting from - Symfony 7.0, the default value of this option will be ``html5``. - .. include:: /reference/constraints/_normalizer-option.rst.inc .. include:: /reference/constraints/_payload-option.rst.inc From bf08b822825de7d8272ef47a76f159133a6f9252 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 5 Jul 2023 13:08:30 +0200 Subject: [PATCH 010/477] [Form] Remove the deprecated renderForm() shortcut --- forms.rst | 7 ------- 1 file changed, 7 deletions(-) diff --git a/forms.rst b/forms.rst index 806d1f47bb2..3c062c76e98 100644 --- a/forms.rst +++ b/forms.rst @@ -282,13 +282,6 @@ Now that the form has been created, the next step is to render it:: Internally, the ``render()`` method calls ``$form->createView()`` to transform the form into a *form view* instance. -.. deprecated:: 6.2 - - Prior to Symfony 6.2, you had to use ``$this->render(..., ['form' => $form->createView()])`` - or the ``renderForm()`` method to render the form. The ``renderForm()`` - method is deprecated in favor of directly passing the ``FormInterface`` - instance to ``render()``. - Then, use some :ref:`form helper functions ` to render the form contents: From e6f6bbd9f584083ed327dd967de582bca7508a9a Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Wed, 5 Jul 2023 14:02:31 +0200 Subject: [PATCH 011/477] Remove `terminate_on_cache_hit` option. --- reference/configuration/framework.rst | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/reference/configuration/framework.rst b/reference/configuration/framework.rst index 0b8fd4b0bac..82e87b67f0b 100644 --- a/reference/configuration/framework.rst +++ b/reference/configuration/framework.rst @@ -167,27 +167,6 @@ which the cache can serve a stale response when an error is encountered (default: 60). This setting is overridden by the stale-if-error HTTP Cache-Control extension (see RFC 5861). -terminate_on_cache_hit -...................... - -**type**: ``boolean`` **default**: ``true`` - -If ``true``, the :ref:`kernel.terminate ` -event is dispatched even when the cache is hit. - -Unless your application needs to process events on cache hits, it's recommended -to set this to ``false`` to improve performance, because it avoids having to -bootstrap the Symfony framework on a cache hit. - -.. versionadded:: 6.2 - - The ``terminate_on_cache_hit`` option was introduced in Symfony 6.2. - -.. deprecated:: 6.2 - - Setting the ``terminate_on_cache_hit`` option to ``true`` was deprecated in - Symfony 6.2 and the option will be removed in Symfony 7.0. - .. _configuration-framework-http_method_override: http_method_override From 1ef9746c19cb52993f6b706dd398e6ca2ae45a5d Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 5 Jul 2023 14:58:01 +0200 Subject: [PATCH 012/477] [Form] Update the default value of widget option in date/time types --- reference/forms/types/options/date_widget_description.rst.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reference/forms/types/options/date_widget_description.rst.inc b/reference/forms/types/options/date_widget_description.rst.inc index b86bdde5a0e..956ad8c7148 100644 --- a/reference/forms/types/options/date_widget_description.rst.inc +++ b/reference/forms/types/options/date_widget_description.rst.inc @@ -1,4 +1,4 @@ -**type**: ``string`` **default**: ``choice`` +**type**: ``string`` **default**: ``single_text`` The basic way in which this field should be rendered. Can be one of the following: From 16cb242026fa13653de2922dbed9a9194afb6348 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 5 Jul 2023 15:39:43 +0200 Subject: [PATCH 013/477] [Twig] Remove the deprecated autoescape option --- reference/configuration/twig.rst | 31 ------------------------------- 1 file changed, 31 deletions(-) diff --git a/reference/configuration/twig.rst b/reference/configuration/twig.rst index cc079da6745..d36584a7f6c 100644 --- a/reference/configuration/twig.rst +++ b/reference/configuration/twig.rst @@ -33,37 +33,6 @@ compiled again automatically. .. _config-twig-autoescape: -autoescape -~~~~~~~~~~ - -.. deprecated:: 6.1 - - This option is deprecated since Symfony 6.1. If required, use the - ``autoescape_service`` or ``autoescape_service_method`` option instead. - -**type**: ``boolean`` or ``string`` **default**: ``name`` - -If set to ``false``, automatic escaping is disabled (you can still escape each content -individually in the templates). - -.. caution:: - - Setting this option to ``false`` is dangerous and it will make your - application vulnerable to `XSS attacks`_ because most third-party bundles - assume that auto-escaping is enabled and they don't escape contents - themselves. - -If set to a string, the template contents are escaped using the strategy with -that name. Allowed values are ``html``, ``js``, ``css``, ``url``, ``html_attr`` -and ``name``. The default value is ``name``. This strategy escapes contents -according to the template name extension (e.g. it uses ``html`` for ``*.html.twig`` -templates and ``js`` for ``*.js.twig`` templates). - -.. tip:: - - See `autoescape_service`_ and `autoescape_service_method`_ to define your - own escaping strategy. - autoescape_service ~~~~~~~~~~~~~~~~~~ From 88408715d43bf8d3c16a7e17ef5a3812be078f54 Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Wed, 5 Jul 2023 18:16:24 +0200 Subject: [PATCH 014/477] [Messenger] Remove remaining deprecations --- messenger.rst | 12 ------------ messenger/multiple_buses.rst | 3 --- 2 files changed, 15 deletions(-) diff --git a/messenger.rst b/messenger.rst index 5a84e517415..95ae08a8ea8 100644 --- a/messenger.rst +++ b/messenger.rst @@ -1718,12 +1718,6 @@ during a request:: } } -.. versionadded:: 6.3 - - The namespace of the ``InMemoryTransport`` class changed in Symfony 6.3 from - ``Symfony\Component\Messenger\Transport\InMemoryTransport`` to - ``Symfony\Component\Messenger\Transport\InMemory\InMemoryTransport``. - The transport has a number of options: ``serialize`` (boolean, default: ``false``) @@ -2020,12 +2014,6 @@ A single handler class can handle multiple messages. For that add the } } -.. deprecated:: 6.2 - - Implementing the :class:`Symfony\\Component\\Messenger\\Handler\\MessageSubscriberInterface` - is another way to handle multiple messages with one handler class. This - interface was deprecated in Symfony 6.2. - Binding Handlers to Different Transports ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/messenger/multiple_buses.rst b/messenger/multiple_buses.rst index 49e4d3e568e..42ff8dc85d4 100644 --- a/messenger/multiple_buses.rst +++ b/messenger/multiple_buses.rst @@ -133,9 +133,6 @@ you can restrict each handler to a specific bus using the ``messenger.message_ha services: App\MessageHandler\SomeCommandHandler: tags: [{ name: messenger.message_handler, bus: command.bus }] - # prevent handlers from being registered twice (or you can remove - # the MessageHandlerInterface that autoconfigure uses to find handlers) - autoconfigure: false .. code-block:: xml From db47478951f9f0aa3eb643a7a6864e9e2e569170 Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Thu, 6 Jul 2023 13:08:03 +0200 Subject: [PATCH 015/477] [Serializer] Add needed method and return types --- serializer/custom_normalizer.rst | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/serializer/custom_normalizer.rst b/serializer/custom_normalizer.rst index 0168e0c7447..7534002da20 100644 --- a/serializer/custom_normalizer.rst +++ b/serializer/custom_normalizer.rst @@ -30,7 +30,7 @@ to customize the normalized data. To do that, leverage the ``ObjectNormalizer``: ) { } - public function normalize($topic, string $format = null, array $context = []) + public function normalize($topic, string $format = null, array $context = []): array { $data = $this->normalizer->normalize($topic, $format, $context); @@ -42,10 +42,17 @@ to customize the normalized data. To do that, leverage the ``ObjectNormalizer``: return $data; } - public function supportsNormalization($data, string $format = null, array $context = []) + public function supportsNormalization($data, string $format = null, array $context = []): bool { return $data instanceof Topic; } + + public function getSupportedTypes(?string $format): array + { + return [ + Topic::class => true, + ]; + } } Registering it in your Application From e4f0386293dcdbae694ca7b16112276e4301b659 Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Thu, 6 Jul 2023 18:57:16 +0200 Subject: [PATCH 016/477] [Lock] Remove deprecated option --- components/lock.rst | 6 ------ 1 file changed, 6 deletions(-) diff --git a/components/lock.rst b/components/lock.rst index 293eaeed84e..f92d024aac8 100644 --- a/components/lock.rst +++ b/components/lock.rst @@ -474,18 +474,12 @@ The ``MongoDbStore`` takes the following ``$options`` (depending on the first pa Option Description ============== ================================================================================================ gcProbability Should a TTL Index be created expressed as a probability from 0.0 to 1.0 (Defaults to ``0.001``) -gcProbablity Same as ``gcProbability``, see the deprecation note below database The name of the database collection The name of the collection uriOptions Array of URI options for `MongoDBClient::__construct`_ driverOptions Array of driver options for `MongoDBClient::__construct`_ ============= ================================================================================================ -.. deprecated:: 6.3 - - The ``gcProbablity`` option (notice the typo in its name) is deprecated since - Symfony 6.3, use the ``gcProbability`` option instead. - When the first parameter is a: ``MongoDB\Collection``: From a3e5a060e970e0ec63183ac4fbd81871d958b95a Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 5 Jul 2023 15:35:41 +0200 Subject: [PATCH 017/477] [Translation] Update the PHP extraction information for Symfony 7.0 --- reference/dic_tags.rst | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/reference/dic_tags.rst b/reference/dic_tags.rst index 7b953e20e3c..b003ca683b2 100644 --- a/reference/dic_tags.rst +++ b/reference/dic_tags.rst @@ -1071,23 +1071,16 @@ file When executing the ``translation:extract`` command, it uses extractors to extract translation messages from a file. By default, the Symfony Framework -has a :class:`Symfony\\Bridge\\Twig\\Translation\\TwigExtractor` and a PHP -extractor to find and extract translation keys from Twig templates and PHP files. +has a :class:`Symfony\\Bridge\\Twig\\Translation\\TwigExtractor` to find and +extract translation keys from Twig templates. -Symfony includes two PHP extractors: :class:`Symfony\\Component\\Translation\\Extractor\\PhpExtractor` -and :class:`Symfony\\Component\\Translation\\Extractor\\PhpAstExtractor`. The -first one is simple but doesn't require to install any packages; the second one -is much more advanced, but requires to install this dependency in your project: +If you also want to find and extract translation keys from PHP files, install +the following dependency to activate the :class:`Symfony\\Component\\Translation\\Extractor\\PhpAstExtractor`: .. code-block:: terminal $ composer require nikic/php-parser -.. deprecated:: 6.2 - - The ``PhpExtractor`` class is deprecated since Symfony 6.2. The ``PhpAstExtractor`` - class will be the only PHP extractor available starting from Symfony 7.0. - You can create your own extractor by creating a class that implements :class:`Symfony\\Component\\Translation\\Extractor\\ExtractorInterface` and tagging the service with ``translation.extractor``. The tag has one From 699a89fa7c1f7b694171287634c3d8e90e2b58c8 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 5 Jul 2023 15:05:23 +0200 Subject: [PATCH 018/477] Update the default value of the http_method_override option --- reference/configuration/framework.rst | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/reference/configuration/framework.rst b/reference/configuration/framework.rst index 03f46ae6d31..d7431bb264d 100644 --- a/reference/configuration/framework.rst +++ b/reference/configuration/framework.rst @@ -172,7 +172,7 @@ Cache-Control extension (see RFC 5861). http_method_override ~~~~~~~~~~~~~~~~~~~~ -**type**: ``boolean`` **default**: (see explanation below) +**type**: ``boolean`` **default**: ``false`` This determines whether the ``_method`` request parameter is used as the intended HTTP method on POST requests. If enabled, the @@ -180,18 +180,6 @@ intended HTTP method on POST requests. If enabled, the method gets called automatically. It becomes the service container parameter named ``kernel.http_method_override``. -The **default value** is: - -* ``true``, if you have an existing application that you've upgraded from an older - Symfony version without resyncing the :doc:`Symfony Flex ` recipes; -* ``false``, if you've created a new Symfony application or updated the Symfony - Flex recipes. This is also the default value starting from Symfony 7.0. - -.. deprecated:: 6.1 - - Not setting a value explicitly for this option is deprecated since Symfony 6.1 - because the default value will change to ``false`` in Symfony 7.0. - .. seealso:: :ref:`Changing the Action and HTTP Method ` of From 039ba692a58e81ff5fb2c010789740b8d550688d Mon Sep 17 00:00:00 2001 From: Gary PEGEOT Date: Mon, 10 Jul 2023 09:30:03 +0200 Subject: [PATCH 019/477] [HTTPClient] Add documentation for `HarFileResponseFactory` Fixes https://github.com/symfony/symfony-docs/issues/18546 --- http_client.rst | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/http_client.rst b/http_client.rst index 3dd9e867bc1..c11bde2d15c 100644 --- a/http_client.rst +++ b/http_client.rst @@ -2196,6 +2196,45 @@ test it in a real application:: } } +Testing using HAR files +~~~~~~~~~~~~~~~~~~~~~~~ + +The previous example can also be achieved using `HAR`_ files. You can export those files from all modern browsers (from the network tab) & +HTTP Clients. First, do the HTTP request(s) you want to test in your favorite HTTP Client / Browser, then store generated ``.har`` file somewhere in your application:: + + // ExternalArticleServiceTest.php + use PHPUnit\Framework\TestCase; + use Symfony\Component\HttpClient\MockHttpClient; + use Symfony\Component\HttpClient\Response\MockResponse; + + final class ExternalArticleServiceTest extends TestCase + { + public function testSubmitData(): void + { + // Arrange + $fixtureDir = sprintf('%s/tests/fixtures/HTTP', static::getContainer()->getParameter('kernel.project_dir')); + $factory = new HarFileResponseFactory("$fixtureDir/example.com_archive.har"); + $httpClient = new MockHttpClient($factory, 'https://example.com'); + $service = new ExternalArticleService($httpClient); + + // Act + $responseData = $service->createArticle($requestData); + + // Assert + self::assertSame($responseData, 'the expected response'); + } + } + + +If your service does multiple requests or if your `.har` file contains multiple request / response pairs, +the :class:`Symfony\\Component\\HttpClient\\Test\\HarFileResponseFactory` will find the associated response based on +the request method, url and body (if any). Note that **this doesn't work** if the request body or uri is random / always changing +(if it contains current date or random UUID(s) for example). + +.. versionadded:: 7.0 + + The ``HarFileResponseFactory`` was introduced in Symfony 7.0. + Testing Network Transport Exceptions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -2262,3 +2301,4 @@ you to do so, by yielding the exception from its body:: .. _`idempotent method`: https://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Idempotent_methods .. _`SSRF`: https://portswigger.net/web-security/ssrf .. _`RFC 6570`: https://www.rfc-editor.org/rfc/rfc6570 +.. _`HAR`: https://w3c.github.io/web-performance/specs/HAR/Overview.html From bc8d4763b700a138463629b50aa685ae160b9924 Mon Sep 17 00:00:00 2001 From: Maxime Doutreluingne Date: Sun, 9 Jul 2023 11:05:12 +0200 Subject: [PATCH 020/477] [Notifier] Remove the Sendinblue bridge --- notifier.rst | 2 -- reference/configuration/twig.rst | 1 - 2 files changed, 3 deletions(-) diff --git a/notifier.rst b/notifier.rst index 27a10a2a766..626b23f14f1 100644 --- a/notifier.rst +++ b/notifier.rst @@ -85,7 +85,6 @@ Service Package DSN `Redlink`_ ``symfony/redlink-notifier`` ``redlink://API_KEY:APP_KEY@default?from=SENDER_NAME&version=API_VERSION`` `RingCentral`_ ``symfony/ring-central-notifier`` ``ringcentral://API_TOKEN@default?from=FROM`` `Sendberry`_ ``symfony/sendberry-notifier`` ``sendberry://USERNAME:PASSWORD@default?auth_key=AUTH_KEY&from=FROM`` -`Sendinblue`_ ``symfony/sendinblue-notifier`` ``sendinblue://API_KEY@default?sender=PHONE`` `Sms77`_ ``symfony/sms77-notifier`` ``sms77://API_KEY@default?from=FROM`` `SimpleTextin`_ ``symfony/simple-textin-notifier`` ``simpletextin://API_KEY@default?from=FROM`` `Sinch`_ ``symfony/sinch-notifier`` ``sinch://ACCOUNT_ID:AUTH_TOKEN@default?from=FROM`` @@ -1024,7 +1023,6 @@ is dispatched. Listeners receive a .. _`RocketChat`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/RocketChat/README.md .. _`SMSFactor`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/SmsFactor/README.md .. _`Sendberry`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Sendberry/README.md -.. _`Sendinblue`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Sendinblue/README.md .. _`SimpleTextin`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/SimpleTextin/README.md .. _`Sinch`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Sinch/README.md .. _`Slack`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Slack/README.md diff --git a/reference/configuration/twig.rst b/reference/configuration/twig.rst index d36584a7f6c..6de8ef24742 100644 --- a/reference/configuration/twig.rst +++ b/reference/configuration/twig.rst @@ -402,4 +402,3 @@ attribute or method doesn't exist. If set to ``false`` these errors are ignored and the non-existing values are replaced by ``null``. .. _`the optimizer extension`: https://twig.symfony.com/doc/3.x/api.html#optimizer-extension -.. _`XSS attacks`: https://en.wikipedia.org/wiki/Cross-site_scripting From ec88f6d96d136b603388326209e84bf131b121b9 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Mon, 10 Jul 2023 11:48:50 +0200 Subject: [PATCH 021/477] Tweaks --- notifier.rst | 5 ----- 1 file changed, 5 deletions(-) diff --git a/notifier.rst b/notifier.rst index a8ddf6374c0..47aad3d263a 100644 --- a/notifier.rst +++ b/notifier.rst @@ -121,11 +121,6 @@ Service Package DSN The `Redlink`_ and `Brevo`_ integrations were introduced in Symfony 6.4. -.. deprecated:: 6.4 - - The `Sendinblue`_ integration is deprecated since - Symfony 6.4, use the `Brevo`_ integration instead. - To enable a texter, add the correct DSN in your ``.env`` file and configure the ``texter_transports``: From 71f2f821de2a8f28c456152cb54b531670947a53 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Mon, 10 Jul 2023 13:18:01 +0200 Subject: [PATCH 022/477] Minor rewords --- http_client.rst | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/http_client.rst b/http_client.rst index c11bde2d15c..bc0a17b581a 100644 --- a/http_client.rst +++ b/http_client.rst @@ -2196,11 +2196,15 @@ test it in a real application:: } } -Testing using HAR files +Testing Using HAR Files ~~~~~~~~~~~~~~~~~~~~~~~ -The previous example can also be achieved using `HAR`_ files. You can export those files from all modern browsers (from the network tab) & -HTTP Clients. First, do the HTTP request(s) you want to test in your favorite HTTP Client / Browser, then store generated ``.har`` file somewhere in your application:: +Modern browsers (via their network tab) and HTTP clients allow to export the +information of one or more HTTP requests using the `HAR`_ (HTTP Archive) format. +You can use those ``.har`` files to perform tests with Symfony's HTTP Client. + +First, use a browser or HTTP client to perform the HTTP request(s) you want to +test. Then, save that information as a ``.har`` file somewhere in your application:: // ExternalArticleServiceTest.php use PHPUnit\Framework\TestCase; @@ -2225,11 +2229,11 @@ HTTP Clients. First, do the HTTP request(s) you want to test in your favorite HT } } - -If your service does multiple requests or if your `.har` file contains multiple request / response pairs, -the :class:`Symfony\\Component\\HttpClient\\Test\\HarFileResponseFactory` will find the associated response based on -the request method, url and body (if any). Note that **this doesn't work** if the request body or uri is random / always changing -(if it contains current date or random UUID(s) for example). +If your service performs multiple requests or if your ``.har`` file contains multiple +request/response pairs, the :class:`Symfony\\Component\\HttpClient\\Test\\HarFileResponseFactory` +will find the associated response based on the request method, URL and body (if any). +Note that **this won't work** if the request body or URI is random / always +changing (e.g. if it contains current date or random UUIDs). .. versionadded:: 7.0 From 0068934b5c574e1a611d4f84eb8291bbab356f91 Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Tue, 11 Jul 2023 16:42:40 +0200 Subject: [PATCH 023/477] [Bridges][Bundles] Convert to native return types --- bundles/configuration.rst | 4 ++-- bundles/extension.rst | 2 +- bundles/prepend_extension.rst | 2 +- components/console/changing_default_command.rst | 6 ++++-- components/console/console_arguments.rst | 4 ++-- components/console/logger.rst | 4 +++- components/dependency_injection/compilation.rst | 2 +- configuration/using_parameters_in_dic.rst | 2 +- console/calling_commands.rst | 2 +- console/verbosity.rst | 2 +- logging/monolog_console.rst | 4 +++- session.rst | 4 ++-- 12 files changed, 22 insertions(+), 16 deletions(-) diff --git a/bundles/configuration.rst b/bundles/configuration.rst index bc9efc1e0b9..366eec0d72c 100644 --- a/bundles/configuration.rst +++ b/bundles/configuration.rst @@ -458,7 +458,7 @@ the extension. You might want to change this to a more professional URL:: { // ... - public function getNamespace() + public function getNamespace(): string { return 'http://acme_company.com/schema/dic/hello'; } @@ -490,7 +490,7 @@ can place it anywhere you like. You should return this path as the base path:: { // ... - public function getXsdValidationBasePath() + public function getXsdValidationBasePath(): string { return __DIR__.'/../Resources/config/schema'; } diff --git a/bundles/extension.rst b/bundles/extension.rst index f831efdaf5b..82c8fb05183 100644 --- a/bundles/extension.rst +++ b/bundles/extension.rst @@ -34,7 +34,7 @@ This is how the extension of an AcmeHelloBundle should look like:: class AcmeHelloExtension extends Extension { - public function load(array $configs, ContainerBuilder $container) + public function load(array $configs, ContainerBuilder $container): void { // ... you'll load the files here later } diff --git a/bundles/prepend_extension.rst b/bundles/prepend_extension.rst index 8d28080470f..b94b647671e 100644 --- a/bundles/prepend_extension.rst +++ b/bundles/prepend_extension.rst @@ -31,7 +31,7 @@ To give an Extension the power to do this, it needs to implement { // ... - public function prepend(ContainerBuilder $container) + public function prepend(ContainerBuilder $container): void { // ... } diff --git a/components/console/changing_default_command.rst b/components/console/changing_default_command.rst index f8b100993a9..b739e3b39ba 100644 --- a/components/console/changing_default_command.rst +++ b/components/console/changing_default_command.rst @@ -15,14 +15,16 @@ name to the ``setDefaultCommand()`` method:: #[AsCommand(name: 'hello:world')] class HelloWorldCommand extends Command { - protected function configure() + protected function configure(): void { $this->setDescription('Outputs "Hello World"'); } - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): int { $output->writeln('Hello World'); + + return Command::SUCCESS; } } diff --git a/components/console/console_arguments.rst b/components/console/console_arguments.rst index d7bf141f4ce..da538ac78f1 100644 --- a/components/console/console_arguments.rst +++ b/components/console/console_arguments.rst @@ -22,7 +22,7 @@ Have a look at the following command that has three options:: #[AsCommand(name: 'demo:args', description: 'Describe args behaviors')] class DemoArgsCommand extends Command { - protected function configure() + protected function configure(): void { $this ->setDefinition( @@ -34,7 +34,7 @@ Have a look at the following command that has three options:: ); } - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): int { // ... } diff --git a/components/console/logger.rst b/components/console/logger.rst index afeab7dd0cb..5aa72a9d02d 100644 --- a/components/console/logger.rst +++ b/components/console/logger.rst @@ -44,12 +44,14 @@ You can rely on the logger to use this dependency inside a command:: )] class MyCommand extends Command { - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): int { $logger = new ConsoleLogger($output); $myDependency = new MyDependency($logger); $myDependency->doStuff(); + + return Command::SUCCESS; } } diff --git a/components/dependency_injection/compilation.rst b/components/dependency_injection/compilation.rst index 1f450df28ed..64209c1586c 100644 --- a/components/dependency_injection/compilation.rst +++ b/components/dependency_injection/compilation.rst @@ -408,7 +408,7 @@ class implementing the ``CompilerPassInterface``:: class CustomPass implements CompilerPassInterface { - public function process(ContainerBuilder $container) + public function process(ContainerBuilder $container): void { // ... do something during the compilation } diff --git a/configuration/using_parameters_in_dic.rst b/configuration/using_parameters_in_dic.rst index 05008114e01..259a0b9d974 100644 --- a/configuration/using_parameters_in_dic.rst +++ b/configuration/using_parameters_in_dic.rst @@ -135,7 +135,7 @@ And set it in the constructor of ``Configuration`` via the ``Extension`` class:: { // ... - public function getConfiguration(array $config, ContainerBuilder $container) + public function getConfiguration(array $config, ContainerBuilder $container): Configuration { return new Configuration($container->getParameter('kernel.debug')); } diff --git a/console/calling_commands.rst b/console/calling_commands.rst index 001dc47e35e..089688767fe 100644 --- a/console/calling_commands.rst +++ b/console/calling_commands.rst @@ -27,7 +27,7 @@ method):: { // ... - protected function execute(InputInterface $input, OutputInterface $output): void + protected function execute(InputInterface $input, OutputInterface $output): int { $command = $this->getApplication()->find('demo:greet'); diff --git a/console/verbosity.rst b/console/verbosity.rst index 7df68d30f23..f7a1a1e5e59 100644 --- a/console/verbosity.rst +++ b/console/verbosity.rst @@ -69,7 +69,7 @@ level. For example:: OutputInterface::VERBOSITY_VERBOSE ); - return 0; + return Command::SUCCESS; } } diff --git a/logging/monolog_console.rst b/logging/monolog_console.rst index ad06cfabbff..8d296883b50 100644 --- a/logging/monolog_console.rst +++ b/logging/monolog_console.rst @@ -47,10 +47,12 @@ The example above could then be rewritten as:: ) { } - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): int { $this->logger->debug('Some info'); $this->logger->notice('Some more info'); + + return Command::SUCCESS; } } diff --git a/session.rst b/session.rst index 1dcbaa71b4b..2f8848f860b 100644 --- a/session.rst +++ b/session.rst @@ -1464,7 +1464,7 @@ event:: ) { } - public function onInteractiveLogin(InteractiveLoginEvent $event) + public function onInteractiveLogin(InteractiveLoginEvent $event): void { $user = $event->getAuthenticationToken()->getUser(); @@ -1473,7 +1473,7 @@ event:: } } - public static function getSubscribedEvents() + public static function getSubscribedEvents(): array { return [ SecurityEvents::INTERACTIVE_LOGIN => 'onInteractiveLogin', From 7b9f807a7b56e1886530865504dda235a0d779e1 Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Mon, 17 Jul 2023 13:38:11 +0200 Subject: [PATCH 024/477] [Serializer] Remove `CacheableSupportsMethodInterface` --- serializer/custom_normalizer.rst | 41 ++++---------------------------- 1 file changed, 5 insertions(+), 36 deletions(-) diff --git a/serializer/custom_normalizer.rst b/serializer/custom_normalizer.rst index ec121a2f54b..25528fff54e 100644 --- a/serializer/custom_normalizer.rst +++ b/serializer/custom_normalizer.rst @@ -63,8 +63,8 @@ a service and :doc:`tagged ` with ``serializer.normaliz If you're using the :ref:`default services.yaml configuration `, this is done automatically! -Performance ------------ +Performance of Normalizers/Denormalizers +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ To figure which normalizer (or denormalizer) must be used to handle an object, the :class:`Symfony\\Component\\Serializer\\Serializer` class will call the @@ -72,39 +72,10 @@ the :class:`Symfony\\Component\\Serializer\\Serializer` class will call the (or :method:`Symfony\\Component\\Serializer\\Normalizer\\DenormalizerInterface::supportsDenormalization`) of all registered normalizers (or denormalizers) in a loop. -The result of these methods can vary depending on the object to serialize, the -format and the context. That's why the result **is not cached** by default and -can result in a significant performance bottleneck. - -However, most normalizers (and denormalizers) always return the same result when -the object's type and the format are the same, so the result can be cached. To -do so, make those normalizers (and denormalizers) implement the -:class:`Symfony\\Component\\Serializer\\Normalizer\\CacheableSupportsMethodInterface` -and return ``true`` when -:method:`Symfony\\Component\\Serializer\\Normalizer\\CacheableSupportsMethodInterface::hasCacheableSupportsMethod` -is called. - -.. note:: - - All built-in :ref:`normalizers and denormalizers ` - as well the ones included in `API Platform`_ natively implement this interface. - -.. deprecated:: 6.3 - - The :class:`Symfony\\Component\\Serializer\\Normalizer\\CacheableSupportsMethodInterface` - interface is deprecated since Symfony 6.3. You should implement the - ``getSupportedTypes()`` method instead, as shown in the section below. - -Improving Performance of Normalizers/Denormalizers -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -.. versionadded:: 6.3 - - The ``getSupportedTypes()`` method was introduced in Symfony 6.3. - -Both :class:`Symfony\\Component\\Serializer\\Normalizer\\NormalizerInterface` +Additionally, both +:class:`Symfony\\Component\\Serializer\\Normalizer\\NormalizerInterface` and :class:`Symfony\\Component\\Serializer\\Normalizer\\DenormalizerInterface` -contain a new method ``getSupportedTypes()``. This method allows normalizers or +contain the ``getSupportedTypes()`` method. This method allows normalizers or denormalizers to declare the type of objects they can handle, and whether they are cacheable. With this info, even if the ``supports*()`` call is not cacheable, the Serializer can skip a ton of method calls to ``supports*()`` improving @@ -148,5 +119,3 @@ Here is an example of how to use the ``getSupportedTypes()`` method:: Note that ``supports*()`` method implementations should not assume that ``getSupportedTypes()`` has been called before. - -.. _`API Platform`: https://api-platform.com From 0fd8f8fa532a3bafed52504670f4ad339b34a712 Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Mon, 24 Jul 2023 14:21:18 +0200 Subject: [PATCH 025/477] [Serializer] Custom normalizer update --- serializer/custom_normalizer.rst | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/serializer/custom_normalizer.rst b/serializer/custom_normalizer.rst index 25528fff54e..58e6ef2d075 100644 --- a/serializer/custom_normalizer.rst +++ b/serializer/custom_normalizer.rst @@ -12,7 +12,10 @@ Creating a New Normalizer Imagine you want add, modify, or remove some properties during the serialization process. For that you'll have to create your own normalizer. But it's usually preferable to let Symfony normalize the object, then hook into the normalization -to customize the normalized data. To do that, leverage the ``ObjectNormalizer``:: +to customize the normalized data. To do that, leverage the +``NormalizerAwareInterface`` and the ``NormalizerAwareTrait``. This will give +you access to a ``$normalizer`` property which takes care of most of the +normalization process:: // src/Serializer/TopicNormalizer.php namespace App\Serializer; @@ -20,13 +23,13 @@ to customize the normalized data. To do that, leverage the ``ObjectNormalizer``: use App\Entity\Topic; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; - use Symfony\Component\Serializer\Normalizer\ObjectNormalizer; - class TopicNormalizer implements NormalizerInterface + class TopicNormalizer implements NormalizerInterface, NormalizerAwareInterface { + use NormalizerAwareTrait; + public function __construct( private UrlGeneratorInterface $router, - private ObjectNormalizer $normalizer, ) { } From 4927b6e38bf0cf6aefc1ddf50e5a15b92e583cd2 Mon Sep 17 00:00:00 2001 From: Jules Pietri Date: Mon, 24 Jul 2023 15:45:26 +0200 Subject: [PATCH 026/477] [Security] Remove deprecated XML config --- security/custom_authenticator.rst | 2 +- security/entry_point.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/security/custom_authenticator.rst b/security/custom_authenticator.rst index d9debbb1fb0..f2d7fb57c14 100644 --- a/security/custom_authenticator.rst +++ b/security/custom_authenticator.rst @@ -105,7 +105,7 @@ The authenticator can be enabled using the ``custom_authenticators`` setting: http://symfony.com/schema/dic/security https://symfony.com/schema/dic/security/security-1.0.xsd"> - + diff --git a/security/entry_point.rst b/security/entry_point.rst index e99a4039fcb..b23f45db957 100644 --- a/security/entry_point.rst +++ b/security/entry_point.rst @@ -42,7 +42,7 @@ You can configure this using the ``entry_point`` setting: http://symfony.com/schema/dic/security https://symfony.com/schema/dic/security/security-1.0.xsd"> - + @@ -248,7 +243,7 @@ listener in the Symfony application by creating a new service for it and // this is the only required option for the lifecycle listener tag 'event' => 'postPersist', - // listeners can define their priority in case multiple subscribers or listeners are associated + // listeners can define their priority in case multiple listeners are associated // to the same event (default priority = 0; higher numbers = listener is run earlier) 'priority' => 500, @@ -262,12 +257,6 @@ listener in the Symfony application by creating a new service for it and The `AsDoctrineListener`_ attribute was introduced in DoctrineBundle 2.7.2. -.. tip:: - - Symfony loads (and instantiates) Doctrine listeners only when the related - Doctrine event is actually fired; whereas Doctrine subscribers are always - loaded (and instantiated) by Symfony, making them less performant. - .. tip:: The value of the ``connection`` option can also be a @@ -414,148 +403,6 @@ with the ``doctrine.orm.entity_listener`` tag as follows: ; }; -Doctrine Lifecycle Subscribers ------------------------------- - -Lifecycle subscribers are defined as PHP classes that implement the -``Doctrine\Common\EventSubscriber`` interface and which listen to one or more -Doctrine events on all the application entities. For example, suppose that you -want to log all the database activity. To do so, define a subscriber for the -``postPersist``, ``postRemove`` and ``postUpdate`` Doctrine events:: - - // src/EventListener/DatabaseActivitySubscriber.php - namespace App\EventListener; - - use App\Entity\Product; - use Doctrine\Bundle\DoctrineBundle\EventSubscriber\EventSubscriberInterface; - use Doctrine\ORM\Event\PostPersistEventArgs; - use Doctrine\ORM\Event\PostRemoveEventArgs; - use Doctrine\ORM\Event\PostUpdateEventArgs; - use Doctrine\ORM\Events; - - class DatabaseActivitySubscriber implements EventSubscriberInterface - { - // this method can only return the event names; you cannot define a - // custom method name to execute when each event triggers - public function getSubscribedEvents(): array - { - return [ - Events::postPersist, - Events::postRemove, - Events::postUpdate, - ]; - } - - // callback methods must be called exactly like the events they listen to; - // they receive an argument of type Post*EventArgs, which gives you access - // to both the entity object of the event and the entity manager itself - public function postPersist(PostPersistEventArgs $args): void - { - $this->logActivity('persist', $args->getObject()); - } - - public function postRemove(PostRemoveEventArgs $args): void - { - $this->logActivity('remove', $args->getObject()); - } - - public function postUpdate(PostUpdateEventArgs $args): void - { - $this->logActivity('update', $args->getObject()); - } - - private function logActivity(string $action, mixed $entity): void - { - // if this subscriber only applies to certain entity types, - // add some code to check the entity type as early as possible - if (!$entity instanceof Product) { - return; - } - - // ... get the entity information and log it somehow - } - } - -.. note:: - - In previous Doctrine versions, instead of ``Post*EventArgs`` classes, you had - to use ``LifecycleEventArgs``, which was deprecated in Doctrine ORM 2.14. - -If you're using the :ref:`default services.yaml configuration ` -and DoctrineBundle 2.1 (released May 25, 2020) or newer, this example will already -work! Otherwise, :ref:`create a service ` for this -subscriber and :doc:`tag it ` with ``doctrine.event_subscriber``. - -If you need to configure some option of the subscriber (e.g. its priority or -Doctrine connection to use) you must do that in the manual service configuration: - -.. configuration-block:: - - .. code-block:: yaml - - # config/services.yaml - services: - # ... - - App\EventListener\DatabaseActivitySubscriber: - tags: - - name: 'doctrine.event_subscriber' - - # subscribers can define their priority in case multiple subscribers or listeners are associated - # to the same event (default priority = 0; higher numbers = listener is run earlier) - priority: 500 - - # you can also restrict listeners to a specific Doctrine connection - connection: 'default' - - .. code-block:: xml - - - - - - - - - - - - - - - .. code-block:: php - - // config/services.php - namespace Symfony\Component\DependencyInjection\Loader\Configurator; - - use App\EventListener\DatabaseActivitySubscriber; - - return static function (ContainerConfigurator $container): void { - $services = $container->services(); - - $services->set(DatabaseActivitySubscriber::class) - ->tag('doctrine.event_subscriber'[ - // subscribers can define their priority in case multiple subscribers or listeners are associated - // to the same event (default priority = 0; higher numbers = listener is run earlier) - 'priority' => 500, - - // you can also restrict listeners to a specific Doctrine connection - 'connection' => 'default', - ]) - ; - }; - -.. tip:: - - Symfony loads (and instantiates) Doctrine subscribers whenever the - application executes; whereas Doctrine listeners are only loaded when the - related event is actually fired, making them more performant. - .. _`Doctrine`: https://www.doctrine-project.org/ .. _`lifecycle events`: https://www.doctrine-project.org/projects/doctrine-orm/en/current/reference/events.html#lifecycle-events .. _`official docs about Doctrine events`: https://www.doctrine-project.org/projects/doctrine-orm/en/current/reference/events.html diff --git a/mailer.rst b/mailer.rst index 8dc952f2fb9..22807ed3533 100644 --- a/mailer.rst +++ b/mailer.rst @@ -581,12 +581,6 @@ Alternatively you can attach contents from a stream by passing it directly to th ->addPart(new DataPart(fopen('/path/to/documents/contract.doc', 'r'))) ; -.. deprecated:: 6.2 - - In Symfony versions previous to 6.2, the methods ``attachFromPath()`` and - ``attach()`` could be used to add attachments. These methods have been - deprecated and replaced with ``addPart()``. - Embedding Images ~~~~~~~~~~~~~~~~ @@ -628,12 +622,6 @@ images inside the HTML contents:: The support of embedded images as HTML backgrounds was introduced in Symfony 6.1. -.. deprecated:: 6.2 - - In Symfony versions previous to 6.2, the methods ``embedFromPath()`` and - ``embed()`` could be used to embed images. These methods have been deprecated - and replaced with ``addPart()`` together with inline ``DataPart`` objects. - .. _mailer-configure-email-globally: Configuring Emails Globally @@ -1561,7 +1549,7 @@ Here's an example of making one available to download:: { $message = (new DraftEmail()) ->html($this->renderView(/* ... */)) - ->attach(/* ... */) + ->addPart(/* ... */) ; $response = new Response($message->toString()); diff --git a/messenger.rst b/messenger.rst index c30e05c8836..b6ea33e8094 100644 --- a/messenger.rst +++ b/messenger.rst @@ -889,12 +889,6 @@ properties in the ``reset()`` method. If you don't want to reset the container, add the ``--no-reset`` option when running the ``messenger:consume`` command. -.. deprecated:: 6.1 - - In Symfony versions previous to 6.1, the service container didn't reset - automatically between messages and you had to set the - ``framework.messenger.reset_on_message`` option to ``true``. - .. _messenger-retries-failures: Retries & Failures diff --git a/reference/attributes.rst b/reference/attributes.rst index 761099a7356..6d0c4efa9ba 100644 --- a/reference/attributes.rst +++ b/reference/attributes.rst @@ -5,11 +5,6 @@ Attributes are the successor of annotations since PHP 8. Attributes are native to the language and Symfony takes full advantage of them across the framework and its different components. -.. deprecated:: 6.4 - - Annotations across the framework are deprecated since Symfony 6.4, you must - only use attributes instead. - Doctrine Bridge ~~~~~~~~~~~~~~~ diff --git a/reference/configuration/doctrine.rst b/reference/configuration/doctrine.rst index b1f2139034a..e28c50978e1 100644 --- a/reference/configuration/doctrine.rst +++ b/reference/configuration/doctrine.rst @@ -270,13 +270,9 @@ you can control. The following configuration options exist for a mapping: ``type`` ........ -One of ``annotation`` (for PHP annotations; it's the default value), -``attribute`` (for PHP attributes), ``xml``, ``yml``, ``php`` or -``staticphp``. This specifies which type of metadata type your mapping uses. - -.. deprecated:: 6.4 - - Annotations are deprecated since Symfony 6.4, use attributes instead. +One of ``attribute`` (for PHP attributes; it's the default value), +``xml``, ``yml``, ``php`` or ``staticphp``. This specifies which +type of metadata type your mapping uses. See `Doctrine Metadata Drivers`_ for more information about this option. diff --git a/reference/formats/expression_language.rst b/reference/formats/expression_language.rst index f38c951e372..a561ed5ce6d 100644 --- a/reference/formats/expression_language.rst +++ b/reference/formats/expression_language.rst @@ -333,7 +333,7 @@ Array Operators * ``in`` (contain) * ``not in`` (does not contain) -For example:: +These operators are using strict comparison. For example:: class User { diff --git a/reference/forms/types/options/date_widget_description.rst.inc b/reference/forms/types/options/date_widget_description.rst.inc index 99573a2358a..956ad8c7148 100644 --- a/reference/forms/types/options/date_widget_description.rst.inc +++ b/reference/forms/types/options/date_widget_description.rst.inc @@ -10,8 +10,3 @@ following: * ``single_text``: renders a single input of type ``date``. User's input is validated based on the `format`_ option. - -.. deprecated:: 6.3 - - Not setting a value explicitly for this option is deprecated since Symfony 6.3 - because the default value will change to ``single_text`` in Symfony 7.0. diff --git a/serializer/custom_normalizer.rst b/serializer/custom_normalizer.rst index 0ee272f0325..58e6ef2d075 100644 --- a/serializer/custom_normalizer.rst +++ b/serializer/custom_normalizer.rst @@ -58,15 +58,6 @@ normalization process:: } } -.. deprecated:: 6.4 - - Injecting an ``ObjectNormalizer`` in your custom normalizer is deprecated - since Symfony 6.4. Implement the - :class:`Symfony\\Component\\Serializer\\Normalizer\\NormalizerAwareInterface` - and use the - :class:`Symfony\\Component\\Serializer\\Normalizer\\NormalizerAwareTrait` instead - to inject the ``$normalizer`` property. - Registering it in your Application ---------------------------------- diff --git a/service_container/service_decoration.rst b/service_container/service_decoration.rst index 8a9ac1322f2..0262ae03e7e 100644 --- a/service_container/service_decoration.rst +++ b/service_container/service_decoration.rst @@ -211,12 +211,6 @@ automatically changed to ``'.inner'``): ->args([service('.inner')]); }; -.. deprecated:: 6.3 - - The ``#[MapDecorated]`` attribute is deprecated since Symfony 6.3. - Instead, use the - :class:`#[AutowireDecorated] ` attribute. - .. tip:: The visibility of the decorated ``App\Mailer`` service (which is an alias From bae960241c7f044659e3c503b79d63f85e8b960b Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Thu, 17 Aug 2023 12:47:16 +0200 Subject: [PATCH 029/477] clean up more legacy annotation config --- components/validator/resources.rst | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/components/validator/resources.rst b/components/validator/resources.rst index 19b0c54b6ec..1b512942325 100644 --- a/components/validator/resources.rst +++ b/components/validator/resources.rst @@ -88,30 +88,24 @@ The AnnotationLoader At last, the component provides an :class:`Symfony\\Component\\Validator\\Mapping\\Loader\\AnnotationLoader` to get -the metadata from the annotations of the class. Annotations are defined as ``@`` -prefixed classes included in doc block comments (``/** ... */``). For example:: +the metadata from the attributes of the class:: use Symfony\Component\Validator\Constraints as Assert; // ... class User { - /** - * @Assert\NotBlank - */ + #[Assert\NotBlank] protected string $name; } To enable the annotation loader, call the -:method:`Symfony\\Component\\Validator\\ValidatorBuilder::enableAnnotationMapping` method. -If you use annotations instead of attributes, it's also required to call -``addDefaultDoctrineAnnotationReader()`` to use Doctrine's annotation reader:: +:method:`Symfony\\Component\\Validator\\ValidatorBuilder::enableAnnotationMapping` method:: use Symfony\Component\Validator\Validation; $validator = Validation::createValidatorBuilder() ->enableAnnotationMapping() - ->addDefaultDoctrineAnnotationReader() // add this only when using annotations ->getValidator(); To disable the annotation loader after it was enabled, call @@ -133,7 +127,6 @@ multiple mappings:: $validator = Validation::createValidatorBuilder() ->enableAnnotationMapping(true) - ->addDefaultDoctrineAnnotationReader() ->addMethodMapping('loadValidatorMetadata') ->addXmlMapping('validator/validation.xml') ->getValidator(); From 4fbda5d91644e72c2e164b1eaeea6028e0b10765 Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Tue, 5 Sep 2023 11:11:29 +0200 Subject: [PATCH 030/477] [Workflow] Remove `GuardEvent::getContext()` method without replacement --- workflow.rst | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/workflow.rst b/workflow.rst index 88021884130..2e17b40794c 100644 --- a/workflow.rst +++ b/workflow.rst @@ -463,21 +463,6 @@ order: $workflow->apply($subject, $transitionName, [Workflow::DISABLE_ANNOUNCE_EVENT => true]); -The context is accessible in all events except for the ``workflow.guard`` events:: - - // $context must be an array - $context = ['context_key' => 'context_value']; - $workflow->apply($subject, $transitionName, $context); - - // in an event listener (workflow.guard events) - $context = $event->getContext(); // returns ['context'] - -.. deprecated:: 6.4 - - Gathering events context is deprecated since Symfony 6.4 and the - :method:`Symfony\\Component\\Workflow\\Event::getContext` method will be - removed in Symfony 7.0. - .. note:: The leaving and entering events are triggered even for transitions that stay From d7717fb4ea37ee57c3f4b5b56051c5fa82fb830f Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Tue, 5 Sep 2023 11:15:20 +0200 Subject: [PATCH 031/477] Remove mentions of AnnotationLoader --- _includes/_annotation_loader_tip.rst.inc | 19 ---------- components/validator/resources.rst | 46 ------------------------ reference/configuration/framework.rst | 24 ------------- 3 files changed, 89 deletions(-) delete mode 100644 _includes/_annotation_loader_tip.rst.inc diff --git a/_includes/_annotation_loader_tip.rst.inc b/_includes/_annotation_loader_tip.rst.inc deleted file mode 100644 index 0f4267b07f5..00000000000 --- a/_includes/_annotation_loader_tip.rst.inc +++ /dev/null @@ -1,19 +0,0 @@ -.. note:: - - In order to use the annotation loader, you should have installed the - ``doctrine/annotations`` and ``doctrine/cache`` packages with Composer. - -.. tip:: - - Annotation classes aren't loaded automatically, so you must load them - using a class loader like this:: - - use Composer\Autoload\ClassLoader; - use Doctrine\Common\Annotations\AnnotationRegistry; - - /** @var ClassLoader $loader */ - $loader = require __DIR__.'/../vendor/autoload.php'; - - AnnotationRegistry::registerLoader([$loader, 'loadClass']); - - return $loader; diff --git a/components/validator/resources.rst b/components/validator/resources.rst index dd218a26a12..d9d3543a641 100644 --- a/components/validator/resources.rst +++ b/components/validator/resources.rst @@ -83,52 +83,6 @@ configure the locations of these files:: :method:`Symfony\\Component\\Validator\\ValidatorBuilder::addXmlMappings` to configure an array of file paths. -The AnnotationLoader --------------------- - -.. deprecated:: 6.4 - - The :class:`Symfony\\Component\\Validator\\Mapping\\Loader\\AnnotationLoader` - is deprecated since Symfony 6.4, use the - :class:`Symfony\\Component\\Validator\\Mapping\\Loader\\AttributeLoader` - instead. - -The component provides an -:class:`Symfony\\Component\\Validator\\Mapping\\Loader\\AnnotationLoader` to get -the metadata from the attributes of the class:: - - use Symfony\Component\Validator\Constraints as Assert; - // ... - - class User - { - #[Assert\NotBlank] - protected string $name; - } - -To enable the annotation loader, call the -:method:`Symfony\\Component\\Validator\\ValidatorBuilder::enableAnnotationMapping` method:: - - use Symfony\Component\Validator\Validation; - - $validator = Validation::createValidatorBuilder() - ->enableAnnotationMapping() - ->getValidator(); - -To disable the annotation loader after it was enabled, call -:method:`Symfony\\Component\\Validator\\ValidatorBuilder::disableAnnotationMapping`. - -.. deprecated:: 6.4 - - The :method:`Symfony\\Component\\Validator\\ValidatorBuilder::enableAnnotationMapping` - and :method:`Symfony\\Component\\Validator\\ValidatorBuilder::disableAnnotationMapping` - methods are deprecated since Symfony 6.4, use the - :method:`Symfony\\Component\\Validator\\ValidatorBuilder::enableAttributeMapping` - and :method:`Symfony\\Component\\Validator\\ValidatorBuilder::disableAttributeMapping` - methods instead. - -.. include:: /_includes/_annotation_loader_tip.rst.inc - The AttributeLoader ------------------- diff --git a/reference/configuration/framework.rst b/reference/configuration/framework.rst index efa028b0824..a498328e9fe 100644 --- a/reference/configuration/framework.rst +++ b/reference/configuration/framework.rst @@ -2701,18 +2701,6 @@ settings is configured. .. _reference-validation-enable_annotations: -enable_annotations -.................. - -**type**: ``boolean`` **default**: ``true`` - -If this option is enabled, validation constraints can be defined using annotations or `PHP attributes`_. - -.. deprecated:: 6.4 - - This option is deprecated since Symfony 6.4, use the ``enable_attributes`` - option instead. - enable_attributes ................. @@ -2899,18 +2887,6 @@ Whether to enable the ``serializer`` service or not in the service container. .. _reference-serializer-enable_annotations: -enable_annotations -.................. - -**type**: ``boolean`` **default**: ``true`` - -If this option is enabled, serialization groups can be defined using annotations or attributes. - -.. deprecated:: 6.4 - - This option is deprecated since Symfony 6.4, use the ``enable_attributes`` - option instead. - enable_attributes ................. From 73121fbd0e59644259c1d50dd3c59aeab4cdbb47 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Tue, 5 Sep 2023 13:30:58 +0200 Subject: [PATCH 032/477] Remove a versionadded directive --- routing.rst | 5 ----- 1 file changed, 5 deletions(-) diff --git a/routing.rst b/routing.rst index 11aea4039b3..6a6d2095e23 100644 --- a/routing.rst +++ b/routing.rst @@ -2258,11 +2258,6 @@ that defines only one route. Consider the following class:: Symfony will add a route alias named ``App\Controller\MainController::homepage``. -.. versionadded:: 6.4 - - The automatic declaration of route aliases based on FQCNs was introduced in - Symfony 6.4. - Generating URLs in Controllers ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ From 79da0629e6ea7fdb1b747e3b55da4f1f10a6a50e Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Fri, 22 Sep 2023 11:02:26 +0200 Subject: [PATCH 033/477] Remove a versionadded directive --- console.rst | 5 ----- 1 file changed, 5 deletions(-) diff --git a/console.rst b/console.rst index 86f05625dd6..2aafad3f602 100644 --- a/console.rst +++ b/console.rst @@ -582,11 +582,6 @@ even the color mode being used. You have access to such information thanks to th // changes the color mode $colorMode = $terminal->setColorMode(AnsiColorMode::Ansi24); -.. versionadded:: 6.2 - - The support for setting and getting the current color mode was introduced - in Symfony 6.2. - Logging Command Errors ---------------------- From b2c73abc2cdcac9030f4fd9d0582f9649bbd5cb2 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 4 Oct 2023 09:10:49 +0200 Subject: [PATCH 034/477] Remove an unneeded versionadded directive --- routing.rst | 6 ------ 1 file changed, 6 deletions(-) diff --git a/routing.rst b/routing.rst index e109170e294..fb5931cc517 100644 --- a/routing.rst +++ b/routing.rst @@ -2724,12 +2724,6 @@ service, which you can inject in your services or controllers:: } } -.. versionadded:: 6.4 - - The namespace of the ``UriSigner`` class changed in Symfony 6.4 from - ``Symfony\Component\HttpKernel\UriSigner`` to - ``Symfony\Component\HttpFoundation\UriSigner``. - Troubleshooting --------------- From a45366817bd43f44b7bd9e6e45d41921df943731 Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Wed, 4 Oct 2023 13:38:47 +0200 Subject: [PATCH 035/477] [RateLimiter] Remove deprecations --- rate_limiter.rst | 8 -------- 1 file changed, 8 deletions(-) diff --git a/rate_limiter.rst b/rate_limiter.rst index 06c888b480b..1fe86ef020a 100644 --- a/rate_limiter.rst +++ b/rate_limiter.rst @@ -375,14 +375,6 @@ the :class:`Symfony\\Component\\RateLimiter\\Reservation` object returned by the The :method:`Symfony\\Component\\RateLimiter\\Policy\\SlidingWindow::calculateTimeForTokens` method was introduced in Symfony 6.4. -.. deprecated:: 6.4 - - The :method:`Symfony\\Component\\RateLimiter\\Policy\\SlidingWindow::getRetryAfter` - method is deprecated since Symfony 6.4. Prior to this version, the - ``getRetryAfter()`` method must be used instead of the - :method:`Symfony\\Component\\RateLimiter\\Policy\\SlidingWindow::calculateTimeForTokens` - method. - .. _rate-limiter-storage: Storing Rate Limiter State From 83162e3f96cc997d31b7e695d0e2143b33af232f Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Fri, 6 Oct 2023 16:18:57 +0200 Subject: [PATCH 036/477] Remove an unneeded reference to a not recommended feature --- security.rst | 9 --------- 1 file changed, 9 deletions(-) diff --git a/security.rst b/security.rst index 301371bede9..7285a6b77b4 100644 --- a/security.rst +++ b/security.rst @@ -2678,15 +2678,6 @@ like this: :doc:`impersonating ` another user in this session, this attribute will match. -.. note:: - - All logged in users also have an attribute called ``IS_AUTHENTICATED_REMEMBERED``, - even if the application doesn't use the Remember Me feature. This attribute - exists for backward-compatibility reasons with Symfony versions prior to 6.4. - - This attribute behaves the same as ``IS_AUTHENTICATED``. That's why in modern - Symfony applications it's recommended to no longer use ``IS_AUTHENTICATED_REMEMBERED``. - .. _user_session_refresh: Understanding how Users are Refreshed from the Session From bbd1d8e092c672be67ea75f3f346cd126c5a9de4 Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Mon, 16 Oct 2023 10:47:57 +0200 Subject: [PATCH 037/477] Remove all 6.x `versionadded` on 7.0 --- .doctor-rst.yaml | 8 +- bundles.rst | 5 -- bundles/configuration.rst | 4 - bundles/extension.rst | 4 - bundles/prepend_extension.rst | 4 - cache.rst | 12 --- components/browser_kit.rst | 8 -- components/cache/adapters/redis_adapter.rst | 8 -- components/clock.rst | 32 ------- components/config/definition.rst | 5 -- components/console/events.rst | 15 ---- .../console/helpers/formatterhelper.rst | 4 - components/console/helpers/progressbar.rst | 8 -- components/console/helpers/table.rst | 4 - components/css_selector.rst | 4 - .../dependency_injection/compilation.rst | 4 - components/dom_crawler.rst | 14 --- components/expression_language.rst | 4 - components/finder.rst | 5 -- components/http_foundation.rst | 34 +------ components/http_kernel.rst | 11 --- components/intl.rst | 12 --- components/lock.rst | 9 -- components/options_resolver.rst | 4 - components/phpunit_bridge.rst | 16 ---- components/process.rst | 4 - components/property_access.rst | 9 -- components/property_info.rst | 6 -- components/serializer.rst | 26 ------ components/string.rst | 8 -- components/uid.rst | 20 ----- components/validator/resources.rst | 5 -- components/var_dumper.rst | 4 - components/var_exporter.rst | 13 --- components/yaml.rst | 8 -- configuration.rst | 20 ----- configuration/env_var_processors.rst | 12 --- configuration/micro_kernel_trait.rst | 8 -- console.rst | 12 --- console/coloring.rst | 4 - console/input.rst | 6 -- console/style.rst | 8 -- contributing/documentation/format.rst | 20 ++--- controller.rst | 32 ------- controller/value_resolver.rst | 42 --------- doctrine.rst | 9 -- form/unit_testing.rst | 5 -- frontend/asset_mapper.rst | 21 ----- html_sanitizer.rst | 4 - http_cache.rst | 4 - http_cache/esi.rst | 4 - http_client.rst | 46 ---------- lock.rst | 5 -- mailer.rst | 79 ----------------- messenger.rst | 88 ------------------- notifier.rst | 57 ------------ performance.rst | 4 - profiler.rst | 8 -- rate_limiter.rst | 10 --- reference/configuration/debug.rst | 4 - reference/configuration/framework.rst | 48 ---------- reference/configuration/kernel.rst | 5 -- reference/configuration/security.rst | 16 ---- reference/configuration/twig.rst | 13 --- reference/constraints/Cascade.rst | 4 - reference/constraints/Choice.rst | 4 - reference/constraints/Email.rst | 4 - reference/constraints/Expression.rst | 12 --- reference/constraints/File.rst | 16 ---- reference/constraints/Length.rst | 16 ---- .../constraints/NoSuspiciousCharacters.rst | 4 - reference/constraints/PasswordStrength.rst | 4 - reference/constraints/Regex.rst | 4 - reference/constraints/Time.rst | 4 - reference/constraints/Type.rst | 4 - reference/constraints/Unique.rst | 4 - reference/constraints/UniqueEntity.rst | 5 -- reference/constraints/Uuid.rst | 9 -- reference/constraints/When.rst | 8 -- reference/dic_tags.rst | 7 -- reference/formats/expression_language.rst | 18 ---- reference/formats/yaml.rst | 4 - reference/forms/types/collection.rst | 4 - reference/forms/types/enum.rst | 4 - reference/forms/types/number.rst | 4 - .../forms/types/options/choice_label.rst.inc | 6 -- .../duplicate_preferred_choices.rst.inc | 4 - reference/forms/types/options/help.rst.inc | 5 -- .../types/options/placeholder_attr.rst.inc | 4 - .../forms/types/options/sanitize_html.rst.inc | 4 - .../forms/types/options/sanitizer.rst.inc | 4 - reference/forms/types/password.rst | 4 - reference/twig_reference.rst | 12 --- routing.rst | 38 -------- routing/custom_route_loader.rst | 9 -- security.rst | 60 ------------- security/access_control.rst | 8 -- security/access_token.rst | 8 -- security/expressions.rst | 4 - security/impersonating_user.rst | 4 - security/login_link.rst | 4 - security/remember_me.rst | 4 - security/user_checkers.rst | 4 - security/voters.rst | 4 - serializer.rst | 26 ------ serializer/custom_context_builders.rst | 4 - service_container.rst | 14 --- service_container/alias_private.rst | 4 - service_container/autowiring.rst | 18 ---- service_container/debug.rst | 6 +- service_container/expression_language.rst | 8 -- service_container/factories.rst | 8 -- service_container/lazy_services.rst | 10 --- service_container/service_decoration.rst | 4 - .../service_subscribers_locators.rst | 20 ----- service_container/tags.rst | 13 --- templates.rst | 28 ------ testing.rst | 38 -------- translation.rst | 29 ------ validation.rst | 4 - validation/custom_constraint.rst | 4 - workflow.rst | 24 ----- workflow/workflow-and-state-machine.rst | 4 - 123 files changed, 18 insertions(+), 1516 deletions(-) diff --git a/.doctor-rst.yaml b/.doctor-rst.yaml index ee1713d3100..f309ce1d49d 100644 --- a/.doctor-rst.yaml +++ b/.doctor-rst.yaml @@ -68,16 +68,16 @@ rules: # master versionadded_directive_major_version: - major_version: 6 + major_version: 7 versionadded_directive_min_version: - min_version: '6.0' + min_version: '7.0' deprecated_directive_major_version: - major_version: 6 + major_version: 7 deprecated_directive_min_version: - min_version: '6.0' + min_version: '7.0' exclude_rule_for_file: - path: configuration/multiple_kernels.rst diff --git a/bundles.rst b/bundles.rst index 19dd8c31aa8..50ffc39d156 100644 --- a/bundles.rst +++ b/bundles.rst @@ -56,11 +56,6 @@ Start by creating a new class called ``AcmeTestBundle``:: { } -.. versionadded:: 6.1 - - The :class:`Symfony\\Component\\HttpKernel\\Bundle\\AbstractBundle` was - introduced in Symfony 6.1. - .. caution:: If your bundle must be compatible with previous Symfony versions you have to diff --git a/bundles/configuration.rst b/bundles/configuration.rst index 4a2224429ed..a6a21023de6 100644 --- a/bundles/configuration.rst +++ b/bundles/configuration.rst @@ -320,10 +320,6 @@ In your extension, you can load this and dynamically set its arguments:: Using the AbstractBundle Class ------------------------------ -.. versionadded:: 6.1 - - The ``AbstractBundle`` class was introduced in Symfony 6.1. - As an alternative, instead of creating an extension and configuration class as shown in the previous section, you can also extend :class:`Symfony\\Component\\HttpKernel\\Bundle\\AbstractBundle` to add this diff --git a/bundles/extension.rst b/bundles/extension.rst index ff873f2ab14..3c660251403 100644 --- a/bundles/extension.rst +++ b/bundles/extension.rst @@ -111,10 +111,6 @@ To read more about it, see the ":doc:`/bundles/configuration`" article. Loading Services directly in your Bundle class ---------------------------------------------- -.. versionadded:: 6.1 - - The ``AbstractBundle`` class was introduced in Symfony 6.1. - Alternatively, you can define and load services configuration directly in a bundle class instead of creating a specific ``Extension`` class. You can do this by extending from :class:`Symfony\\Component\\HttpKernel\\Bundle\\AbstractBundle` diff --git a/bundles/prepend_extension.rst b/bundles/prepend_extension.rst index fcad249124e..bed3d06da43 100644 --- a/bundles/prepend_extension.rst +++ b/bundles/prepend_extension.rst @@ -154,10 +154,6 @@ registered and the ``entity_manager_name`` setting for ``acme_hello`` is set to Prepending Extension in the Bundle Class ---------------------------------------- -.. versionadded:: 6.1 - - The ``AbstractBundle`` class was introduced in Symfony 6.1. - You can also append or prepend extension configuration directly in your Bundle class if you extend from the :class:`Symfony\\Component\\HttpKernel\\Bundle\\AbstractBundle` class and define the :method:`Symfony\\Component\\HttpKernel\\Bundle\\AbstractBundle::prependExtension` diff --git a/cache.rst b/cache.rst index 7bf72bf2608..3d247c4a1bb 100644 --- a/cache.rst +++ b/cache.rst @@ -745,20 +745,12 @@ Clear all cache pools: $ php bin/console cache:pool:clear --all -.. versionadded:: 6.3 - - The ``--all`` option was introduced in Symfony 6.3. - Clear all cache pools except some: .. code-block:: terminal $ php bin/console cache:pool:clear --all --exclude=my_cache_pool --exclude=another_cache_pool -.. versionadded:: 6.4 - - The ``--exclude`` option was introduced in Symfony 6.4. - Clear all caches everywhere: .. code-block:: terminal @@ -767,10 +759,6 @@ Clear all caches everywhere: Clear cache by tag(s): -.. versionadded:: 6.1 - - The ``cache:pool:invalidate-tags`` command was introduced in Symfony 6.1. - .. code-block:: terminal # invalidate tag1 from all taggable pools diff --git a/components/browser_kit.rst b/components/browser_kit.rst index c744837d7b1..bcb8f7b3c8e 100644 --- a/components/browser_kit.rst +++ b/components/browser_kit.rst @@ -130,10 +130,6 @@ on a link:: // ... and `clickLink()` $crawler = $client->clickLink('Go elsewhere...', ['X-Custom-Header' => 'Some data']); -.. versionadded:: 6.4 - - The ``serverParameters`` parameter was introduced in Symfony 6.4. - Submitting Forms ~~~~~~~~~~~~~~~~ @@ -403,10 +399,6 @@ to call ``json_decode()`` explicitly:: $response = $browser->getResponse()->toArray(); // $response is a PHP array of the decoded JSON contents -.. versionadded:: 6.1 - - The ``toArray()`` method was introduced in Symfony 6.1. - Learn more ---------- diff --git a/components/cache/adapters/redis_adapter.rst b/components/cache/adapters/redis_adapter.rst index 02523dd283e..a25b1a510ed 100644 --- a/components/cache/adapters/redis_adapter.rst +++ b/components/cache/adapters/redis_adapter.rst @@ -41,10 +41,6 @@ as the second and third parameters:: $defaultLifetime = 0 ); -.. versionadded:: 6.3 - - Support for `Relay`_ was introduced in Symfony 6.3. - Configure the Connection ------------------------ @@ -163,10 +159,6 @@ array of ``key => value`` pairs representing option names and their respective v Available Options ~~~~~~~~~~~~~~~~~ -.. versionadded:: 6.3 - - ``\Relay\Relay`` support was introduced in Symfony 6.3. - ``class`` (type: ``string``, default: ``null``) Specifies the connection library to return, either ``\Redis``, ``\Relay\Relay`` or ``\Predis\Client``. If none is specified, fallback value is in following order, depending which one is available first: diff --git a/components/clock.rst b/components/clock.rst index f58124c70af..b803c78e29d 100644 --- a/components/clock.rst +++ b/components/clock.rst @@ -1,10 +1,6 @@ The Clock Component =================== -.. versionadded:: 6.2 - - The Clock component was introduced in Symfony 6.2 - The Clock component decouples applications from the system clock. This allows you to fix time to improve testability of time-sensitive logic. @@ -79,16 +75,6 @@ When using the Clock component, you manipulate :class:`Symfony\\Component\\Clock\\DatePoint` instances. You can learn more about it in :ref:`the dedicated section `. -.. versionadded:: 6.3 - - The :class:`Symfony\\Component\\Clock\\Clock` class and ``now()`` function - were introduced in Symfony 6.3. - -.. versionadded:: 6.4 - - The ``modifier`` argument of the ``now()`` function was introduced in - Symfony 6.4. - Available Clocks Implementations -------------------------------- @@ -208,10 +194,6 @@ you can set the current time arbitrarily without having to change your service c This will help you test every case of your method without the need of actually being in a month or another. -.. versionadded:: 6.3 - - The :class:`Symfony\\Component\\Clock\\ClockAwareTrait` was introduced in Symfony 6.3. - .. _clock_date-point: The ``DatePoint`` Class @@ -253,11 +235,6 @@ The constructor also allows setting a timezone or custom referenced date:: error handling across versions of PHP, thanks to polyfilling `PHP 8.3's behavior`_ on the topic. -.. versionadded:: 6.4 - - The :class:`Symfony\\Component\\Clock\\DatePoint` class was introduced - in Symfony 6.4. - .. _clock_writing-tests: Writing Time-Sensitive Tests @@ -314,10 +291,6 @@ By combining the :class:`Symfony\\Component\\Clock\\ClockAwareTrait` and :class:`Symfony\\Component\\Clock\\Test\\ClockSensitiveTrait`, you have full control on your time-sensitive code's behavior. -.. versionadded:: 6.3 - - The :class:`Symfony\\Component\\Clock\\Test\\ClockSensitiveTrait` was introduced in Symfony 6.3. - Exceptions Management --------------------- @@ -338,11 +311,6 @@ These exceptions are available starting from PHP 8.3. However, thanks to the `symfony/polyfill-php83`_ dependency required by the Clock component, you can use them even if your project doesn't use PHP 8.3 yet. -.. versionadded:: 6.4 - - The support for ``DateMalformedStringException`` and - ``DateInvalidTimeZoneException`` was introduced in Symfony 6.4. - .. _`PSR-20`: https://www.php-fig.org/psr/psr-20/ .. _`accepted by the DateTime constructor`: https://www.php.net/manual/en/datetime.formats.php .. _`PHP DateTime exceptions`: https://wiki.php.net/rfc/datetime-exceptions diff --git a/components/config/definition.rst b/components/config/definition.rst index 9c90304c578..63ebcd7cc72 100644 --- a/components/config/definition.rst +++ b/components/config/definition.rst @@ -171,11 +171,6 @@ The configuration can now be written like this:: ->end() ; -.. versionadded:: 6.3 - - The support of enum values in ``enumNode()`` was introduced - in Symfony 6.3. - Array Nodes ~~~~~~~~~~~ diff --git a/components/console/events.rst b/components/console/events.rst index 6356816a9b2..1476a83f37d 100644 --- a/components/console/events.rst +++ b/components/console/events.rst @@ -156,11 +156,6 @@ Listeners receive a a signal. You can learn more about signals in the :ref:`the dedicated section `. - .. versionadded:: 6.4 - - Dispatching the ``ConsoleEvents::TERMINATE`` event on exit - signal was introduced in Symfony 6.4. - .. _console-events_signal: The ``ConsoleEvents::SIGNAL`` Event @@ -207,11 +202,6 @@ method:: $event->abortExit(); }); -.. versionadded:: 6.3 - - The ``setExitCode()``, ``getExitCode()`` and ``abortExit()`` methods were introduced - in Symfony 6.3. - .. tip:: All the available signals (``SIGINT``, ``SIGQUIT``, etc.) are defined as @@ -262,11 +252,6 @@ handle all signals e.g. to do some tasks before terminating the command. :method:`Symfony\\Component\\Console\\SignalRegistry\\SignalMap::getSignalName` method. - .. versionadded:: 6.4 - - The :class:`Symfony\\Component\\Console\\SignalRegistry\\SignalMap` class was - introduced in Symfony 6.4. - .. _`reserved exit codes`: https://www.tldp.org/LDP/abs/html/exitcodes.html .. _`Signals`: https://en.wikipedia.org/wiki/Signal_(IPC) .. _`constants of the PCNTL PHP extension`: https://www.php.net/manual/en/pcntl.constants.php diff --git a/components/console/helpers/formatterhelper.rst b/components/console/helpers/formatterhelper.rst index 061b7616c8d..3beb4204622 100644 --- a/components/console/helpers/formatterhelper.rst +++ b/components/console/helpers/formatterhelper.rst @@ -132,7 +132,3 @@ precision (default ``1``) of the result:: $formatter->truncate(125); // 2 mins $formatter->truncate(125, 2); // 2 mins, 5 secs $formatter->truncate(172799, 4); // 1 day, 23 hrs, 59 mins, 59 secs - -.. versionadded:: 6.4 - - The support for exact times were introduced in Symfony 6.4. diff --git a/components/console/helpers/progressbar.rst b/components/console/helpers/progressbar.rst index 58f1fba37ff..a501d39fa14 100644 --- a/components/console/helpers/progressbar.rst +++ b/components/console/helpers/progressbar.rst @@ -69,10 +69,6 @@ that starting point:: // displays the progress bar starting at 25 completed units $progressBar->start(null, 25); -.. versionadded:: 6.2 - - The option to start a progress bar at a certain point was introduced in Symfony 6.2. - .. tip:: If your platform doesn't support ANSI codes, updates to the progress @@ -375,10 +371,6 @@ with the ``setPlaceholderFormatter`` method:: return $progressBar->getMaxSteps() - $progressBar->getProgress(); }); -.. versionadded:: 6.3 - - The ``setPlaceholderFormatter()`` method was introduced in Symfony 6.3. - Custom Messages ~~~~~~~~~~~~~~~ diff --git a/components/console/helpers/table.rst b/components/console/helpers/table.rst index fcc52e0e7a4..6d86cbc6130 100644 --- a/components/console/helpers/table.rst +++ b/components/console/helpers/table.rst @@ -175,10 +175,6 @@ The output of this command will be: | Author: Charles Dickens | +------------------------------+ -.. versionadded:: 6.1 - - Support for vertical rendering was introduced in Symfony 6.1. - The table style can be changed to any built-in styles via :method:`Symfony\\Component\\Console\\Helper\\Table::setStyle`:: diff --git a/components/css_selector.rst b/components/css_selector.rst index 94561cec9bd..c09f80a3cf4 100644 --- a/components/css_selector.rst +++ b/components/css_selector.rst @@ -94,10 +94,6 @@ Pseudo-classes are partially supported: ``li:first-of-type``) but not with the ``*`` selector). * Supported: ``*:only-of-type``, ``*:scope``. -.. versionadded:: 6.3 - - The support for ``*:scope`` was introduced in Symfony 6.3. - Learn more ---------- diff --git a/components/dependency_injection/compilation.rst b/components/dependency_injection/compilation.rst index 8fe7b0242e5..3787c686982 100644 --- a/components/dependency_injection/compilation.rst +++ b/components/dependency_injection/compilation.rst @@ -278,10 +278,6 @@ The parameter being deprecated must be set before being declared as deprecated. Otherwise a :class:`Symfony\\Component\\DependencyInjection\\Exception\\ParameterNotFoundException` exception will be thrown. -.. versionadded:: 6.3 - - The ``ContainerBuilder::deprecateParameter()`` method was introduced in Symfony 6.3. - .. note:: Just registering an extension with the container is not enough to get diff --git a/components/dom_crawler.rst b/components/dom_crawler.rst index 4440a35f0ea..ac859efac91 100644 --- a/components/dom_crawler.rst +++ b/components/dom_crawler.rst @@ -229,11 +229,6 @@ Access the value of the first node of the current selection:: // but you can get the unchanged text by passing FALSE as argument $text = $crawler->filterXPath('//body/p')->innerText(false); -.. versionadded:: 6.3 - - The removal of whitespace characters by default in ``innerText()`` was - introduced in Symfony 6.3. - Access the attribute value of the first node of the current selection:: $class = $crawler->filterXPath('//body/p')->attr('class'); @@ -245,11 +240,6 @@ Access the attribute value of the first node of the current selection:: $class = $crawler->filterXPath('//body/p')->attr('class', 'my-default-class'); - .. versionadded:: 6.4 - - The possibility to specify a default value to the ``attr()`` method - was introduced in Symfony 6.4. - Extract attribute and/or node values from the list of nodes:: $attributes = $crawler @@ -672,10 +662,6 @@ parser, set its ``useHtml5Parser`` constructor argument to ``true``:: By doing so, the crawler will use the HTML5 parser provided by the `masterminds/html5`_ library to parse the documents. -.. versionadded:: 6.3 - - The ``useHtml5Parser`` argument was introduced in Symfony 6.3. - Learn more ---------- diff --git a/components/expression_language.rst b/components/expression_language.rst index a08e77b01ea..a10ad6cfe1b 100644 --- a/components/expression_language.rst +++ b/components/expression_language.rst @@ -92,10 +92,6 @@ can chain multiple coalescing operators. * ``foo[3] ?? 'no'`` * ``foo.baz ?? foo['baz'] ?? 'no'`` -.. versionadded:: 6.2 - - The null-coalescing operator was introduced in Symfony 6.2. - Passing in Variables -------------------- diff --git a/components/finder.rst b/components/finder.rst index 27dd6709b6d..ecf19fc1fe1 100644 --- a/components/finder.rst +++ b/components/finder.rst @@ -340,11 +340,6 @@ Sort the results by name, extension, size or type (directories first, then files $finder->sortBySize(); $finder->sortByType(); -.. versionadded:: 6.2 - - The ``sortByCaseInsensitiveName()``, ``sortByExtension()`` and ``sortBySize()`` - methods were introduced in Symfony 6.2. - .. tip:: By default, the ``sortByName()`` method uses the :phpfunction:`strcmp` PHP diff --git a/components/http_foundation.rst b/components/http_foundation.rst index 18d64d6b467..5c6d0dba0c7 100644 --- a/components/http_foundation.rst +++ b/components/http_foundation.rst @@ -145,11 +145,6 @@ has some methods to filter the input values: :method:`Symfony\\Component\\HttpFoundation\\ParameterBag::getString` Returns the parameter value as a string; -.. versionadded:: 6.3 - - The ``ParameterBag::getEnum()`` and ``ParameterBag::getString()`` methods - were introduced in Symfony 6.3. - :method:`Symfony\\Component\\HttpFoundation\\ParameterBag::filter` Filters the parameter by using the PHP :phpfunction:`filter_var` function. If invalid values are found, a @@ -220,11 +215,6 @@ wrapping this data:: $data = $request->getPayload(); -.. versionadded:: 6.3 - - The :method:`Symfony\\Component\\HttpFoundation\\Request::getPayload` - method was introduced in Symfony 6.3. - Identifying a Request ~~~~~~~~~~~~~~~~~~~~~ @@ -389,10 +379,6 @@ use the ``isPrivateIp()`` method from the $isPrivate = IpUtils::isPrivateIp($ipv6); // $isPrivate = false -.. versionadded:: 6.3 - - The ``isPrivateIp()`` method was introduced in Symfony 6.3. - Accessing other Data ~~~~~~~~~~~~~~~~~~~~ @@ -562,11 +548,6 @@ call:: 'etag' => 'abcdef', ]); -.. versionadded:: 6.1 - - The ``stale_if_error`` and ``stale_while_revalidate`` options were - introduced in Symfony 6.1. - To check if the Response validators (``ETag``, ``Last-Modified``) match a conditional value specified in the client Request, use the :method:`Symfony\\Component\\HttpFoundation\\Response::isNotModified` @@ -629,11 +610,6 @@ represented by a PHP callable instead of a string:: Streaming a JSON Response ~~~~~~~~~~~~~~~~~~~~~~~~~ -.. versionadded:: 6.3 - - The :class:`Symfony\\Component\\HttpFoundation\\StreamedJsonResponse` class was - introduced in Symfony 6.3. - The :class:`Symfony\\Component\\HttpFoundation\\StreamedJsonResponse` allows to stream large JSON responses using PHP generators to keep the used resources low. @@ -646,9 +622,9 @@ containing JSON serializable data:: // any method or function returning a PHP Generator function loadArticles(): \Generator { - yield ['title' => 'Article 1']; - yield ['title' => 'Article 2']; - yield ['title' => 'Article 3']; + yield ['title' => 'Article 1']; + yield ['title' => 'Article 2']; + yield ['title' => 'Article 3']; }; $response = new StreamedJsonResponse( @@ -723,10 +699,6 @@ including generators:: return new StreamedJsonResponse(loadArticles()); } -.. versionadded:: 6.4 - - The ``StreamedJsonResponse`` support of iterables was introduced in Symfony 6.4. - .. _component-http-foundation-serving-files: Serving Files diff --git a/components/http_kernel.rst b/components/http_kernel.rst index 32f66f9ac2a..435ded9063a 100644 --- a/components/http_kernel.rst +++ b/components/http_kernel.rst @@ -280,10 +280,6 @@ Another typical use-case for this event is to retrieve the attributes from the controller using the :method:`Symfony\\Component\\HttpKernel\\Event\\ControllerEvent::getAttributes` method. See the Symfony section below for some examples. -.. versionadded:: 6.2 - - The ``ControllerEvent::getAttributes()`` method was introduced in Symfony 6.2. - Listeners to this event can also change the controller callable completely by calling :method:`ControllerEvent::setController ` on the event object that's passed to listeners on this event. @@ -343,13 +339,6 @@ of arguments that should be passed when executing that callable. ``ValueResolverInterface`` yourself and passing this to the ``ArgumentResolver``, you can extend this functionality. - .. versionadded:: 6.2 - - The ``ValueResolverInterface`` was introduced in Symfony 6.2. Prior to - 6.2, you had to use the - :class:`Symfony\\Component\\HttpKernel\\Controller\\ArgumentValueResolverInterface`, - which defines different methods. - .. _component-http-kernel-calling-controller: 5) Calling the Controller diff --git a/components/intl.rst b/components/intl.rst index 3981062f5b7..46146e47e1b 100644 --- a/components/intl.rst +++ b/components/intl.rst @@ -210,10 +210,6 @@ numeric country codes:: $exists = Countries::numericCodeExists('250'); // => true -.. versionadded:: 6.4 - - The support for numeric country codes was introduced in Symfony 6.4. - Locales ~~~~~~~ @@ -397,10 +393,6 @@ to catching the exception, you can also check if a given timezone ID is valid:: Emoji Transliteration ~~~~~~~~~~~~~~~~~~~~~ -.. versionadded:: 6.2 - - The Emoji transliteration feature was introduced in Symfony 6.2. - The ``EmojiTransliterator`` class provides a utility to translate emojis into their textual representation in all languages based on the `Unicode CLDR dataset`_:: @@ -448,10 +440,6 @@ Symfony emoji data files using the PHP ``zlib`` extension: # adjust the path to the 'compress' binary based on your application installation $ php ./vendor/symfony/intl/Resources/bin/compress -.. versionadded:: 6.3 - - The ``compress`` binary was introduced in Symfony 6.3. - Learn more ---------- diff --git a/components/lock.rst b/components/lock.rst index 1c87942bb34..9e854ab89a6 100644 --- a/components/lock.rst +++ b/components/lock.rst @@ -553,11 +553,6 @@ the command: $ php bin/console make:migration -.. versionadded:: 6.3 - - The automatic table generation when running the ``make:migration`` command - was introduced in Symfony 6.3. - If you prefer to create the table yourself and it has not already been created, you can create this table explicitly by calling the :method:`Symfony\\Component\\Lock\\Store\\DoctrineDbalStore::createTable` method. @@ -610,10 +605,6 @@ store locks and does not expire. RedisStore ~~~~~~~~~~ -.. versionadded:: 6.3 - - ``\Relay\Relay`` support was introduced in Symfony 6.3. - The RedisStore saves locks on a Redis server, it requires a Redis connection implementing the ``\Redis``, ``\RedisArray``, ``\RedisCluster``, ``\Relay\Relay`` or ``\Predis`` classes. This store does not support blocking, and expects a TTL to diff --git a/components/options_resolver.rst b/components/options_resolver.rst index 46b0ee6d542..ddbdb878f4d 100644 --- a/components/options_resolver.rst +++ b/components/options_resolver.rst @@ -862,10 +862,6 @@ if an unknown option is passed. You can ignore not defined options by using the 'version' => '1.2.3' ]); -.. versionadded:: 6.3 - - The ``ignoreUndefined()`` method was introduced in Symfony 6.3. - Chaining Option Configurations ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/components/phpunit_bridge.rst b/components/phpunit_bridge.rst index bfa69893bb9..0e92c345ad1 100644 --- a/components/phpunit_bridge.rst +++ b/components/phpunit_bridge.rst @@ -291,10 +291,6 @@ Here is a summary that should help you pick the right configuration: Ignoring Deprecations ..................... -.. versionadded:: 6.1 - - The ``ignoreFile`` feature was introduced in Symfony 6.1. - If your application has some deprecations that you can't fix for some reasons, you can tell Symfony to ignore them. @@ -541,10 +537,6 @@ allows you to mock the PHP's built-in time functions ``time()``, ``microtime()`` function ``date()`` is mocked so it uses the mocked time if no timestamp is specified. -.. versionadded:: 6.2 - - Support for mocking the ``hrtime()`` function was introduced in Symfony 6.2. - Other functions with an optional timestamp parameter that defaults to ``time()`` will still use the system time instead of the mocked time. This means that you may need to change some code in your tests. For example, instead of ``new DateTime()``, @@ -741,10 +733,6 @@ reason, this component also provides mocks for these PHP functions: * :phpfunction:`trait_exists` * :phpfunction:`enum_exists` -.. versionadded:: 6.3 - - The ``enum_exists`` function was introduced in Symfony 6.3. - Use Case ~~~~~~~~ @@ -816,10 +804,6 @@ PHP 8.1 and later, calling ``class_exists`` on a enum will return ``true``. That's why calling ``ClassExistsMock::withMockedEnums()`` will also register the enum as a mocked class. -.. versionadded:: 6.3 - - The ``enum_exists`` function was introduced in Symfony 6.3. - Troubleshooting --------------- diff --git a/components/process.rst b/components/process.rst index 158b8d0bd5a..999dd9d1f2e 100644 --- a/components/process.rst +++ b/components/process.rst @@ -413,10 +413,6 @@ instead:: Executing a PHP Child Process with the Same Configuration --------------------------------------------------------- -.. versionadded:: 6.4 - - The ``PhpSubprocess`` helper was introduced in Symfony 6.4. - When you start a PHP process, it uses the default configuration defined in your ``php.ini`` file. You can bypass these options with the ``-d`` command line option. For example, if ``memory_limit`` is set to ``256M``, you can disable this diff --git a/components/property_access.rst b/components/property_access.rst index c2a911e9b8e..1f3f28a6a1b 100644 --- a/components/property_access.rst +++ b/components/property_access.rst @@ -89,11 +89,6 @@ You can also use multi dimensional arrays:: Right square brackets ``]`` don't need to be escaped in array keys. - .. versionadded:: 6.3 - - Escaping dots and left square brackets in a property path was - introduced in Symfony 6.3. - Reading from Objects -------------------- @@ -236,10 +231,6 @@ is to mark all nullable properties with the nullsafe operator (``?``):: // no longer evaluated and null is returned immediately without throwing an exception var_dump($propertyAccessor->getValue($comment, 'person?.firstname')); // null -.. versionadded:: 6.2 - - The ``?`` nullsafe operator was introduced in Symfony 6.2. - .. _components-property-access-magic-get: Magic ``__get()`` Method diff --git a/components/property_info.rst b/components/property_info.rst index d5699ea1bab..38e00b5dfc1 100644 --- a/components/property_info.rst +++ b/components/property_info.rst @@ -229,12 +229,6 @@ works. It assumes camel case style method names following `PSR-1`_. For example, both ``myProperty`` and ``my_property`` properties are readable if there's a ``getMyProperty()`` method and writable if there's a ``setMyProperty()`` method. -.. versionadded:: 6.4 - - In Symfony versions prior to 6.4, snake case properties (e.g. ``my_property``) - were not writable by camel case methods (e.g. ``setMyProperty()``). You had - to define method names with underscores (e.g. ``setMy_property()``). - .. _property-info-initializable: Property Initializable Information diff --git a/components/serializer.rst b/components/serializer.rst index f879d5167c6..630ff1cf3b8 100644 --- a/components/serializer.rst +++ b/components/serializer.rst @@ -712,10 +712,6 @@ automatically detect and use it to serialize related attributes. The ``ObjectNormalizer`` also takes care of methods starting with ``has``, ``get``, and ``can``. -.. versionadded:: 6.1 - - The support of canners (methods prefixed by ``can``) was introduced in Symfony 6.1. - Using Callbacks to Serialize Properties with Object Instances ------------------------------------------------------------- @@ -811,11 +807,6 @@ The Serializer component provides several built-in normalizers: combine the following values: ``PropertyNormalizer::NORMALIZE_PUBLIC``, ``PropertyNormalizer::NORMALIZE_PROTECTED`` or ``PropertyNormalizer::NORMALIZE_PRIVATE``. - .. versionadded:: 6.2 - - The ``PropertyNormalizer::NORMALIZE_VISIBILITY`` context option and its - values were introduced in Symfony 6.2. - :class:`Symfony\\Component\\Serializer\\Normalizer\\JsonSerializableNormalizer` This normalizer works with classes that implement :phpclass:`JsonSerializable`. @@ -852,10 +843,6 @@ The Serializer component provides several built-in normalizers: By default, an exception is thrown when data is not a valid backed enumeration. If you want ``null`` instead, you can set the ``BackedEnumNormalizer::ALLOW_INVALID_VALUES`` option. - .. versionadded:: 6.3 - - The ``BackedEnumNormalizer::ALLOW_INVALID_VALUES`` context option was introduced in Symfony 6.3. - :class:`Symfony\\Component\\Serializer\\Normalizer\\FormErrorNormalizer` This normalizer works with classes that implement :class:`Symfony\\Component\\Form\\FormInterface`. @@ -896,11 +883,6 @@ The Serializer component provides several built-in normalizers: setting the ``TranslatableNormalizer::NORMALIZATION_LOCALE_KEY`` serializer context option. - .. versionadded:: 6.4 - - The :class:`Symfony\\Component\\Serializer\\Normalizer\\TranslatableNormalizer` - was introduced in Symfony 6.4. - .. note:: You can also create your own Normalizer to use another structure. Read more at @@ -1030,10 +1012,6 @@ Option Description ``json_decode_recursion_depth`` Sets maximum recursion depth. ``512`` =============================== ========================================================================================================== ================================ -.. versionadded:: 6.4 - - The support of ``json_decode_detailed_errors`` was introduced in Symfony 6.4. - The ``CsvEncoder`` ~~~~~~~~~~~~~~~~~~ @@ -1252,10 +1230,6 @@ you can use "context builders" to define the context using a fluent interface:: $serializer->serialize($something, 'csv', $contextBuilder->toArray()); -.. versionadded:: 6.1 - - Context builders were introduced in Symfony 6.1. - .. note:: The Serializer component provides a context builder diff --git a/components/string.rst b/components/string.rst index ca289c70ba4..f743849fd19 100644 --- a/components/string.rst +++ b/components/string.rst @@ -565,10 +565,6 @@ the injected slugger is the same as the request locale:: Slug Emojis ~~~~~~~~~~~ -.. versionadded:: 6.2 - - The Emoji transliteration feature was introduced in Symfony 6.2. - You can transform any emojis into their textual representation:: use Symfony\Component\String\Slugger\AsciiSlugger; @@ -603,10 +599,6 @@ If you want to strip emojis from slugs, use the special ``strip`` locale:: $slug = $slugger->slug('a 😺, 🐈‍⬛, and a 🦁'); // $slug = 'a-and-a'; -.. versionadded:: 6.3 - - The option to strip emojis from slugs was introduced in Symfony 6.3. - .. _string-inflector: Inflector diff --git a/components/uid.rst b/components/uid.rst index 52403513995..26fd32989a9 100644 --- a/components/uid.rst +++ b/components/uid.rst @@ -70,10 +70,6 @@ to create each type of UUID:: // UUIDv8 uniqueness will be implementation-specific and SHOULD NOT be assumed. $uuid = Uuid::v8(); -.. versionadded:: 6.2 - - UUID versions 7 and 8 were introduced in Symfony 6.2. - If your UUID value is already generated in another format, use any of the following methods to create a ``Uuid`` object from it:: @@ -184,10 +180,6 @@ Use these methods to transform the UUID object into different bases:: $uuid->toRfc4122(); // string(36) "d9e7a184-5d5b-11ea-a62a-3499710062d0" $uuid->toHex(); // string(34) "0xd9e7a1845d5b11eaa62a3499710062d0" -.. versionadded:: 6.2 - - The ``toHex()`` method was introduced in Symfony 6.2. - Working with UUIDs ~~~~~~~~~~~~~~~~~~ @@ -247,10 +239,6 @@ type, which converts to/from UUID objects automatically:: // ... } -.. versionadded:: 6.2 - - The ``UuidType::NAME`` constant was introduced in Symfony 6.2. - There's also a Doctrine generator to help auto-generate UUID values for the entity primary keys:: @@ -387,10 +375,6 @@ Use these methods to transform the ULID object into different bases:: $ulid->toRfc4122(); // string(36) "0171069d-593d-97d3-8b3e-23d06de5b308" $ulid->toHex(); // string(34) "0x0171069d593d97d38b3e23d06de5b308" -.. versionadded:: 6.2 - - The ``toHex()`` method was introduced in Symfony 6.2. - Working with ULIDs ~~~~~~~~~~~~~~~~~~ @@ -434,10 +418,6 @@ type, which converts to/from ULID objects automatically:: // ... } -.. versionadded:: 6.2 - - The ``UlidType::NAME`` constant was introduced in Symfony 6.2. - There's also a Doctrine generator to help auto-generate ULID values for the entity primary keys:: diff --git a/components/validator/resources.rst b/components/validator/resources.rst index d9d3543a641..d9b63a147d5 100644 --- a/components/validator/resources.rst +++ b/components/validator/resources.rst @@ -86,11 +86,6 @@ configure the locations of these files:: The AttributeLoader ------------------- -.. versionadded:: 6.4 - - The :class:`Symfony\\Component\\Validator\\Mapping\\Loader\\AttributeLoader` - was introduced in Symfony 6.4. - The component provides an :class:`Symfony\\Component\\Validator\\Mapping\\Loader\\AttributeLoader` to get the metadata from the attributes of the class. For example:: diff --git a/components/var_dumper.rst b/components/var_dumper.rst index 6b336ad1d3e..06adc3a0021 100644 --- a/components/var_dumper.rst +++ b/components/var_dumper.rst @@ -485,10 +485,6 @@ then its dump representation:: .. image:: /_images/components/var_dumper/10-uninitialized.png :alt: Dump output where the uninitialized property is represented by a question mark followed by the type definition. -.. versionadded:: 6.4 - - Displaying uninitialized variables information was introduced in Symfony 6.4. - .. _var-dumper-advanced: Advanced Usage diff --git a/components/var_exporter.rst b/components/var_exporter.rst index 12c1396b0f1..17e2112210a 100644 --- a/components/var_exporter.rst +++ b/components/var_exporter.rst @@ -177,10 +177,6 @@ populated by using the special ``"\0"`` property name to define their internal v "\0" => [$inputArray], ]); -.. versionadded:: 6.2 - - The :class:`Symfony\\Component\\VarExporter\\Hydrator` was introduced in Symfony 6.2. - Creating Lazy Objects --------------------- @@ -288,10 +284,6 @@ Ghost objects unfortunately can't work with abstract classes or internal PHP classes. Nevertheless, the VarExporter component covers this need with the help of :ref:`Virtual Proxies `. -.. versionadded:: 6.2 - - The :class:`Symfony\\Component\\VarExporter\\LazyGhostTrait` was introduced in Symfony 6.2. - .. _var-exporter_virtual-proxies: LazyProxyTrait @@ -357,10 +349,5 @@ Just like ghost objects, while you never query ``$processor->hash``, its value will not be computed. The main difference with ghost objects is that this time, a proxy of an abstract class was created. This also works with internal PHP class. -.. versionadded:: 6.2 - - The :class:`Symfony\\Component\\VarExporter\\LazyProxyTrait` and - :class:`Symfony\\Component\\VarExporter\\ProxyHelper` were introduced in Symfony 6.2. - .. _`OPcache`: https://www.php.net/opcache .. _`PSR-2`: https://www.php-fig.org/psr/psr-2/ diff --git a/components/yaml.rst b/components/yaml.rst index 37d8064f235..ab4c0b6be22 100644 --- a/components/yaml.rst +++ b/components/yaml.rst @@ -355,10 +355,6 @@ and the special ``!php/enum`` syntax to parse them as proper PHP enums:: // the value of the 'foo' key is a string because it missed the `!php/enum` syntax // $parameters = ['foo' => 'FooEnum::Foo', 'bar' => 'foo']; -.. versionadded:: 6.2 - - The support for PHP enumerations was introduced in Symfony 6.2. - Parsing and Dumping of Binary Data ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -422,10 +418,6 @@ By default, digit-only array keys are dumped as integers. You can use the $dumped = Yaml::dump([200 => 'foo'], 2, 4, Yaml::DUMP_NUMERIC_KEY_AS_STRING); // '200': foo -.. versionadded:: 6.3 - - The ``DUMP_NUMERIC_KEY_AS_STRING`` flag was introduced in Symfony 6.3. - Syntax Validation ~~~~~~~~~~~~~~~~~ diff --git a/configuration.rst b/configuration.rst index e4a923c5858..bcdebade23a 100644 --- a/configuration.rst +++ b/configuration.rst @@ -81,10 +81,6 @@ readable. These are the main advantages and disadvantages of each format: methods in the ``src/Kernel.php`` file to add support for the ``.xml`` file extension. - .. versionadded:: 6.1 - - The automatic loading of PHP configuration files was introduced in Symfony 6.1. - Importing Configuration Files ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -292,14 +288,6 @@ reusable configuration value. By convention, parameters are defined under the something@example.com -.. versionadded:: 6.2 - - Passing an enum case as a service parameter was introduced in Symfony 6.2. - -.. versionadded:: 6.3 - - The ``trim`` attribute was introduced in Symfony 6.3. - 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%``): @@ -395,10 +383,6 @@ a new ``locale`` parameter is added to the ``config/services.yaml`` file). They are useful when working with :ref:`Compiler Passes ` to declare some temporary parameters that won't be available later in the application. -.. versionadded:: 6.3 - - Compile-time parameters were introduced in Symfony 6.3. - .. seealso:: Later in this article you can read how to @@ -984,10 +968,6 @@ Use the ``debug:dotenv`` command to understand how Symfony parses the different # look for a specific variable passing its full or partial name as an argument $ php bin/console debug:dotenv foo -.. versionadded:: 6.2 - - The option to pass variable names to ``debug:dotenv`` was introduced in Symfony 6.2. - Additionally, and regardless of how you set environment variables, you can see all environment variables, with their values, referenced in Symfony's container configuration: diff --git a/configuration/env_var_processors.rst b/configuration/env_var_processors.rst index 4f600a5b34b..eba9f4a482c 100644 --- a/configuration/env_var_processors.rst +++ b/configuration/env_var_processors.rst @@ -418,10 +418,6 @@ Symfony provides the following env var processors: ->set(\RedisCluster::class, \RedisCluster::class)->args([null, '%env(shuffle:csv:REDIS_NODES)%']); }; - .. versionadded:: 6.2 - - The ``env(shuffle:...)`` env var processor was introduced in Symfony 6.2. - ``env(file:FOO)`` Returns the contents of a file whose path is the value of the ``FOO`` env var: @@ -782,10 +778,6 @@ Symfony provides the following env var processors: // config/services.php $container->setParameter('typed_env', '%env(enum:App\Enum\Environment:APP_ENV)%'); - .. versionadded:: 6.2 - - The ``env(enum:...)`` env var processor was introduced in Symfony 6.2. - ``env(defined:NO_FOO)`` Evaluates to ``true`` if the env var exists and its value is not ``''`` (an empty string) or ``null``; it returns ``false`` otherwise. @@ -820,10 +812,6 @@ Symfony provides the following env var processors: // config/services.php $container->setParameter('typed_env', '%env(defined:FOO)%'); - .. versionadded:: 6.4 - - The ``env(defined:...)`` env var processor was introduced in Symfony 6.4. - It is also possible to combine any number of processors: .. configuration-block:: diff --git a/configuration/micro_kernel_trait.rst b/configuration/micro_kernel_trait.rst index 890f3fc8b9c..26a332e4fdd 100644 --- a/configuration/micro_kernel_trait.rst +++ b/configuration/micro_kernel_trait.rst @@ -120,10 +120,6 @@ Next, create an ``index.php`` file that defines the kernel class and runs it: $response->send(); $kernel->terminate($request, $response); -.. versionadded:: 6.1 - - The PHP attributes notation has been introduced in Symfony 6.1. - That's it! To test it, start the :doc:`Symfony Local Web Server `: @@ -338,10 +334,6 @@ add a service conditionally based on the ``foo`` value:: } } -.. versionadded:: 6.1 - - The ``AbstractExtension`` class was introduced in Symfony 6.1. - Unlike the previous kernel, this loads an external ``config/framework.yaml`` file, because the configuration started to get bigger: diff --git a/console.rst b/console.rst index 1f468327d61..136d4c7f8fe 100644 --- a/console.rst +++ b/console.rst @@ -67,14 +67,6 @@ command, for instance: Console Completion ~~~~~~~~~~~~~~~~~~ -.. versionadded:: 6.1 - - Console completion for Fish was introduced in Symfony 6.1. - -.. versionadded:: 6.2 - - Console completion for Zsh was introduced in Symfony 6.2. - If you are using the Bash, Zsh or Fish shell, you can install Symfony's completion script to get auto completion when typing commands in the terminal. All commands support name and option completion, and some can @@ -356,10 +348,6 @@ method, which returns an instance of A new line is appended automatically when displaying information in a section. -.. versionadded:: 6.2 - - The feature to limit the height of a console section was introduced in Symfony 6.2. - Output sections let you manipulate the Console output in advanced ways, such as :ref:`displaying multiple progress bars ` which are updated independently and :ref:`appending rows to tables ` diff --git a/console/coloring.rst b/console/coloring.rst index a481b7650ff..346e0818a41 100644 --- a/console/coloring.rst +++ b/console/coloring.rst @@ -56,10 +56,6 @@ Any hex color is supported for foreground and background colors. Besides that, t the nearest color depending on the terminal capabilities. E.g. ``#c0392b`` is degraded to ``#d75f5f`` in 256-color terminals and to ``red`` in 8-color terminals. - .. versionadded:: 6.2 - - The support for 256-color terminals was introduced in Symfony 6.2. - And available options are: ``bold``, ``underscore``, ``blink``, ``reverse`` (enables the "reverse video" mode where the background and foreground colors are swapped) and ``conceal`` (sets the foreground color to transparent, making diff --git a/console/input.rst b/console/input.rst index ed637bdba74..4d709c18825 100644 --- a/console/input.rst +++ b/console/input.rst @@ -354,12 +354,6 @@ To achieve this, use the 5th argument of ``addArgument()``/``addOption``:: } } -.. versionadded:: 6.1 - - The argument to ``addOption()``/``addArgument()`` was introduced in - Symfony 6.1. Prior to this version, you had to override the - ``complete()`` method of the command. - That's all you need! Assuming users "Fabien" and "Fabrice" exist, pressing tab after typing ``app:greet Fa`` will give you these names as a suggestion. diff --git a/console/style.rst b/console/style.rst index bcc4d982457..0aaaa3f675e 100644 --- a/console/style.rst +++ b/console/style.rst @@ -333,10 +333,6 @@ User Input Methods $io->choice('Select the queue to analyze', ['queue1', 'queue2', 'queue3'], multiSelect: true); -.. versionadded:: 6.2 - - The ``multiSelect`` option of ``choice()`` was introduced in Symfony 6.2. - .. _symfony-style-blocks: Result Methods @@ -445,10 +441,6 @@ If you prefer to wrap all contents, including URLs, use this method:: } } -.. versionadded:: 6.2 - - The ``setAllowCutUrls()`` method was introduced in Symfony 6.2. - Defining your Own Styles ------------------------ diff --git a/contributing/documentation/format.rst b/contributing/documentation/format.rst index b403169cbaf..d933f3bcead 100644 --- a/contributing/documentation/format.rst +++ b/contributing/documentation/format.rst @@ -251,34 +251,34 @@ directive: .. code-block:: rst - .. versionadded:: 6.2 + .. versionadded:: 7.2 - ... ... ... was introduced in Symfony 6.2. + ... ... ... was introduced in Symfony 7.2. If you are documenting a behavior change, it may be helpful to *briefly* describe how the behavior has changed: .. code-block:: rst - .. versionadded:: 6.2 + .. versionadded:: 7.2 - ... ... ... was introduced in Symfony 6.2. Prior to this, + ... ... ... was introduced in Symfony 7.2. Prior to this, ... ... ... ... ... ... ... ... . -For a deprecation use the ``.. deprecated:: 6.x`` directive: +For a deprecation use the ``.. deprecated:: 7.x`` directive: .. code-block:: rst - .. deprecated:: 6.2 + .. deprecated:: 7.2 - ... ... ... was deprecated in Symfony 6.2. + ... ... ... was deprecated in Symfony 7.2. -Whenever a new major version of Symfony is released (e.g. 7.0, 8.0, etc), a new +Whenever a new major version of Symfony is released (e.g. 8.0, 9.0, etc), a new branch of the documentation is created from the ``x.4`` branch of the previous major version. At this point, all the ``versionadded`` and ``deprecated`` tags for Symfony versions that have a lower major version will be removed. For -example, if Symfony 7.0 were released today, 6.0 to 6.4 ``versionadded`` and -``deprecated`` tags would be removed from the new ``7.0`` branch. +example, if Symfony 8.0 were released today, 7.0 to 7.4 ``versionadded`` and +``deprecated`` tags would be removed from the new ``8.0`` branch. .. _reStructuredText: https://docutils.sourceforge.io/rst.html .. _Sphinx: https://www.sphinx-doc.org/ diff --git a/controller.rst b/controller.rst index 7afae06f728..891416d8aeb 100644 --- a/controller.rst +++ b/controller.rst @@ -229,10 +229,6 @@ command: You can read more about this attribute in :ref:`autowire-attribute`. - .. versionadded:: 6.1 - - The ``#[Autowire]`` attribute was introduced in Symfony 6.1. - Like with all services, you can also use regular :ref:`constructor injection ` in your controllers. @@ -383,11 +379,6 @@ attribute, arguments of your controller's action can be automatically fulfilled: // ... } -.. versionadded:: 6.3 - - The :class:`Symfony\\Component\\HttpKernel\\Attribute\\MapQueryParameter` attribute - was introduced in Symfony 6.3. - Mapping The Whole Query String ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -449,15 +440,6 @@ HTTP status to return if the validation fails:: The default status code returned if the validation fails is 404. -.. versionadded:: 6.3 - - The :class:`Symfony\\Component\\HttpKernel\\Attribute\\MapQueryString` attribute - was introduced in Symfony 6.3. - -.. versionadded:: 6.4 - - The ``validationFailedStatusCode`` parameter was introduced in Symfony 6.4. - Mapping Request Payload ~~~~~~~~~~~~~~~~~~~~~~~ @@ -546,15 +528,6 @@ if you want to map a nested array of specific DTOs:: ) {} } -.. versionadded:: 6.3 - - The :class:`Symfony\\Component\\HttpKernel\\Attribute\\MapRequestPayload` attribute - was introduced in Symfony 6.3. - -.. versionadded:: 6.4 - - The ``validationFailedStatusCode`` parameter was introduced in Symfony 6.4. - Managing the Session -------------------- @@ -728,11 +701,6 @@ The ``file()`` helper provides some arguments to configure its behavior:: Sending Early Hints ~~~~~~~~~~~~~~~~~~~ -.. versionadded:: 6.3 - - The Early Hints helper of the ``AbstractController`` was introduced - in Symfony 6.3. - `Early hints`_ tell the browser to start downloading some assets even before the application sends the response content. This improves perceived performance because the browser can prefetch resources that will be needed once the full diff --git a/controller/value_resolver.rst b/controller/value_resolver.rst index 71efd680b08..abefc0efbb3 100644 --- a/controller/value_resolver.rst +++ b/controller/value_resolver.rst @@ -75,10 +75,6 @@ Symfony ships with the following value resolvers in the The example above allows requesting only ``/cards/D`` and ``/cards/S`` URLs and leads to 404 Not Found response in two other cases. - .. versionadded:: 6.1 - - The ``BackedEnumValueResolver`` and ``EnumRequirement`` were introduced in Symfony 6.1. - :class:`Symfony\\Component\\HttpKernel\\Controller\\ArgumentResolver\\RequestAttributeValueResolver` Attempts to find a request attribute that matches the name of the argument. @@ -98,16 +94,6 @@ Symfony ships with the following value resolvers in the receives when testing your application and using the :class:`Symfony\\Component\\Clock\\MockClock` implementation. - .. versionadded:: 6.1 - - The ``DateTimeValueResolver`` and the ``MapDateTime`` attribute were - introduced in Symfony 6.1. - - .. versionadded:: 6.3 - - The use of the :doc:`Clock component ` to generate the - ``DateTimeInterface`` object was introduced in Symfony 6.3. - :class:`Symfony\\Component\\HttpKernel\\Controller\\ArgumentResolver\\RequestValueResolver` Injects the current ``Request`` if type-hinted with ``Request`` or a class extending ``Request``. @@ -147,10 +133,6 @@ Symfony ships with the following value resolvers in the } } - .. versionadded:: 6.1 - - The ``UidValueResolver`` was introduced in Symfony 6.1. - :class:`Symfony\\Component\\HttpKernel\\Controller\\ArgumentResolver\\VariadicValueResolver` Verifies if the request data is an array and will add all of them to the argument list. When the action is called, the last (variadic) argument will @@ -176,10 +158,6 @@ In addition, some components, bridges and official bundles provide other value r If the argument is not nullable and there is no logged in token, an ``HttpException`` with status code 401 is thrown by the resolver to prevent access to the controller. - .. versionadded:: 6.3 - - The ``SecurityTokenValueResolver`` was introduced in Symfony 6.3. - :class:`Symfony\\Bridge\\Doctrine\\ArgumentResolver\\EntityValueResolver` Automatically query for an entity and pass it as an argument to your controller. @@ -203,10 +181,6 @@ In addition, some components, bridges and official bundles provide other value r To learn more about the use of the ``EntityValueResolver``, see the dedicated section :ref:`Automatically Fetching Objects `. - .. versionadded:: 6.2 - - The ``EntityValueResolver`` was introduced in Symfony 6.2. - PSR-7 Objects Resolver: Injects a Symfony HttpFoundation ``Request`` object created from a PSR-7 object of type :class:`Psr\\Http\\Message\\ServerRequestInterface`, @@ -252,10 +226,6 @@ lets you do this by "targeting" the resolver you want:: } } -.. versionadded:: 6.3 - - The ``ValueResolver`` attribute was introduced in Symfony 6.3. - In the example above, the ``SessionValueResolver`` will be called first because it is targeted. The ``DefaultValueResolver`` will be called next if no value has been provided; that's why you can assign ``null`` as ``$session``'s default value. @@ -289,13 +259,6 @@ object whenever a controller argument has a type implementing } } -.. versionadded:: 6.2 - - The ``ValueResolverInterface`` was introduced in Symfony 6.2. Prior to - 6.2, you had to use the - :class:`Symfony\\Component\\HttpKernel\\Controller\\ArgumentValueResolverInterface`, - which defines different methods. - Adding a new value resolver requires creating a class that implements :class:`Symfony\\Component\\HttpKernel\\Controller\\ValueResolverInterface` and defining a service for it. @@ -469,8 +432,3 @@ You can then pass this name as ``ValueResolver``'s first argument to target your // ... do something with $id } } - -.. versionadded:: 6.3 - - The ``controller.targeted_value_resolver`` tag and ``AsTargetedValueResolver`` - attribute were introduced in Symfony 6.3. diff --git a/doctrine.rst b/doctrine.rst index 0e8cd614598..b1931c5ddf8 100644 --- a/doctrine.rst +++ b/doctrine.rst @@ -606,10 +606,6 @@ the :ref:`doctrine-queries` section. Automatically Fetching Objects (EntityValueResolver) ---------------------------------------------------- -.. versionadded:: 6.2 - - Entity Value Resolver was introduced in Symfony 6.2. - .. versionadded:: 2.7.1 Autowiring of the ``EntityValueResolver`` was introduced in DoctrineBundle 2.7.1. @@ -758,11 +754,6 @@ variable. Let's say you pass the page limit of a list in a query parameter:: ): Response { } -.. versionadded:: 6.4 - - The support for the ``request`` variable in expressions was introduced - in Symfony 6.4. - MapEntity Options ~~~~~~~~~~~~~~~~~ diff --git a/form/unit_testing.rst b/form/unit_testing.rst index e191676215c..fbaa067858e 100644 --- a/form/unit_testing.rst +++ b/form/unit_testing.rst @@ -249,9 +249,4 @@ All you need to do is to implement the :method:`Symfony\\Bridge\\Twig\\Test\\FormLayoutTestCase::getTwigExtensions` and the :method:`Symfony\\Bridge\\Twig\\Test\\FormLayoutTestCase::getThemes` methods. -.. versionadded:: 6.4 - - The :class:`Symfony\\Bridge\\Twig\\Test\\FormLayoutTestCase` class was - introduced in Symfony 6.4. - .. _`PHPUnit data providers`: https://docs.phpunit.de/en/9.6/writing-tests-for-phpunit.html#data-providers diff --git a/frontend/asset_mapper.rst b/frontend/asset_mapper.rst index 8e655d69570..8317e5e3ecb 100644 --- a/frontend/asset_mapper.rst +++ b/frontend/asset_mapper.rst @@ -1,10 +1,6 @@ AssetMapper: Simple, Modern CSS & JS Management =============================================== -.. versionadded:: 6.3 - - The AssetMapper component was introduced in Symfony 6.3. - The AssetMapper component lets you write modern JavaScript and CSS without the complexity of using a bundler. Browsers *already* support many modern JavaScript features like the ``import`` statement and ES6 classes. And the HTTP/2 protocol means that @@ -238,10 +234,6 @@ directory and not commit it to your repository. Therefore, you'll need to run th ``php bin/console importmap:install`` command to download the files on other computers if some files are missing. -.. versionadded:: 6.4 - - The ``importmap:install`` command was introduced in Symfony 6.4. - .. note:: Sometimes, a package - like ``bootstrap`` - will have one or more dependencies, @@ -258,10 +250,6 @@ You can check for available updates for your third-party packages by running: # check for updates for the given list of packages $ php bin/console importmap:outdated bootstrap lodash -.. versionadded:: 6.4 - - The ``importmap:outdated`` command was introduced in Symfony 6.4. - To update third-party packages in your ``importmap.php`` file, run: .. code-block:: terminal @@ -680,11 +668,6 @@ same way:: If the :doc:`WebLink Component ` is available in your application, Symfony will add a ``Link`` header in the response to preload the CSS files. -.. versionadded:: 6.4 - - Automatic preloading of CSS files when WebLink is available was - introduced in Symfony 6.4. - Frequently Asked Questions -------------------------- @@ -1101,10 +1084,6 @@ command as part of your CI to be warned anytime a new vulnerability is found. The command takes a ``--format`` option to choose the output format between ``txt`` and ``json``. -.. versionadded:: 6.4 - - The ``importmap:audit`` command was introduced in Symfony 6.4. - .. _latest asset-mapper recipe: https://github.com/symfony/recipes/tree/main/symfony/asset-mapper .. _import statement: https://caniuse.com/es6-module-dynamic-import .. _ES6: https://caniuse.com/es6 diff --git a/html_sanitizer.rst b/html_sanitizer.rst index baef54e79d4..ea6eb0c8106 100644 --- a/html_sanitizer.rst +++ b/html_sanitizer.rst @@ -1,10 +1,6 @@ HTML Sanitizer ============== -.. versionadded:: 6.1 - - The HTML Sanitizer component was introduced in Symfony 6.1. - The HTML Sanitizer component aims at sanitizing/cleaning untrusted HTML code (e.g. created by a WYSIWYG editor in the browser) into HTML that can be trusted. It is based on the `HTML Sanitizer W3C Standard Proposal`_. diff --git a/http_cache.rst b/http_cache.rst index e1f1a57399c..38badf3a5c4 100644 --- a/http_cache.rst +++ b/http_cache.rst @@ -229,10 +229,6 @@ The *easiest* way to cache a response is by caching it for a specific amount of return $response; } -.. versionadded:: 6.2 - - The ``#[Cache()]`` attribute was introduced in Symfony 6.2. - Thanks to this new code, your HTTP response will have the following header: .. code-block:: text diff --git a/http_cache/esi.rst b/http_cache/esi.rst index aaf1de564c1..52a09fb16a7 100644 --- a/http_cache/esi.rst +++ b/http_cache/esi.rst @@ -279,8 +279,4 @@ The ``render_esi`` helper supports three other useful options: ``absolute_uri`` If set to true, an absolute URI will be generated. **default**: ``false`` -.. versionadded:: 6.2 - - The ``absolute_uri`` option was introduced in Symfony 6.2. - .. _`ESI`: https://www.w3.org/TR/esi-lang/ diff --git a/http_client.rst b/http_client.rst index 7b45c2cf2b4..083d6c83e70 100644 --- a/http_client.rst +++ b/http_client.rst @@ -618,13 +618,6 @@ of the opened file, but you can configure both with the PHP streaming configurat stream_context_set_option($fileHandle, 'http', 'filename', 'the-name.txt'); stream_context_set_option($fileHandle, 'http', 'content_type', 'my/content-type'); -.. versionadded:: 6.3 - - The feature to upload files using handles was introduced in Symfony 6.3. - In previous Symfony versions you had to encode the body contents according - to the ``multipart/form-data`` content-type using the :doc:`Symfony Mime ` - component. - .. tip:: When using multidimensional arrays the :class:`Symfony\\Component\\Mime\\Part\\Multipart\\FormDataPart` @@ -717,10 +710,6 @@ when using any HTTP method and ``500``, ``504``, ``507`` and ``510`` when using an HTTP `idempotent method`_. Use the ``max_retries`` setting to configure the amount of times a request is retried. -.. versionadded:: 6.4 - - The ``max_retries`` options was introduced in Symfony 6.4. - Check out the full list of configurable :ref:`retry_failed options ` to learn how to tweak each of them to fit your application needs. @@ -740,10 +729,6 @@ each retry. Retry Over Several Base URIs ............................ -.. versionadded:: 6.3 - - The multiple ``base_uri`` feature was added in Symfony 6.3. - The ``RetryableHttpClient`` can be configured to use multiple base URIs. This feature provides increased flexibility and reliability for making HTTP requests. Pass an array of base URIs as option ``base_uri`` when making a @@ -962,11 +947,6 @@ If you want to define your own logic to handle variables of URI templates, you can do so by redefining the ``http_client.uri_template_expander`` alias. Your service must be invokable. -.. versionadded:: 6.3 - - The :class:`Symfony\\Component\\HttpClient\\UriTemplateHttpClient` was - introduced in Symfony 6.3. - Performance ----------- @@ -1525,10 +1505,6 @@ to wrap your HTTP client, open a connection to a server that responds with a use the :method:`Symfony\\Component\\HttpClient\\Chunk\\ServerSentEvent::getArrayData` method to directly get the decoded JSON as array. -.. versionadded:: 6.3 - - The ``ServerSentEvent::getArrayData()`` method was introduced in Symfony 6.3. - Interoperability ---------------- @@ -1646,10 +1622,6 @@ You can also pass a set of default options to your client thanks to the // ... -.. versionadded:: 6.2 - - The ``Psr18Client::withOptions()`` method was introduced in Symfony 6.2. - HTTPlug ~~~~~~~ @@ -1751,10 +1723,6 @@ You can also pass a set of default options to your client thanks to the // ... -.. versionadded:: 6.2 - - The ``HttplugClient::withOptions()`` method was introduced in Symfony 6.2. - Native PHP Streams ~~~~~~~~~~~~~~~~~~ @@ -2096,10 +2064,6 @@ You can use :class:`Symfony\\Component\\HttpClient\\Response\\JsonMockResponse` 'foo' => 'bar', ]); -.. versionadded:: 6.3 - - The ``JsonMockResponse`` was introduced in Symfony 6.3. - Testing Request Data ~~~~~~~~~~~~~~~~~~~~ @@ -2251,10 +2215,6 @@ will find the associated response based on the request method, URL and body (if Note that **this won't work** if the request body or URI is random / always changing (e.g. if it contains current date or random UUIDs). -.. versionadded:: 6.4 - - The ``HarFileResponseFactory`` was introduced in Symfony 6.4. - Testing Network Transport Exceptions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -2301,12 +2261,6 @@ you to do so, by yielding the exception from its body:: } } -.. versionadded:: 6.1 - - Being allowed to pass an exception directly to the body of a - :class:`Symfony\\Component\\HttpClient\\Response\\MockResponse` was - introduced in Symfony 6.1. - .. _`cURL PHP extension`: https://www.php.net/curl .. _`Zlib PHP extension`: https://www.php.net/zlib .. _`PSR-17`: https://www.php-fig.org/psr/psr-17/ diff --git a/lock.rst b/lock.rst index 35c3dc5be3c..d70f1d5535b 100644 --- a/lock.rst +++ b/lock.rst @@ -159,11 +159,6 @@ this behavior by using the ``lock`` key like: ; }; -.. versionadded:: 6.1 - - The CSV support (e.g. ``zookeeper://localhost01,localhost02:2181``) in - ZookeeperStore DSN was introduced in Symfony 6.1. - Locking a Resource ------------------ diff --git a/mailer.rst b/mailer.rst index fb05b7fe668..155ad1623a3 100644 --- a/mailer.rst +++ b/mailer.rst @@ -115,21 +115,6 @@ Service Install with `SendGrid`_ ``composer require symfony/sendgrid-mailer`` ===================== ============================================== -.. versionadded:: 6.2 - - The Infobip integration was introduced in Symfony 6.2 and the ``MailPace`` - integration was renamed in Symfony 6.2 (in previous Symfony versions it was - called ``OhMySMTP``). - -.. versionadded:: 6.3 - - The MailerSend integration was introduced in Symfony 6.3. - -.. versionadded:: 6.4 - - The ``Brevo`` (in previous Symfony versions it was called ``Sendinblue``) - and ``Scaleway`` integrations were introduced in Symfony 6.4. - .. note:: As a convenience, Symfony also provides support for Gmail (``composer @@ -227,10 +212,6 @@ party provider: | | - API sendgrid+api://KEY@default | +------------------------+-----------------------------------------------------+ -.. versionadded:: 6.3 - - The ``sandbox`` option in ``Mailjet`` API was introduced in Symfony 6.3. - .. caution:: If your credentials contain special characters, you must URL-encode them. @@ -344,10 +325,6 @@ may be specified as SHA1 or MD5 hash:: $dsn = 'smtp://user:pass@smtp.example.com?peer_fingerprint=6A1CF3B08D175A284C30BC10DE19162307C7286E'; -.. versionadded:: 6.4 - - The ``peer_fingerprint`` option was introduced in Symfony 6.4. - Overriding default SMTP authenticators ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -373,11 +350,6 @@ This can be done from ``EsmtpTransport`` constructor or using the // Option 2: call a method to redefine the authenticators $transport->setAuthenticators([new XOAuth2Authenticator()]); -.. versionadded:: 6.3 - - The ``$authenticators`` constructor parameter and the ``setAuthenticators()`` - method were introduced in Symfony 6.3. - Other Options ~~~~~~~~~~~~~ @@ -413,10 +385,6 @@ Other Options $dsn = 'smtps://smtp.example.com?max_per_second=2' - .. versionadded:: 6.2 - - The ``max_per_second`` option was introduced in Symfony 6.2. - Creating & Sending Messages --------------------------- @@ -816,11 +784,6 @@ for Twig templates:: ]) ; -.. versionadded:: 6.4 - - The :method:`Symfony\\Bridge\\Twig\\Mime\\TemplatedEmail::locale` method - was introduced in Symfony 6.4. - Then, create the template: .. code-block:: html+twig @@ -1414,11 +1377,6 @@ the "rendering" of the email (computed headers, body rendering, ...) is also deferred and will only happen just before the email is sent by the Messenger handler. -.. versionadded:: 6.2 - - The following example about rendering the email before calling - ``$mailer->send($email)`` works as of Symfony 6.2. - When sending an email asynchronously, its instance must be serializable. This is always the case for :class:`Symfony\\Bridge\\Twig\\Mime\\Email` instances, but when sending a @@ -1492,11 +1450,6 @@ disable asynchronous delivery. an open connection to the SMTP server in between sending emails. You can do so by using the ``stop()`` method. -.. versionadded:: 6.1 - - The :method:`Symfony\\Component\\Mailer\\Transport\\Smtp\\SmtpTransport::stop` - method was made public in Symfony 6.1. - You can also select the transport by adding an ``X-Bus-Transport`` header (which will be removed automatically from the final message):: @@ -1504,10 +1457,6 @@ will be removed automatically from the final message):: $email->getHeaders()->addTextHeader('X-Bus-Transport', 'app.another_bus'); $mailer->send($email); -.. versionadded:: 6.2 - - The ``X-Bus-Transport`` header support was introduced in Symfony 6.2. - Adding Tags and Metadata to Emails ---------------------------------- @@ -1549,17 +1498,9 @@ The following transports only support metadata: * Amazon SES (note that Amazon refers to this feature as "tags", but Symfony calls it "metadata" because it contains a key and a value) -.. versionadded:: 6.1 - - Metadata support for Amazon SES was introduced in Symfony 6.1. - Draft Emails ------------ -.. versionadded:: 6.1 - - ``Symfony\Component\Mime\DraftEmail`` was introduced in 6.1. - :class:`Symfony\\Component\\Mime\\DraftEmail` is a special instance of :class:`Symfony\\Component\\Mime\\Email`. Its purpose is to build up an email (with body, attachments, etc) and make available to download as an ``.eml`` with @@ -1631,10 +1572,6 @@ the email is sent:: $event->addStamp(new SomeMessengerStamp()); } -.. versionadded:: 6.2 - - Methods ``addStamp()`` and ``getStamps()`` were introduced in Symfony 6.2. - If you want to stop the Message from being sent, call ``reject()`` (it will also stop the event propagation):: @@ -1645,10 +1582,6 @@ also stop the event propagation):: $event->reject(); } -.. versionadded:: 6.3 - - The ``reject()`` method was introduced in Symfony 6.3. - Execute this command to find out which listeners are registered for this event and their priorities: @@ -1661,10 +1594,6 @@ SentMessageEvent **Event Class**: :class:`Symfony\\Component\\Mailer\\Event\\SentMessageEvent` -.. versionadded:: 6.2 - - The ``SentMessageEvent`` event was introduced in Symfony 6.2. - ``SentMessageEvent`` allows you to act on the :class:`Symfony\\Component\\\Mailer\\\SentMessage` class to access the original message (``getOriginalMessage()``) and some debugging information (``getDebug()``) such as the HTTP calls made by the HTTP transports, @@ -1696,10 +1625,6 @@ FailedMessageEvent **Event Class**: :class:`Symfony\\Component\\Mailer\\Event\\FailedMessageEvent` -.. versionadded:: 6.2 - - The ``FailedMessageEvent`` event was introduced in Symfony 6.2. - ``FailedMessageEvent`` allows acting on the the initial message in case of a failure:: use Symfony\Component\EventDispatcher\EventSubscriberInterface; @@ -1749,10 +1674,6 @@ to test if sending emails works correctly: This command bypasses the :doc:`Messenger bus `, if configured, to ease testing emails even when the Messenger consumer is not running. -.. versionadded:: 6.2 - - The ``mailer:test`` command was introduced in Symfony 6.2. - Disabling Delivery ~~~~~~~~~~~~~~~~~~ diff --git a/messenger.rst b/messenger.rst index 39200f0cb70..1322841c974 100644 --- a/messenger.rst +++ b/messenger.rst @@ -71,10 +71,6 @@ message class (or a message interface):: methods. You may use the attribute on as many methods in a single class as you like, allowing you to group the handling of multiple related types of messages. -.. versionadded:: 6.1 - - Support for ``#[AsMessageHandler]`` on methods was introduced in Symfony 6.1. - Thanks to :ref:`autoconfiguration ` and the ``SmsNotification`` type-hint, Symfony knows that this handler should be called when an ``SmsNotification`` message is dispatched. Most of the time, this is all you need to do. But you can @@ -349,11 +345,6 @@ to multiple transports: name as its only argument. For more information about stamps, see `Envelopes & Stamps`_. -.. versionadded:: 6.2 - - The :class:`Symfony\\Component\\Messenger\\Stamp\\TransportNamesStamp` - stamp was introduced in Symfony 6.2. - Doctrine Entities in Messages ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -684,10 +675,6 @@ of some or all transports: In order for this command to work, the configured transport's receiver must implement :class:`Symfony\\Component\\Messenger\\Transport\\Receiver\\MessageCountAwareInterface`. -.. versionadded:: 6.2 - - The ``messenger:stats`` command was introduced in Symfony 6.2. - .. _messenger-supervisor: Supervisor Configuration @@ -769,10 +756,6 @@ However, you might prefer to use different POSIX signals for graceful shutdown. You can override default ones by setting the ``framework.messenger.stop_worker_on_signals`` configuration option. -.. versionadded:: 6.3 - - The ``framework.messenger.stop_worker_on_signals`` option was introduced in Symfony 6.3. - In some cases the ``SIGTERM`` signal is sent by Supervisor itself (e.g. stopping a Docker container having Supervisor as its entrypoint). In these cases you need to add a ``stopwaitsecs`` key to the program configuration (with a value @@ -985,10 +968,6 @@ this is configurable for each transport: the serialized form of the message is saved, which prevents to serialize it again if the message is later retried. - .. versionadded:: 6.1 - - The ``SerializedMessageStamp`` class was introduced in Symfony 6.1. - Avoiding Retrying ~~~~~~~~~~~~~~~~~ @@ -1105,15 +1084,6 @@ to retry them: # remove all messages in the failure transport $ php bin/console messenger:failed:remove --all -.. versionadded:: 6.2 - - The ``--class-filter`` and ``--stats`` options were introduced in Symfony 6.2. - -.. versionadded:: 6.4 - - The ``--all`` option was introduced in Symfony 6.4. - - If the message fails again, it will be re-sent back to the failure transport due to the normal :ref:`retry rules `. Once the max retry has been hit, the message will be discarded permanently. @@ -1389,10 +1359,6 @@ The transport has a number of options: ``exchange[type]`` Type of exchange ``fanout`` ============================================ ================================================= =================================== -.. versionadded:: 6.1 - - The ``connection_name`` option was introduced in Symfony 6.1. - You can also configure AMQP-specific settings on your message by adding :class:`Symfony\\Component\\Messenger\\Bridge\\Amqp\\Transport\\AmqpStamp` to your Envelope:: @@ -1615,15 +1581,6 @@ sentinel_master String, if null or empty Sentinel null support is disabled ======================= ===================================== ================================= -.. versionadded:: 6.1 - - The ``persistent_id``, ``retry_interval``, ``read_timeout``, ``timeout``, and - ``sentinel_master`` options were introduced in Symfony 6.1. - -.. versionadded:: 6.4 - - Support for the multiple Redis Sentinel hosts DNS was introduced in Symfony 6.4. - .. caution:: There should never be more than one ``messenger:consume`` command running with the same @@ -1782,10 +1739,6 @@ The transport has a number of options: ``wait_time`` `Long polling`_ duration in seconds 20 ====================== ====================================== =================================== -.. versionadded:: 6.1 - - The ``session_token`` option was introduced in Symfony 6.1. - .. note:: The ``wait_time`` parameter defines the maximum duration Amazon SQS should @@ -1929,12 +1882,6 @@ contains many useful information such as the exit code or the output of the process. You can refer to the page dedicated on :ref:`handler results ` for more information. -.. versionadded:: 6.4 - - The :class:`Symfony\\Component\\Console\\Messenger\\RunCommandMessage` - and :class:`Symfony\\Component\\Console\\Messenger\\RunCommandContext` - classes were introduced in Symfony 6.4. - Trigger An External Process ~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -1967,12 +1914,6 @@ contains many useful information such as the exit code or the output of the process. You can refer to the page dedicated on :ref:`handler results ` for more information. -.. versionadded:: 6.4 - - The :class:`Symfony\\Component\\Process\\Messenger\\RunProcessMessage` - and :class:`Symfony\\Component\\Process\\Messenger\\RunProcessContext` - classes were introduced in Symfony 6.4. - Pinging A Webservice -------------------- @@ -2013,11 +1954,6 @@ The handler will return a :class:`Symfony\\Contracts\\HttpClient\\ResponseInterface`, allowing you to gather and process information returned by the HTTP request. -.. versionadded:: 6.4 - - The :class:`Symfony\\Component\\HttpClient\\Messenger\\PingWebhookMessage` - class was introduced in Symfony 6.4. - Getting Results from your Handlers ---------------------------------- @@ -2538,11 +2474,6 @@ provided in order to ease the declaration of these special handlers:: } } -.. versionadded:: 6.3 - - The :method:`Symfony\\Component\\Messenger\\Handler\\BatchHandlerTrait::getBatchSize` - method was introduced in Symfony 6.3. - .. note:: When the ``$ack`` argument of ``__invoke()`` is ``null``, the message is @@ -2868,10 +2799,6 @@ of the process. For each, the event class is the event name: * :class:`Symfony\\Component\\Messenger\\Event\\WorkerStartedEvent` * :class:`Symfony\\Component\\Messenger\\Event\\WorkerStoppedEvent` -.. versionadded:: 6.2 - - The ``WorkerRateLimitedEvent`` was introduced in Symfony 6.2. - Additional Handler Arguments ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -2920,11 +2847,6 @@ Then your handler will look like this:: } } -.. versionadded:: 6.2 - - The :class:`Symfony\\Component\\Messenger\\Stamp\\HandlerArgumentsStamp` - was introduced in Symfony 6.2. - .. _messenger-multiple-buses: Multiple Buses, Command & Event Buses @@ -3038,10 +2960,6 @@ an **event bus**. The event bus could have zero or more subscribers. $eventBus->middleware()->id('validation'); }; -.. versionadded:: 6.2 - - The ``allow_no_senders`` option was introduced in Symfony 6.2. - This will create three new services: * ``command.bus``: autowireable with the :class:`Symfony\\Component\\Messenger\\MessageBusInterface` @@ -3247,12 +3165,6 @@ will take care of this message to redispatch it through the same bus it was dispatched at first. You can also use the second argument of the ``RedispatchMessage`` constructor to provide transports to use when redispatching the message. -.. versionadded:: 6.3 - - The :class:`Symfony\\Component\\Messenger\\Message\\RedispatchMessage` - and :class:`Symfony\\Component\\Messenger\\Handler\\RedispatchMessageHandler` - classes were introduced in Symfony 6.3. - Learn more ---------- diff --git a/notifier.rst b/notifier.rst index c617ea8224d..3127ec05bc1 100644 --- a/notifier.rst +++ b/notifier.rst @@ -102,26 +102,6 @@ Service Package DSN `Yunpian`_ ``symfony/yunpian-notifier`` ``yunpian://APIKEY@default`` ================== ===================================== =========================================================================== -.. versionadded:: 6.1 - - The 46elks, OrangeSms, KazInfoTeh and Sendberry integrations were introduced in Symfony 6.1. - The ``no_stop_clause`` option in ``OvhCloud`` DSN was introduced in Symfony 6.1. - The ``test`` option in ``Smsapi`` DSN was introduced in Symfony 6.1. - -.. versionadded:: 6.2 - - The ContactEveryone and SMSFactor integrations were introduced in Symfony 6.2. - -.. versionadded:: 6.3 - - The Bandwith, iSendPro, Plivo, RingCentral, SimpleTextin and Termii integrations - were introduced in Symfony 6.3. - The ``from`` option in ``Smsapi`` DSN is optional since Symfony 6.3. - -.. versionadded:: 6.4 - - The `Redlink`_ and `Brevo`_ integrations were introduced in Symfony 6.4. - To enable a texter, add the correct DSN in your ``.env`` file and configure the ``texter_transports``: @@ -211,14 +191,6 @@ send SMS messages:: } } -.. versionadded:: 6.2 - - The 3rd argument of ``SmsMessage`` (``$from``) was introduced in Symfony 6.2. - -.. versionadded:: 6.3 - - The 4th argument of ``SmsMessage`` (``$options``) was introduced in Symfony 6.3. - The ``send()`` method returns a variable of type :class:`Symfony\\Component\\Notifier\\Message\\SentMessage` which provides information such as the message ID and the original message contents. @@ -263,14 +235,6 @@ Service Package D `Zulip`_ ``symfony/zulip-notifier`` ``zulip://EMAIL:TOKEN@HOST?channel=CHANNEL`` ====================================== ==================================== ============================================================================= -.. versionadded:: 6.2 - - The Zendesk and Chatwork integration were introduced in Symfony 6.2. - -.. versionadded:: 6.3 - - The LINE Notify, Mastodon and Twitter integrations were introduced in Symfony 6.3. - Chatters are configured using the ``chatter_transports`` setting: .. code-block:: bash @@ -450,18 +414,6 @@ Service Package DSN `Pushover`_ ``symfony/pushover-notifier`` ``pushover://USER_KEY:APP_TOKEN@default`` =============== ==================================== ============================================================================== -.. versionadded:: 6.1 - - The Engagespot integration was introduced in Symfony 6.1. - -.. versionadded:: 6.3 - - The PagerDuty and Pushover integrations were introduced in Symfony 6.3. - -.. versionadded:: 6.4 - - The Novu, Ntfy and GoIP integrations were introduced in Symfony 6.4. - To enable a texter, add the correct DSN in your ``.env`` file and configure the ``texter_transports``: @@ -823,10 +775,6 @@ also exists to modify messages sent to those channels. Customize Browser Notifications (Flash Messages) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. versionadded:: 6.1 - - Support for customizing importance levels was introduced in Symfony 6.1. - The default behavior for browser channel notifications is to add a :ref:`flash message ` with ``notification`` as its key. @@ -886,11 +834,6 @@ You can benefit from this class by using it directly or extending the See :ref:`testing documentation ` for the list of available assertions. -.. versionadded:: 6.2 - - The :class:`Symfony\\Bundle\\FrameworkBundle\\Test\\NotificationAssertionsTrait` - was introduced in Symfony 6.2. - Disabling Delivery ------------------ diff --git a/performance.rst b/performance.rst index 847da532769..1bb0e261c74 100644 --- a/performance.rst +++ b/performance.rst @@ -261,10 +261,6 @@ in performance, you can stop generating the file as follows: // ... $container->parameters()->set('debug.container.dump', false); -.. versionadded:: 6.3 - - The ``debug.container.dump`` option was introduced in Symfony 6.3. - .. _profiling-applications: Profiling Symfony Applications diff --git a/profiler.rst b/profiler.rst index b21132a5816..c0d3640109b 100644 --- a/profiler.rst +++ b/profiler.rst @@ -35,10 +35,6 @@ Symfony Profiler, which will look like this: in the ``X-Debug-Token-Link`` HTTP response header. Browse the ``/_profiler`` URL to see all profiles. -.. versionadded:: 6.3 - - Profile garbage collection was introduced in Symfony 6.3. - .. note:: To limit the storage used by profiles on disk, they are probabilistically @@ -91,10 +87,6 @@ look for tokens based on some criteria:: // gets the latest 10 tokens for requests that happened between 2 and 4 days ago $tokens = $profiler->find('', '', 10, '', '4 days ago', '2 days ago'); -.. versionadded:: 6.4 - - Prefixing the URL filter with a ``!`` symbol to negate the query was introduced in Symfony 6.4. - Data Collectors --------------- diff --git a/rate_limiter.rst b/rate_limiter.rst index 1fe86ef020a..5cb5cbfd918 100644 --- a/rate_limiter.rst +++ b/rate_limiter.rst @@ -320,11 +320,6 @@ processes by reserving unused tokens. $limit->wait(); } while (!$limit->isAccepted()); -.. versionadded:: 6.4 - - The support for the ``reserve()`` method for the ``SlidingWindow`` strategy - was introduced in Symfony 6.4. - Exposing the Rate Limiter Status ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -370,11 +365,6 @@ the :class:`Symfony\\Component\\RateLimiter\\Reservation` object returned by the } } -.. versionadded:: 6.4 - - The :method:`Symfony\\Component\\RateLimiter\\Policy\\SlidingWindow::calculateTimeForTokens` - method was introduced in Symfony 6.4. - .. _rate-limiter-storage: Storing Rate Limiter State diff --git a/reference/configuration/debug.rst b/reference/configuration/debug.rst index 482396d2ae2..62cc40675b2 100644 --- a/reference/configuration/debug.rst +++ b/reference/configuration/debug.rst @@ -17,10 +17,6 @@ key in your application configuration. # environment variables with their actual values $ php bin/console debug:config --resolve-env framework -.. versionadded:: 6.2 - - The ``--resolve-env`` option was introduced in Symfony 6.2. - .. note:: When using XML, you must use the ``http://symfony.com/schema/dic/debug`` diff --git a/reference/configuration/framework.rst b/reference/configuration/framework.rst index aefbcac2fce..f31921cfc9c 100644 --- a/reference/configuration/framework.rst +++ b/reference/configuration/framework.rst @@ -60,10 +60,6 @@ thrown by the application and will turn them into HTTP responses. Starting from Symfony 7.0, the default value of this option will be ``true``. -.. versionadded:: 6.2 - - The ``handle_all_throwables`` option was introduced in Symfony 6.2. - .. _configuration-framework-http_cache: http_cache @@ -124,10 +120,6 @@ skip_response_headers Set of response headers that will never be cached even when the response is cacheable and public. -.. versionadded:: 6.3 - - The ``skip_response_headers`` option was introduced in Symfony 6.3. - allow_reload ............ @@ -210,10 +202,6 @@ trust_x_sendfile_type_header **type**: ``boolean`` **default**: ``false`` -.. versionadded:: 6.1 - - The ``trust_x_sendfile_type_header`` option was introduced in Symfony 6.1. - ``X-Sendfile`` is a special HTTP header that tells web servers to replace the response contents by the file that is defined in that header. This improves performance because files are no longer served by your application but directly @@ -300,10 +288,6 @@ feature is to configure it on a system level. First, you can define this option in the ``SYMFONY_IDE`` environment variable, which Symfony reads automatically when ``framework.ide`` config is not set. -.. versionadded:: 6.1 - - ``SYMFONY_IDE`` environment variable support was introduced in Symfony 6.1. - Another alternative is to set the ``xdebug.file_link_format`` option in your ``php.ini`` configuration file. The format to use is the same as for the ``framework.ide`` option, but without the need to escape the percent signs @@ -1016,10 +1000,6 @@ crypto_method The minimum version of TLS to accept. The value must be one of the ``STREAM_CRYPTO_METHOD_TLSv*_CLIENT`` constants defined by PHP. -.. versionadded:: 6.3 - - The ``crypto_method`` option was introduced in Symfony 6.3. - delay ..... @@ -1045,10 +1025,6 @@ extra Arbitrary additional data to pass to the HTTP client for further use. This can be particularly useful when :ref:`decorating an existing client `. -.. versionadded:: 6.3 - - The ``extra`` option has been introduced in Symfony 6.3. - .. _http-headers: headers @@ -1263,10 +1239,6 @@ enough to be sure about the server, so you should combine this with the html_sanitizer ~~~~~~~~~~~~~~ -.. versionadded:: 6.1 - - The HTML sanitizer configuration was introduced in Symfony 6.1. - The ``html_sanitizer`` option (and its children) are used to configure custom HTML sanitizers. Read more about the options in the :ref:`HTML sanitizer documentation `. @@ -1357,10 +1329,6 @@ Set this option to ``true`` to enable the serializer data collector and its profiler panel. When this option is ``true``, all normalizers and encoders are decorated by traceable implementations that collect profiling information about them. -.. versionadded:: 6.1 - - The ``collect_serializer_data`` option was introduced in Symfony 6.1. - rate_limiter ~~~~~~~~~~~~ @@ -1542,10 +1510,6 @@ cache_dir The directory where routing information will be cached. Can be set to ``~`` (``null``) to disable route caching. -.. versionadded:: 6.2 - - The ``cache_dir`` setting was introduced in Symfony 6.2. - secrets ~~~~~~~ @@ -3374,10 +3338,6 @@ Name of the lock you want to create. semaphore ~~~~~~~~~ -.. versionadded:: 6.1 - - The ``semaphore`` option was introduced in Symfony 6.1. - **type**: ``string`` | ``array`` The default semaphore adapter. Store's DSN are also allowed. @@ -3824,10 +3784,6 @@ to the ``#[WithHttpStatus]`` attribute on the exception class:: { } -.. versionadded:: 6.3 - - The ``#[WithHttpStatus]`` attribute was introduced in Symfony 6.3. - It is also possible to map a log level on a custom exception class using the ``#[WithLogLevel]`` attribute:: @@ -3841,10 +3797,6 @@ the ``#[WithLogLevel]`` attribute:: { } -.. versionadded:: 6.3 - - The ``#[WithLogLevel]`` attribute was introduced in Symfony 6.3. - .. _`HTTP Host header attacks`: https://www.skeletonscribe.net/2013/05/practical-http-host-header-attacks.html .. _`Security Advisory Blog post`: https://symfony.com/blog/security-releases-symfony-2-0-24-2-1-12-2-2-5-and-2-3-3-released#cve-2013-4752-request-gethost-poisoning .. _`PhpStormProtocol`: https://github.com/aik099/PhpStormProtocol diff --git a/reference/configuration/kernel.rst b/reference/configuration/kernel.rst index c6c0669d1a4..2bfa662db8c 100644 --- a/reference/configuration/kernel.rst +++ b/reference/configuration/kernel.rst @@ -25,11 +25,6 @@ method of the kernel class, which you can override to return a different value. You can also change the build directory by defining an environment variable named ``APP_BUILD_DIR`` whose value is the absolute path of the build folder. -.. versionadded:: 6.4 - - The support of the ``APP_BUILD_DIR`` environment variable was introduced in - Symfony 6.4. - ``kernel.bundles`` ------------------ diff --git a/reference/configuration/security.rst b/reference/configuration/security.rst index d6ffd07f102..aaa862fd2f1 100644 --- a/reference/configuration/security.rst +++ b/reference/configuration/security.rst @@ -497,10 +497,6 @@ It's also possible to use ``*`` as a wildcard for all directives: ], ]); -.. versionadded:: 6.3 - - The ``clear_site_data`` option was introduced in Symfony 6.3. - invalidate_session .................. @@ -541,10 +537,6 @@ Set this option to ``true`` to enable CSRF protection in the logout process using Symfony's default CSRF token manager. Set also the ``csrf_token_manager`` option if you need to use a custom CSRF token manager. -.. versionadded:: 6.2 - - The ``enable_csrf`` option was introduced in Symfony 6.2. - csrf_parameter .............. @@ -807,10 +799,6 @@ user_identifier **type**: ``string`` **default**: ``emailAddress`` -.. versionadded:: 6.3 - - The ``user_identifier`` option was introduced in Symfony 6.3. - The value of this option tells Symfony which parameter to use to find the user identifier in the "distinguished name". @@ -1013,10 +1001,6 @@ the session must not be used when authenticating users: Routes under this firewall will be :ref:`configured stateless ` when they are not explicitly configured stateless or not. -.. versionadded:: 6.3 - - Stateless firewall marking routes stateless was introduced in Symfony 6.3. - User Checkers ~~~~~~~~~~~~~ diff --git a/reference/configuration/twig.rst b/reference/configuration/twig.rst index 78a895bb4b8..883b0b11eb7 100644 --- a/reference/configuration/twig.rst +++ b/reference/configuration/twig.rst @@ -57,11 +57,6 @@ called to determine the default escaping applied to the template. If the service defined in ``autoescape_service`` is invocable (i.e. it defines the `__invoke() PHP magic method`_) you can omit this option. -.. versionadded:: 6.4 - - The feature to use invocable services to omit this option was introduced in - Symfony 6.4. - base_template_class ~~~~~~~~~~~~~~~~~~~ @@ -155,10 +150,6 @@ file_name_pattern **type**: ``string`` or ``array`` of ``string`` **default**: ``[]`` -.. versionadded:: 6.1 - - The ``file_name_pattern`` option was introduced in Symfony 6.1. - Some applications store their front-end assets in the same directory as Twig templates. The ``lint:twig`` command filters those files to only lint the ones that match the ``*.twig`` filename pattern. @@ -289,10 +280,6 @@ html_to_text_converter **type**: ``string`` **default**: ```` -.. versionadded:: 6.2 - - The ``html_to_text_converter`` option was introduced in Symfony 6.2. - The service implementing :class:`Symfony\\Component\\Mime\\HtmlToTextConverter\\HtmlToTextConverterInterface` that will be used to automatically create the text part of an email from its diff --git a/reference/constraints/Cascade.rst b/reference/constraints/Cascade.rst index bd6050add0b..3c99f423b0f 100644 --- a/reference/constraints/Cascade.rst +++ b/reference/constraints/Cascade.rst @@ -95,8 +95,4 @@ The ``groups`` option is not available for this constraint. This option can be used to exclude one or more properties from the cascade validation. -.. versionadded:: 6.3 - - The ``exclude`` option was introduced in Symfony 6.3. - .. include:: /reference/constraints/_payload-option.rst.inc diff --git a/reference/constraints/Choice.rst b/reference/constraints/Choice.rst index 8e3b11a01ce..cd30e888245 100644 --- a/reference/constraints/Choice.rst +++ b/reference/constraints/Choice.rst @@ -315,10 +315,6 @@ When this option is ``false``, the constraint checks that the given value is not one of the values defined in the ``choices`` option. In practice, it makes the ``Choice`` constraint behave like a ``NotChoice`` constraint. -.. versionadded:: 6.2 - - The ``match`` option was introduced in Symfony 6.2. - ``message`` ~~~~~~~~~~~ diff --git a/reference/constraints/Email.rst b/reference/constraints/Email.rst index 3f4207471c1..516d6d07dca 100644 --- a/reference/constraints/Email.rst +++ b/reference/constraints/Email.rst @@ -116,10 +116,6 @@ This option defines the pattern used to validate the email address. Valid values `egulias/email-validator`_ library (which is already installed when using :doc:`Symfony Mailer `; otherwise, you must install it separately). -.. versionadded:: 6.2 - - The ``html5-allow-no-tld`` mode was introduced in 6.2. - .. tip:: The possible values of this option are also defined as PHP constants of diff --git a/reference/constraints/Expression.rst b/reference/constraints/Expression.rst index 1f3b4dcdb7c..bf015d17573 100644 --- a/reference/constraints/Expression.rst +++ b/reference/constraints/Expression.rst @@ -127,10 +127,6 @@ about the :doc:`expression language syntax evaluate('fruit?.color', ['fruit' => '...']) $expressionLanguage->evaluate('fruit?.getStock()', ['fruit' => '...']) -.. versionadded:: 6.1 - - The null safe operator was introduced in Symfony 6.1. - .. _component-expression-functions: Working with Functions @@ -176,10 +167,6 @@ This function will return the case of an enumeration:: This will print out ``true``. -.. versionadded:: 6.3 - - The ``enum()`` function was introduced in Symfony 6.3. - .. tip:: To read how to register your own functions to use in an expression, see @@ -255,11 +242,6 @@ Comparison Operators * ``starts with`` * ``ends with`` -.. versionadded:: 6.1 - - The ``contains``, ``starts with`` and ``ends with`` operators were introduced - in Symfony 6.1. - .. tip:: To test if a string does *not* match a regex, use the logical ``not`` diff --git a/reference/formats/yaml.rst b/reference/formats/yaml.rst index 3130dd1d87b..64adac599fb 100644 --- a/reference/formats/yaml.rst +++ b/reference/formats/yaml.rst @@ -346,10 +346,6 @@ official YAML specification but are useful in Symfony applications: # ... or you can also use "->value" to directly use the value of a BackedEnum case operator_type: !php/enum App\Operator\Enum\Type::Or->value -.. versionadded:: 6.2 - - The ``!php/enum`` tag was introduced in Symfony 6.2. - Unsupported YAML Features ~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/reference/forms/types/collection.rst b/reference/forms/types/collection.rst index c18c558dbdc..d21802bbb91 100644 --- a/reference/forms/types/collection.rst +++ b/reference/forms/types/collection.rst @@ -200,10 +200,6 @@ prototype_options **type**: ``array`` **default**: ``[]`` -.. versionadded:: 6.1 - - The ``prototype_options`` option was introduced in Symfony 6.1. - This is the array that's passed to the form type specified in the `entry_type`_ option when creating its prototype. It allows to have different options depending on whether you are adding a new entry or editing an existing entry:: diff --git a/reference/forms/types/enum.rst b/reference/forms/types/enum.rst index 12fdc125177..eb22715407f 100644 --- a/reference/forms/types/enum.rst +++ b/reference/forms/types/enum.rst @@ -80,10 +80,6 @@ implement ``TranslatableInterface`` to translate or display custom labels:: } } -.. versionadded:: 6.4 - - Support for ``TranslatableInterface`` was introduced in Symfony 6.4. - Field Options ------------- diff --git a/reference/forms/types/number.rst b/reference/forms/types/number.rst index 04a3676f7d4..77e685486a8 100644 --- a/reference/forms/types/number.rst +++ b/reference/forms/types/number.rst @@ -60,10 +60,6 @@ include an `inputmode HTML attribute`_ which depends on the value of this option If the ``scale`` value is ``0``, ``inputmode`` will be ``numeric``; if ``scale`` is set to any value greater than ``0``, ``inputmode`` will be ``decimal``. -.. versionadded:: 6.1 - - The automatic addition of the ``inputmode`` attribute was introduced in Symfony 6.1. - Overridden Options ------------------ diff --git a/reference/forms/types/options/choice_label.rst.inc b/reference/forms/types/options/choice_label.rst.inc index 0071498916f..3d83e44da52 100644 --- a/reference/forms/types/options/choice_label.rst.inc +++ b/reference/forms/types/options/choice_label.rst.inc @@ -29,12 +29,6 @@ more control:: }, ]); -.. versionadded:: 6.2 - - Starting from Symfony 6.2, you can use any object that implements - :class:`Symfony\\Contracts\\Translation\\TranslatableInterface` as the value - of the choice label. - This method is called for *each* choice, passing you the ``$choice`` and ``$key`` from the choices array (additional ``$value`` is related to `choice_value`_). This will give you: diff --git a/reference/forms/types/options/duplicate_preferred_choices.rst.inc b/reference/forms/types/options/duplicate_preferred_choices.rst.inc index 72e85067bd3..7569d54a21b 100644 --- a/reference/forms/types/options/duplicate_preferred_choices.rst.inc +++ b/reference/forms/types/options/duplicate_preferred_choices.rst.inc @@ -20,7 +20,3 @@ option to ``false``, to only display preferred choices at the top of the list:: 'preferred_choices' => ['muppets', 'arr'], 'duplicate_preferred_choices' => false, ]); - -.. versionadded:: 6.4 - - The ``duplicate_preferred_choices`` option was introduced in Symfony 6.4. diff --git a/reference/forms/types/options/help.rst.inc b/reference/forms/types/options/help.rst.inc index 8c9bb5ce917..7d8fcdbec6b 100644 --- a/reference/forms/types/options/help.rst.inc +++ b/reference/forms/types/options/help.rst.inc @@ -19,8 +19,3 @@ rendered below the field:: 'help' => new TranslatableMessage('order.status', ['%order_id%' => $order->getId()], 'store'), ]) ; - -.. versionadded:: 6.2 - - The support for ``TranslatableInterface`` objects as help contents was - introduced in Symfony 6.2. diff --git a/reference/forms/types/options/placeholder_attr.rst.inc b/reference/forms/types/options/placeholder_attr.rst.inc index 49b656cc6df..e537aae8922 100644 --- a/reference/forms/types/options/placeholder_attr.rst.inc +++ b/reference/forms/types/options/placeholder_attr.rst.inc @@ -15,7 +15,3 @@ Use this to add additional HTML attributes to the placeholder choice:: ['title' => 'Choose an option'], ], ]); - -.. versionadded:: 6.3 - - The ``placeholder_attr`` option was introduced in Symfony 6.3. diff --git a/reference/forms/types/options/sanitize_html.rst.inc b/reference/forms/types/options/sanitize_html.rst.inc index d5525674815..1f906fd1354 100644 --- a/reference/forms/types/options/sanitize_html.rst.inc +++ b/reference/forms/types/options/sanitize_html.rst.inc @@ -3,10 +3,6 @@ sanitize_html **type**: ``boolean`` **default**: ``false`` -.. versionadded:: 6.1 - - The ``sanitize_html`` option was introduced in Symfony 6.1. - When ``true``, the text input will be sanitized using the :doc:`Symfony HTML Sanitizer component ` after the form is submitted. This protects the form input against XSS, clickjacking and CSS diff --git a/reference/forms/types/options/sanitizer.rst.inc b/reference/forms/types/options/sanitizer.rst.inc index 66a76d591e7..39217653b3c 100644 --- a/reference/forms/types/options/sanitizer.rst.inc +++ b/reference/forms/types/options/sanitizer.rst.inc @@ -3,9 +3,5 @@ sanitizer **type**: ``string`` **default**: ``"default"`` -.. versionadded:: 6.1 - - The ``sanitizer`` option was introduced in Symfony 6.1. - When `sanitize_html`_ is enabled, you can specify the name of a :ref:`custom sanitizer ` using this option. diff --git a/reference/forms/types/password.rst b/reference/forms/types/password.rst index d9b0f4cf066..d244a784755 100644 --- a/reference/forms/types/password.rst +++ b/reference/forms/types/password.rst @@ -37,10 +37,6 @@ entered into the box, set this to false and submit the form. **type**: ``string`` **default**: ``null`` -.. versionadded:: 6.2 - - The ``hash_property_path`` option was introduced in Symfony 6.2. - If set, the password will be hashed using the :doc:`PasswordHasher component ` and stored in the property defined by the given :doc:`PropertyAccess expression `. diff --git a/reference/twig_reference.rst b/reference/twig_reference.rst index 47b06ec2ea4..ef806adbc59 100644 --- a/reference/twig_reference.rst +++ b/reference/twig_reference.rst @@ -300,10 +300,6 @@ Generates a URL that you can visit to :doc:`impersonate a user `, identified by the ``identifier`` argument. -.. versionadded:: 6.4 - - The ``impersonation_path()`` function was introduced in Symfony 6.4. - impersonation_url ~~~~~~~~~~~~~~~~~ @@ -317,10 +313,6 @@ impersonation_url It's similar to the `impersonation_path`_ function, but it generates absolute URLs instead of relative URLs. -.. versionadded:: 6.4 - - The ``impersonation_url()`` function was introduced in Symfony 6.4. - impersonation_exit_path ~~~~~~~~~~~~~~~~~~~~~~~ @@ -442,10 +434,6 @@ Translates the text into the current language. More information in sanitize_html ~~~~~~~~~~~~~ -.. versionadded:: 6.1 - - The ``sanitize_html()`` filter was introduced in Symfony 6.1. - .. code-block:: twig {{ body|sanitize_html(sanitizer = "default") }} diff --git a/routing.rst b/routing.rst index fb5931cc517..8a75eb195cb 100644 --- a/routing.rst +++ b/routing.rst @@ -48,10 +48,6 @@ classes declared in the ``App\Controller`` namespace and stored in the act as a controller too, which is especially useful for small applications that use Symfony as a microframework. -.. versionadded:: 6.2 - - The feature to import routes from a PSR-4 namespace root was introduced in Symfony 6.2. - Suppose you want to define a route for the ``/blog`` URL in your application. To do so, create a :doc:`controller class ` like the following: @@ -374,10 +370,6 @@ can use any of these variables created by Symfony: An array of matched :ref:`route parameters ` for the current route. -.. versionadded:: 6.1 - - The ``params`` variable was introduced in Symfony 6.1. - You can also use these functions: ``env(string $name)`` @@ -408,11 +400,6 @@ You can also use these functions: // Or without alias: #[Route(condition: "service('App\\\Service\\\RouteChecker').check(request)")] -.. versionadded:: 6.1 - - The ``service(string $alias)`` function and ``#[AsRoutingConditionService]`` - attribute were introduced in Symfony 6.1. - Behind the scenes, expressions are compiled down to raw PHP. Because of this, using the ``condition`` key causes no extra overhead beyond the time it takes for the underlying PHP to execute. @@ -467,10 +454,6 @@ route details: Use the ``--show-aliases`` option to show all available aliases for a given route. -.. versionadded:: 6.4 - - The ``--show-aliases`` option was introduced in Symfony 6.4. - The other command is called ``router:match`` and it shows which route will match the given URL. It's useful to find out why some URL is not executing the controller action that you expect: @@ -664,10 +647,6 @@ URL Route Parameters contains a collection of commonly used regular-expression constants such as digits, dates and UUIDs which can be used as route parameter requirements. - .. versionadded:: 6.1 - - The ``Requirement`` enum was introduced in Symfony 6.1. - .. tip:: Route requirements (and route paths too) can include @@ -956,12 +935,6 @@ A common routing need is to convert the value stored in some parameter (e.g. an integer acting as the user ID) into another value (e.g. the object that represents the user). This feature is called a "param converter". -.. versionadded:: 6.2 - - Starting from Symfony 6.2, route param conversion is a built-in feature. - In previous Symfony versions you had to install the package - ``sensio/framework-extra-bundle`` before using this feature. - Now, keep the previous route configuration, but change the arguments of the controller action. Instead of ``string $slug``, add ``BlogPost $post``:: @@ -998,10 +971,6 @@ database queries used to fetch the object from the route parameter. Backed Enum Parameters ~~~~~~~~~~~~~~~~~~~~~~ -.. versionadded:: 6.3 - - The support of ``\BackedEnum`` as route parameters was introduced Symfony 6.3. - You can use PHP `backed enumerations`_ as route parameters because Symfony will convert them automatically to their scalar values. @@ -1622,13 +1591,6 @@ the current route and its attributes: {% set route_name = app.current_route %} {% set route_parameters = app.current_route_parameters %} -.. versionadded:: 6.2 - - The ``app.current_route`` and ``app.current_route_parameters`` variables - were introduced in Symfony 6.2. - Before you had to access ``_route`` and ``_route_params`` request - attributes using ``app.request.attributes.get()``. - Special Routes -------------- diff --git a/routing/custom_route_loader.rst b/routing/custom_route_loader.rst index d02e6b31519..0cea7d6b9fd 100644 --- a/routing/custom_route_loader.rst +++ b/routing/custom_route_loader.rst @@ -108,15 +108,6 @@ Symfony provides several route loaders for the most common needs: $routes->import('@AcmeOtherBundle/Resources/config/routing/', 'directory'); }; -.. versionadded:: 6.1 - - The ``attribute`` value of the second argument of ``import()`` was introduced - in Symfony 6.1. - -.. versionadded:: 6.2 - - The feature to import routes from a PSR-4 namespace root was introduced in Symfony 6.2. - .. note:: When importing resources, the key (e.g. ``app_file``) is the name of the collection. diff --git a/security.rst b/security.rst index 7285a6b77b4..9e40924cae3 100644 --- a/security.rst +++ b/security.rst @@ -468,12 +468,6 @@ You can also manually hash a password by running: Read more about all available hashers and password migration in :doc:`security/passwords`. -.. versionadded:: 6.2 - - In applications using Symfony 6.2 and PHP 8.2 or newer, the - `SensitiveParameter PHP attribute`_ is applied to all plain passwords and - sensitive tokens so they don't appear in stack traces. - .. _firewalls-authentication: .. _a-authentication-firewalls: @@ -612,10 +606,6 @@ don't accidentally block Symfony's dev tools - which live under URLs like This feature is not supported by the XML configuration format. - .. versionadded:: 6.4 - - The feature to use an array of regex was introduced in Symfony 6.4. - All *real* URLs are handled by the ``main`` firewall (no ``pattern`` key means it matches *all* URLs). A firewall can have many modes of authentication, in other words, it enables many ways to ask the question "Who are you?". @@ -680,10 +670,6 @@ use the :class:`Symfony\\Bundle\\SecurityBundle\\Security` service:: } } -.. versionadded:: 6.2 - - The ``getFirewallConfig()`` method was introduced in Symfony 6.2. - .. _security-authenticators: Authenticating Users @@ -1717,17 +1703,6 @@ for more information about this. Login Programmatically ---------------------- -.. versionadded:: 6.2 - - The :class:`Symfony\Bundle\SecurityBundle\Security ` - class was introduced in Symfony 6.2. Prior to 6.2, it was called - ``Symfony\Component\Security\Core\Security``. - -.. versionadded:: 6.2 - - The :method:`Symfony\\Bundle\\SecurityBundle\\Security::login` - method was introduced in Symfony 6.2. - You can log in a user programmatically using the ``login()`` method of the :class:`Symfony\\Bundle\\SecurityBundle\\Security` helper:: @@ -1769,14 +1744,6 @@ You can log in a user programmatically using the ``login()`` method of the } } -.. versionadded:: 6.3 - - The feature to use a custom redirection logic was introduced in Symfony 6.3. - -.. versionadded:: 6.4 - - The feature to add badges was introduced in Symfony 6.4. - .. _security-logging-out: Logging Out @@ -1904,17 +1871,6 @@ Symfony will un-authenticate the current user and redirect them. Logout programmatically ~~~~~~~~~~~~~~~~~~~~~~~ -.. versionadded:: 6.2 - - The :class:`Symfony\Bundle\SecurityBundle\Security ` - class was introduced in Symfony 6.2. Prior to 6.2, it was called - ``Symfony\Component\Security\Core\Security``. - -.. versionadded:: 6.2 - - The :method:`Symfony\\Bundle\\SecurityBundle\\Security::logout` - method was introduced in Symfony 6.2. - You can logout user programmatically using the ``logout()`` method of the :class:`Symfony\\Bundle\\SecurityBundle\\Security` helper:: @@ -2049,12 +2005,6 @@ If you need to get the logged in user from a service, use the } } -.. versionadded:: 6.2 - - The :class:`Symfony\\Bundle\\SecurityBundle\\Security` class - was introduced in Symfony 6.2. In previous Symfony versions this class was - defined in ``Symfony\Component\Security\Core\Security``. - Fetch the User in a Template ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -2454,15 +2404,6 @@ that is thrown with the ``exceptionCode`` argument:: // ... } -.. versionadded:: 6.2 - - The ``#[IsGranted()]`` attribute was introduced in Symfony 6.2. - -.. versionadded:: 6.3 - - The ``exceptionCode`` argument of the ``#[IsGranted()]`` attribute was - introduced in Symfony 6.3. - .. _security-template: Access Control in Templates @@ -2896,4 +2837,3 @@ Authorization (Denying Access) .. _`HTTP Basic authentication`: https://en.wikipedia.org/wiki/Basic_access_authentication .. _`Login CSRF attacks`: https://en.wikipedia.org/wiki/Cross-site_request_forgery#Forging_login_requests .. _`PHP date relative formats`: https://www.php.net/manual/en/datetime.formats.php#datetime.formats.relative -.. _`SensitiveParameter PHP attribute`: https://www.php.net/manual/en/class.sensitiveparameter.php diff --git a/security/access_control.rst b/security/access_control.rst index abba217702f..4fd19925e85 100644 --- a/security/access_control.rst +++ b/security/access_control.rst @@ -33,14 +33,6 @@ options are used for matching: * ``attributes``: an array, which can be used to specify one or more :ref:`request attributes ` that must match exactly * ``route``: a route name -.. versionadded:: 6.1 - - The ``request_matcher`` option was introduced in Symfony 6.1. - -.. versionadded:: 6.2 - - The ``route`` and ``attributes`` options were introduced in Symfony 6.2. - Take the following ``access_control`` entries as an example: .. configuration-block:: diff --git a/security/access_token.rst b/security/access_token.rst index b689949c71a..48ff8629fa1 100644 --- a/security/access_token.rst +++ b/security/access_token.rst @@ -352,10 +352,6 @@ an authorization server. 1) Configure the OidcUserInfoTokenHandler ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. versionadded:: 6.3 - - The ``OidcUserInfoTokenHandler`` class was introduced in Symfony 6.3. - The ``OidcUserInfoTokenHandler`` requires the ``symfony/http-client`` package to make the needed HTTP requests. If you haven't installed it yet, run this command: @@ -539,10 +535,6 @@ claims. To create your own user object from the claims, you must 2) Configure the OidcTokenHandler ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. versionadded:: 6.3 - - The ``OidcTokenHandler`` class was introduced in Symfony 6.3. - The ``OidcTokenHandler`` requires ``web-token/jwt-signature``, ``web-token/jwt-checker`` and ``web-token/jwt-signature-algorithm-ecdsa`` packages. If you haven't installed them yet, run these commands: diff --git a/security/expressions.rst b/security/expressions.rst index e3e6425f6d5..cf7071e79a9 100644 --- a/security/expressions.rst +++ b/security/expressions.rst @@ -69,10 +69,6 @@ and ``#[IsGranted()]`` attribute also accept an } } -.. versionadded:: 6.2 - - The ``#[IsGranted()]`` attribute was introduced in Symfony 6.2. - In this example, if the current user has ``ROLE_ADMIN`` or if the current user object's ``isSuperAdmin()`` method returns ``true``, then access will be granted (note: your User object may not have an ``isSuperAdmin()`` method, diff --git a/security/impersonating_user.rst b/security/impersonating_user.rst index b801b5570c1..8bc36c98c76 100644 --- a/security/impersonating_user.rst +++ b/security/impersonating_user.rst @@ -242,10 +242,6 @@ also adjust the query parameter name via the ``parameter`` setting: Redirecting to a Specific Target Route -------------------------------------- -.. versionadded:: 6.2 - - The ``target_route`` configuration option was introduced in Symfony 6.2. - .. note:: It works only in a stateful firewall. diff --git a/security/login_link.rst b/security/login_link.rst index 2af87ab4ded..041d59a1e1c 100644 --- a/security/login_link.rst +++ b/security/login_link.rst @@ -808,7 +808,3 @@ but you can change the lifetime per link using the third argument of the // the third optional argument is the lifetime in seconds $loginLinkDetails = $loginLinkHandler->createLoginLink($user, null, 60); $loginLink = $loginLinkDetails->getUrl(); - -.. versionadded:: 6.2 - - The argument to customize the link lifetime was introduced in Symfony 6.2. diff --git a/security/remember_me.rst b/security/remember_me.rst index e2b087fa249..6d1e82e8c69 100644 --- a/security/remember_me.rst +++ b/security/remember_me.rst @@ -152,10 +152,6 @@ you can add a ``_remember_me`` key to the body of your POST request. Optionally, you can configure a custom name for this key using the ``name`` setting under the ``remember_me`` section of your firewall. -.. versionadded:: 6.3 - - The JSON login ``_remember_me`` option was introduced in Symfony 6.3. - Always activating Remember Me ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/security/user_checkers.rst b/security/user_checkers.rst index 99cdfe04076..d62cc0bea32 100644 --- a/security/user_checkers.rst +++ b/security/user_checkers.rst @@ -117,10 +117,6 @@ is the service id of your user checker: Using Multiple User Checkers ---------------------------- -.. versionadded:: 6.2 - - The ``ChainUserChecker`` class was added in Symfony 6.2. - It is common for applications to have multiple authentication entry points (such as traditional form based login and an API) which may have unique checker rules for each entry point as well as common rules for all entry points. To allow using multiple user diff --git a/security/voters.rst b/security/voters.rst index 7d37aea2510..0aefd3c2aa8 100644 --- a/security/voters.rst +++ b/security/voters.rst @@ -126,10 +126,6 @@ calls out to the "voter" system. Right now, no voters will vote on whether or no the user can "view" or "edit" a ``Post``. But you can create your *own* voter that decides this using whatever logic you want. -.. versionadded:: 6.2 - - The ``#[IsGranted()]`` attribute was introduced in Symfony 6.2. - Creating the custom Voter ------------------------- diff --git a/serializer.rst b/serializer.rst index daa898dbb7b..ef155a1a45d 100644 --- a/serializer.rst +++ b/serializer.rst @@ -157,10 +157,6 @@ configuration: ; }; -.. versionadded:: 6.2 - - The option to configure YAML indentation was introduced in Symfony 6.2. - You can also specify the context on a per-property basis:: .. configuration-block:: @@ -267,19 +263,11 @@ all the properties of the class:: // ... } -.. versionadded:: 6.4 - - The ``#[Context]`` attribute was introduced in Symfony 6.4. - .. _serializer-using-context-builders: Using Context Builders ---------------------- -.. versionadded:: 6.1 - - Context builders were introduced in Symfony 6.1. - To define the (de)serialization context, you can use "context builders", which are objects that help you to create that context by providing autocompletion, validation, and documentation:: @@ -369,11 +357,6 @@ In this example, the ``id`` and the ``name`` properties belong to the ``show_product`` and ``list_product`` groups. The ``description`` property only belongs to the ``show_product`` group. -.. versionadded:: 6.4 - - The support of the ``#[Groups]`` attribute on class level was - introduced in Symfony 6.4. - Now that your groups are defined, you can choose which groups to use when serializing:: @@ -444,10 +427,6 @@ their paths using a :doc:`valid PropertyAccess syntax -.. versionadded:: 6.2 - - The option to configure a ``SerializedPath`` was introduced in Symfony 6.2. - Using the configuration from above, denormalizing with a metadata-aware normalizer will write the ``birthday`` field from ``$data`` onto the ``Person`` object:: @@ -551,11 +530,6 @@ given class: | | ] | +----------+------------------------------------------------------------+ -.. versionadded:: 6.3 - - The debug:serializer`` command was introduced in Symfony 6.3. - - Going Further with the Serializer --------------------------------- diff --git a/serializer/custom_context_builders.rst b/serializer/custom_context_builders.rst index b40e432286d..a326fcfc2d6 100644 --- a/serializer/custom_context_builders.rst +++ b/serializer/custom_context_builders.rst @@ -1,10 +1,6 @@ How to Create your Custom Context Builder ========================================= -.. versionadded:: 6.1 - - Context builders were introduced in Symfony 6.1. - The :doc:`Serializer Component ` uses Normalizers and Encoders to transform any data to any data-structure (e.g. JSON). That serialization process can be configured thanks to a diff --git a/service_container.rst b/service_container.rst index c3e5c0b6860..47a60f37512 100644 --- a/service_container.rst +++ b/service_container.rst @@ -816,10 +816,6 @@ Our configuration looks like this: Closures can be injected :ref:`by using autowiring ` and its dedicated attributes. -.. versionadded:: 6.1 - - The ``closure`` argument type was introduced in Symfony 6.1. - .. _services-binding: Binding Arguments by Name or Type @@ -1168,11 +1164,6 @@ key. For example, the default Symfony configuration contains this: may use the :class:`Symfony\\Component\\DependencyInjection\\Attribute\\Exclude` attribute directly on your class to exclude it. - .. versionadded:: 6.3 - - The :class:`Symfony\\Component\\DependencyInjection\\Attribute\\Exclude` - attribute was introduced in Symfony 6.3. - This can be used to quickly make many classes available as services and apply some default configuration. The ``id`` of each service is its fully-qualified class name. You can override any service that's imported by using its id (class name) below @@ -1451,11 +1442,6 @@ Thanks to the ``#[AutowireCallable]`` attribute, you can now inject this } } -.. versionadded:: 6.3 - - The :class:`Symfony\\Component\\DependencyInjection\\Attribute\\AutowireCallable` - attribute was introduced in Symfony 6.3. - Instead of using the ``#[AutowireCallable]`` attribute, you can also generate an adapter for a functional interface through configuration: diff --git a/service_container/alias_private.rst b/service_container/alias_private.rst index 7a7eef2a458..b74acb99d8e 100644 --- a/service_container/alias_private.rst +++ b/service_container/alias_private.rst @@ -150,10 +150,6 @@ services. $services->alias('app.mailer', PhpMailer::class); }; -.. versionadded:: 6.3 - - The ``#[AsAlias]`` attribute was introduced in Symfony 6.3. - This means that when using the container directly, you can access the ``PhpMailer`` service by asking for the ``app.mailer`` service like this:: diff --git a/service_container/autowiring.rst b/service_container/autowiring.rst index daa1e96328b..898ccdd100b 100644 --- a/service_container/autowiring.rst +++ b/service_container/autowiring.rst @@ -611,10 +611,6 @@ logic about those arguments:: } } -.. versionadded:: 6.1 - - The ``#[Autowire]`` attribute was introduced in Symfony 6.1. - The ``#[Autowire]`` attribute can also be used for :ref:`parameters `, :doc:`complex expressions ` and even :ref:`environment variables `:: @@ -648,10 +644,6 @@ The ``#[Autowire]`` attribute can also be used for :ref:`parameters `). - -.. versionadded:: 6.1 - - Using expressions in ``factories`` was introduced in Symfony 6.1. diff --git a/service_container/factories.rst b/service_container/factories.rst index a917a661afa..d4357cfd58a 100644 --- a/service_container/factories.rst +++ b/service_container/factories.rst @@ -231,10 +231,6 @@ as the factory class: ->constructor('create'); }; -.. versionadded:: 6.3 - - The ``constructor`` option was introduced in Symfony 6.3. - Non-Static Factories -------------------- @@ -377,10 +373,6 @@ method name: Using Expressions in Service Factories -------------------------------------- -.. versionadded:: 6.1 - - Using expressions as factories was introduced in Symfony 6.1. - Instead of using PHP classes as a factory, you can also use :doc:`expressions `. This allows you to e.g. change the service based on a parameter: diff --git a/service_container/lazy_services.rst b/service_container/lazy_services.rst index 905c4b3a599..46e939d4fac 100644 --- a/service_container/lazy_services.rst +++ b/service_container/lazy_services.rst @@ -29,11 +29,6 @@ until you interact with the proxy in some way. In PHP versions prior to 8.0 lazy services do not support parameters with default values for built-in PHP classes (e.g. ``PDO``). -.. versionadded:: 6.2 - - Starting from Symfony 6.2, service laziness is supported out of the box - without having to install any additional package. - .. _lazy-services_configuration: Configuration @@ -129,11 +124,6 @@ laziness, and supports lazy-autowiring of intersection types:: ) { } -.. versionadded:: 6.3 - - The ``lazy`` argument of the ``#[Autowire()]`` attribute was introduced in - Symfony 6.3. - Interface Proxifying -------------------- diff --git a/service_container/service_decoration.rst b/service_container/service_decoration.rst index 0262ae03e7e..ce33207e568 100644 --- a/service_container/service_decoration.rst +++ b/service_container/service_decoration.rst @@ -123,10 +123,6 @@ but keeps a reference of the old one as ``.inner``: ->decorate(Mailer::class); }; -.. versionadded:: 6.1 - - The ``#[AsDecorator]`` attribute was introduced in Symfony 6.1. - The ``decorates`` option tells the container that the ``App\DecoratingMailer`` service replaces the ``App\Mailer`` service. If you're using the :ref:`default services.yaml configuration `, diff --git a/service_container/service_subscribers_locators.rst b/service_container/service_subscribers_locators.rst index a39ccfb4a68..a4aa426bc59 100644 --- a/service_container/service_subscribers_locators.rst +++ b/service_container/service_subscribers_locators.rst @@ -247,10 +247,6 @@ service type to a service. Add Dependency Injection Attributes ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. versionadded:: 6.2 - - The ability to add attributes was introduced in Symfony 6.2. - As an alternate to aliasing services in your configuration, you can also configure the following dependency injection attributes in the ``getSubscribedServices()`` method directly: @@ -375,12 +371,6 @@ attribute:: } } -.. versionadded:: 6.4 - - The - :class:`Symfony\\Component\\DependencyInjection\\Attribute\\AutowireLocator` - attribute was introduced in Symfony 6.4. - .. note:: To receive an iterable instead of a service locator, you can switch the @@ -389,12 +379,6 @@ attribute:: :class:`Symfony\\Component\\DependencyInjection\\Attribute\\AutowireIterator` attribute. - .. versionadded:: 6.4 - - The - :class:`Symfony\\Component\\DependencyInjection\\Attribute\\AutowireIterator` - attribute was introduced in Symfony 6.4. - .. _service-subscribers-locators_defining-service-locator: Defining a Service Locator @@ -939,10 +923,6 @@ and compose your services with them:: ``SubscribedService`` Attributes ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. versionadded:: 6.2 - - The ability to add attributes was introduced in Symfony 6.2. - You can use the ``attributes`` argument of ``SubscribedService`` to add any of the following dependency injection attributes: diff --git a/service_container/tags.rst b/service_container/tags.rst index 4955016d5a0..5021ec3d8d5 100644 --- a/service_container/tags.rst +++ b/service_container/tags.rst @@ -550,10 +550,6 @@ To answer this, change the service declaration: ; }; -.. versionadded:: 6.2 - - Support for attributes as array was introduced in Symfony 6.2. - .. tip:: The ``name`` attribute is used by default to define the name of the tag. @@ -847,15 +843,6 @@ iterator, add the ``exclude`` option: In the case the referencing service is itself tagged with the tag being used in the tagged iterator, it is automatically excluded from the injected iterable. -.. versionadded:: 6.1 - - The ``exclude`` option was introduced in Symfony 6.1. - -.. versionadded:: 6.3 - - The automatic exclusion of the referencing service in the injected iterable was - introduced in Symfony 6.3. - .. seealso:: See also :doc:`tagged locator services ` diff --git a/templates.rst b/templates.rst index a8f066e83be..53edd5b89d8 100644 --- a/templates.rst +++ b/templates.rst @@ -385,19 +385,6 @@ gives you access to these variables: ``app.enabled_locales`` The locales enabled in the application. -.. versionadded:: 6.2 - - The ``app.current_route`` and ``app.current_route_parameters`` variables - were introduced in Symfony 6.2. - -.. versionadded:: 6.3 - - The ``app.locale`` variable was introduced in Symfony 6.3. - -.. versionadded:: 6.4 - - The ``app.enabled_locales`` variable was introduced in Symfony 6.4. - In addition to the global ``app`` variable injected by Symfony, you can also inject variables automatically to all Twig templates as explained in the next section. @@ -606,10 +593,6 @@ to define the template to render:: } } -.. versionadded:: 6.2 - - The ``#[Template()]`` attribute was introduced in Symfony 6.2. - The :ref:`base AbstractController ` also provides the :method:`Symfony\\Bundle\\FrameworkBundle\\Controller\\AbstractController::renderBlock` and :method:`Symfony\\Bundle\\FrameworkBundle\\Controller\\AbstractController::renderBlockView` @@ -649,13 +632,6 @@ This might come handy when dealing with blocks in :ref:`templates inheritance ` or when using `Turbo Streams`_. -.. versionadded:: 6.4 - - The - :method:`Symfony\\Bundle\\FrameworkBundle\\Controller\\AbstractController::renderBlock` and - :method:`Symfony\\Bundle\\FrameworkBundle\\Controller\\AbstractController::renderBlockView` - methods were introduced in Symfony 6.4. - Rendering a Template in Services ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -907,10 +883,6 @@ depending on your needs: {% endfor %} -.. versionadded:: 6.3 - - The option to use named arguments in ``dump()`` was introduced in Symfony 6.3. - To avoid leaking sensitive information, the ``dump()`` function/tag is only available in the ``dev`` and ``test`` :ref:`configuration environments `. If you try to use it in the ``prod`` environment, you will see a PHP error. diff --git a/testing.rst b/testing.rst index 6c61531e4ed..e5347efa841 100644 --- a/testing.rst +++ b/testing.rst @@ -320,11 +320,6 @@ concrete one:: No further configuration in required, as the test service container is a special one that allows you to interact with private services and aliases. -.. versionadded:: 6.3 - - The possibility to set a private service with the test service container - without declaring a public alias for it was introduced in Symfony 6.3. - .. _testing-databases: Configuring a Database for Tests @@ -726,12 +721,6 @@ attributes in this token, you can use the ``tokenAttributes`` argument of the By design, the ``loginUser()`` method doesn't work when using stateless firewalls. Instead, add the appropriate token/header in each ``request()`` call. -.. versionadded:: 6.4 - - The ``tokenAttributes`` argument of the - :method:`Symfony\\Bundle\\FrameworkBundle\\KernelBrowser::loginUser` method - was introduced in Symfony 6.4. - Making AJAX Requests .................... @@ -997,11 +986,6 @@ Response Assertions ``assertResponseIsUnprocessable(string $message = '')`` Asserts the response is unprocessable (HTTP status is 422) -.. versionadded:: 6.4 - - The support for relative path in ``assertResponseRedirects()`` was introduced - in Symfony 6.4. - Request Assertions .................. @@ -1063,15 +1047,6 @@ Crawler Assertions Asserts that value of the field of the first form matching the given selector does (not) equal the expected value. -.. versionadded:: 6.3 - - The ``assertSelectorCount()`` method was introduced in Symfony 6.3. - -.. versionadded:: 6.4 - - The ``assertAnySelectorTextContains()``, ``assertAnySelectorTextNotContains()`` - and ``assertAnySelectorTextSame()`` were introduced in Symfony 6.4. - .. _mailer-assertions: Mailer Assertions @@ -1109,11 +1084,6 @@ Mailer Assertions Asserts that the subject of the given email does (not) contain the expected subject. -.. versionadded:: 6.4 - - The ``assertEmailSubjectContains()`` and ``assertEmailSubjectNotContains()`` - assertions were introduced in Symfony 6.4. - Notifier Assertions ................... @@ -1140,10 +1110,6 @@ Notifier Assertions Asserts that the name of the transport for the given notification is not the same as the given text. -.. versionadded:: 6.2 - - The Notifier assertions were introduced in Symfony 6.2. - HttpClient Assertions ..................... @@ -1167,10 +1133,6 @@ HttpClient Assertions By default it will check on the HttpClient, but you can also pass a specific HttpClient ID. -.. versionadded:: 6.4 - - The HttpClient assertions were introduced in Symfony 6.4. - .. TODO .. End to End Tests (E2E) .. ---------------------- diff --git a/translation.rst b/translation.rst index 07f7cbde570..306b3186ad0 100644 --- a/translation.rst +++ b/translation.rst @@ -451,11 +451,6 @@ The ``translation:extract`` command looks for missing translations in: * Any PHP file/class stored in the ``src/`` directory that uses :ref:`Constraints Attributes ` with ``*message`` named argument(s). -.. versionadded:: 6.2 - - The support of PHP files/classes that use constraint attributes was - introduced in Symfony 6.2. - .. _translation-resource-locations: Translation Resource/File Names and Locations @@ -499,10 +494,6 @@ provides many loaders which are selected based on the following file extensions: * ``.po``: `Portable object format`_; * ``.qt``: `QT Translations TS XML`_ file; -.. versionadded:: 6.1 - - The ``.xliff`` file extension support was introduced in Symfony 6.1. - The choice of which loader to use is entirely up to you and is a matter of taste. The recommended option is to use YAML for simple projects and use XLIFF if you're generating translations with specialized programs or teams. @@ -607,10 +598,6 @@ Lokalise ``composer require symfony/lokalise-translation-provider`` Phrase ``composer require symfony/phrase-translation-provider`` ==================== =========================================================== -.. versionadded:: 6.4 - - The ``Phrase`` translation provider was introduced in Symfony 6.4. - Each library includes a :ref:`Symfony Flex recipe ` that will add a configuration example to your ``.env`` file. For example, suppose you want to use Loco. First, install it: @@ -766,11 +753,6 @@ now use the following commands to push (upload) and pull (download) translations # of flat keys $ php bin/console translation:pull loco --force --as-tree -.. versionadded:: 6.4 - - The ``--as-tree`` option of the ``translation:pull`` command was introduced - in Symfony 6.4. - Creating Custom Providers ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -1043,10 +1025,6 @@ checks translation resources for several locales: Switch Locale Programmatically ------------------------------ -.. versionadded:: 6.1 - - The ``LocaleSwitcher`` was introduced in Symfony 6.1. - Sometimes you need to change the locale of the application dynamically just to run some code. Imagine a console command that renders Twig templates of emails in different languages. You need to change the locale only to @@ -1103,13 +1081,6 @@ of: } } -.. versionadded:: 6.4 - - The support of declaring an argument in the callback to inject the locale - being used in the - :method:`Symfony\\Component\\Translation\\LocaleSwitcher::runWithLocale` - method was introduced in Symfony 6.4. - When using :ref:`autowiring `, type-hint any controller or service argument with the :class:`Symfony\\Component\\Translation\\LocaleSwitcher` class to inject the locale switcher service. Otherwise, configure your services diff --git a/validation.rst b/validation.rst index af98a7ff852..39922038c9b 100644 --- a/validation.rst +++ b/validation.rst @@ -203,10 +203,6 @@ Inside the template, you can output the list of errors exactly as needed: object allows you, among other things, to get the constraint that caused this violation thanks to the ``ConstraintViolation::getConstraint()`` method. -.. versionadded:: 6.3 - - The ``ConstraintViolation::getConstraint()`` method was introduced in Symfony 6.3. - Validation Callables ~~~~~~~~~~~~~~~~~~~~ diff --git a/validation/custom_constraint.rst b/validation/custom_constraint.rst index 7506cd84f2c..7ea504f0842 100644 --- a/validation/custom_constraint.rst +++ b/validation/custom_constraint.rst @@ -39,10 +39,6 @@ First you need to create a Constraint class and extend :class:`Symfony\\Componen Add ``#[\Attribute]`` to the constraint class if you want to use it as an attribute in other classes. -.. versionadded:: 6.1 - - The ``#[HasNamedArguments]`` attribute was introduced in Symfony 6.1. - You can use ``#[HasNamedArguments]`` to make some constraint options required:: // src/Validator/ContainsAlphanumeric.php diff --git a/workflow.rst b/workflow.rst index 2e17b40794c..b1ec43c8199 100644 --- a/workflow.rst +++ b/workflow.rst @@ -168,11 +168,6 @@ follows: ``'draft'`` or ``!php/const App\Entity\BlogPost::TRANSITION_TO_REVIEW`` instead of ``'to_review'``. -.. versionadded:: 6.4 - - Since Symfony 6.4, the ``type`` option under ``marking_store`` can be - omitted when the ``property`` option is explicitly set. - The configured property will be used via its implemented getter/setter methods by the marking store:: // src/Entity/BlogPost.php @@ -231,11 +226,6 @@ you must declare a setter to write your property:: } } -.. versionadded:: 6.4 - - The feature to use public properties instead of getter/setter methods - and private properties was introduced in Symfony 6.4. - .. note:: The marking store type could be "multiple_state" or "single_state". A single @@ -342,16 +332,6 @@ attribute:: This allows you to decorrelate the argument name of any implementation name. -.. versionadded:: 6.2 - - All workflows and state machines services are tagged since in Symfony 6.2. - -.. versionadded:: 6.3 - - Injecting a workflow with only its name and - :class:`Symfony\\Component\\DependencyInjection\\Attribute\\Target` was - introduced in Symfony 6.3. - .. tip:: If you want to retrieve all workflows, for documentation purposes for example, @@ -548,10 +528,6 @@ You may refer to the documentation about :ref:`defining event listeners with PHP attributes ` for further use. -.. versionadded:: 6.4 - - The workflow event attributes were introduced in Symfony 6.4. - .. _workflow-usage-guard-events: Guard Events diff --git a/workflow/workflow-and-state-machine.rst b/workflow/workflow-and-state-machine.rst index f6b93fa693c..eabb8d2a28e 100644 --- a/workflow/workflow-and-state-machine.rst +++ b/workflow/workflow-and-state-machine.rst @@ -283,10 +283,6 @@ machine type, use ``camelCased workflow name + StateMachine``:: } -.. versionadded:: 6.2 - - All workflows and state machines services are tagged since in Symfony 6.2. - Automatic and Manual Validation ------------------------------- From 93a0effe629e49efce25f98f917d4119269b211f Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Sun, 22 Oct 2023 11:49:53 +0200 Subject: [PATCH 038/477] remove Symfony 6 versionadded directives --- components/finder.rst | 4 ---- components/http_foundation.rst | 6 ------ html_sanitizer.rst | 5 ----- messenger.rst | 8 -------- reference/dic_tags.rst | 6 ------ 5 files changed, 29 deletions(-) diff --git a/components/finder.rst b/components/finder.rst index 6a76c73ac08..516db7cde4e 100644 --- a/components/finder.rst +++ b/components/finder.rst @@ -337,10 +337,6 @@ using a closure, return ``false`` for the directories which you want to prune. Pruning directories early can improve performance significantly depending on the file/directory hierarchy complexity and the number of excluded directories. -.. versionadded:: 6.4 - - The feature to prune directories was introduced in Symfony 6.4. - Sorting Results --------------- diff --git a/components/http_foundation.rst b/components/http_foundation.rst index 70060b93127..475d222dab5 100644 --- a/components/http_foundation.rst +++ b/components/http_foundation.rst @@ -478,12 +478,6 @@ your application to see which exceptions are thrown in listeners of the more about it in :ref:`the dedicated section about Kernel events `. -.. versionadded:: 6.4 - - The ``$flush`` parameter of the - :method:`Symfony\\Component\\HttpFoundation\\Response::send` method - was introduced in Symfony 6.4. - Setting Cookies ~~~~~~~~~~~~~~~ diff --git a/html_sanitizer.rst b/html_sanitizer.rst index 6dd9b7771cf..6a5195880c2 100644 --- a/html_sanitizer.rst +++ b/html_sanitizer.rst @@ -1008,11 +1008,6 @@ increase or decrease this limit: It is possible to disable this length limit by setting the max input length to ``-1``. Beware that it may expose your application to `DoS attacks`_. -.. versionadded:: 6.4 - - The support for disabling the length limit of the HTML sanitizer was - introduced in Symfony 6.4. - Custom Attribute Sanitizers ~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/messenger.rst b/messenger.rst index 3ee8b0dc6eb..9c8e8202afa 100644 --- a/messenger.rst +++ b/messenger.rst @@ -1768,14 +1768,6 @@ The transport has a number of options: You can learn more about middlewares in :ref:`the dedicated section `. - .. versionadded:: 6.4 - - The - :class:`Symfony\\Component\\Messenger\\Bridge\\AmazonSqs\\Middleware\\AddFifoStampMiddleware`, - :class:`Symfony\\Component\\Messenger\\Bridge\\AmazonSqs\\MessageDeduplicationAwareInterface` - and :class:`Symfony\\Component\\Messenger\\Bridge\\AmazonSqs\\MessageGroupAwareInterface` - were introduced in Symfony 6.4. - FIFO queues don't support setting a delay per message, a value of ``delay: 0`` is required in the retry strategy settings. diff --git a/reference/dic_tags.rst b/reference/dic_tags.rst index 8ffc5eb1b18..94f18efc990 100644 --- a/reference/dic_tags.rst +++ b/reference/dic_tags.rst @@ -512,12 +512,6 @@ If you don't need to preload anything, return an empty array. If read-only artefacts need to be created, you can store them in a different directory with the ``$buildDir`` parameter of the ``warmUp()`` method. -.. versionadded:: 6.4 - - The ``$buildDir`` parameter of the - :method:`Symfony\\Component\\HttpKernel\\CacheWarmer\\WarmableInterface::warmUp` - method was introduced in Symfony 6.4. - The ``isOptional()`` method should return true if it's possible to use the application without calling this cache warmer. In Symfony, optional warmers are always executed by default (you can change this by using the From bba62162998fb7ef03a37e22b47f2f229fe880ff Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Tue, 24 Oct 2023 10:31:55 +0200 Subject: [PATCH 039/477] Remove obsolete versionadded directives --- frontend/asset_mapper.rst | 6 ------ reference/configuration/kernel.rst | 16 ---------------- 2 files changed, 22 deletions(-) diff --git a/frontend/asset_mapper.rst b/frontend/asset_mapper.rst index 140c4d22c88..150c57ff05f 100644 --- a/frontend/asset_mapper.rst +++ b/frontend/asset_mapper.rst @@ -961,12 +961,6 @@ the polyfill loading. $ php bin/console importmap:require es-module-shims -.. versionadded:: 6.4 - - Passing an importmap name in ``importmap_polyfill`` was - introduced in Symfony 6.4. Prior to this, you could pass ``false`` - or a custom URL to load the polyfill. - ``framework.asset_mapper.importmap_script_attributes`` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/reference/configuration/kernel.rst b/reference/configuration/kernel.rst index cbfb48f1316..813cd41223c 100644 --- a/reference/configuration/kernel.rst +++ b/reference/configuration/kernel.rst @@ -314,10 +314,6 @@ the application is running in web mode and ``web=1&worker=1`` when running in a long-running web server. This parameter can be set by using the ``APP_RUNTIME_MODE`` env var. -.. versionadded:: 6.4 - - The ``kernel.runtime_mode`` parameter was introduced in Symfony 6.4. - ``kernel.runtime_mode.web`` --------------------------- @@ -325,10 +321,6 @@ a long-running web server. This parameter can be set by using the Whether the application is running in a web environment. -.. versionadded:: 6.4 - - The ``kernel.runtime_mode.web`` parameter was introduced in Symfony 6.4. - ``kernel.runtime_mode.cli`` --------------------------- @@ -337,10 +329,6 @@ Whether the application is running in a web environment. Whether the application is running in a CLI environment. By default, this value is the opposite of the ``kernel.runtime_mode.web`` parameter. -.. versionadded:: 6.4 - - The ``kernel.runtime_mode.cli`` parameter was introduced in Symfony 6.4. - ``kernel.runtime_mode.worker`` ------------------------------ @@ -349,10 +337,6 @@ this value is the opposite of the ``kernel.runtime_mode.web`` parameter. Whether the application is running in a worker/long-running environment. Not all web servers support it, and you have to use a long-running web server like `FrankenPHP`_. -.. versionadded:: 6.4 - - The ``kernel.runtime_mode.worker`` parameter was introduced in Symfony 6.4. - ``kernel.secret`` ----------------- From 4fd16133498febb9cf9dfb8d2550bcb566f5fc08 Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Tue, 24 Oct 2023 11:23:29 +0200 Subject: [PATCH 040/477] [PropertyInfo][Serializer] Remove `AnnotationLoader` --- _build/redirection_map | 1 + components/property_info.rst | 14 -------------- components/serializer.rst | 24 ------------------------ 3 files changed, 1 insertion(+), 38 deletions(-) diff --git a/_build/redirection_map b/_build/redirection_map index 90303a53d75..3b845d59ffe 100644 --- a/_build/redirection_map +++ b/_build/redirection_map @@ -526,6 +526,7 @@ /components https://symfony.com/components /components/index https://symfony.com/components /serializer/normalizers /components/serializer#normalizers +/components/serializer#component-serializer-attributes-groups-annotations /components/serializer#component-serializer-attributes-groups-attributes /logging/monolog_regex_based_excludes /logging/monolog_exclude_http_codes /security/named_encoders /security/named_hashers /components/inflector /components/string#inflector diff --git a/components/property_info.rst b/components/property_info.rst index 0e8a4671d81..452966f57d5 100644 --- a/components/property_info.rst +++ b/components/property_info.rst @@ -468,20 +468,6 @@ with the ``property_info`` service in the Symfony Framework:: // the `serializer_groups` option must be configured (may be set to null) $serializerExtractor->getProperties($class, ['serializer_groups' => ['mygroup']]); -.. versionadded:: 6.4 - - The - :class:`Symfony\\Component\\Serializer\\Mapping\\Loader\\AttributeLoader` - was introduced in Symfony 6.4. Prior to this, the - :class:`Symfony\\Component\\Serializer\\Mapping\\Loader\\AnnotationLoader` - must be used. - -.. deprecated:: 6.4 - - The - :class:`Symfony\\Component\\Serializer\\Mapping\\Loader\\AnnotationLoader` - was deprecated in Symfony 6.4. - If ``serializer_groups`` is set to ``null``, serializer groups metadata won't be checked but you will get only the properties considered by the Serializer Component (notably the ``#[Ignore]`` attribute is taken into account). diff --git a/components/serializer.rst b/components/serializer.rst index 9282cfec115..ba2c4a45a4d 100644 --- a/components/serializer.rst +++ b/components/serializer.rst @@ -271,14 +271,6 @@ that will be used by the normalizer must be aware of the format to use. The following code shows how to initialize the :class:`Symfony\\Component\\Serializer\\Mapping\\Factory\\ClassMetadataFactory` for each format: -* Annotations in PHP files:: - - use Doctrine\Common\Annotations\AnnotationReader; - use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactory; - use Symfony\Component\Serializer\Mapping\Loader\AnnotationLoader; - - $classMetadataFactory = new ClassMetadataFactory(new AnnotationLoader(new AnnotationReader())); - * Attributes in PHP files:: use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactory; @@ -300,22 +292,6 @@ for each format: $classMetadataFactory = new ClassMetadataFactory(new XmlFileLoader('/path/to/your/definition.xml')); -.. versionadded:: 6.4 - - The - :class:`Symfony\\Component\\Serializer\\Mapping\\Loader\\AttributeLoader` - was introduced in Symfony 6.4. Prior to this, the - :class:`Symfony\\Component\\Serializer\\Mapping\\Loader\\AnnotationLoader` - must be used. - -.. deprecated:: 6.4 - - Reading annotations in PHP files is deprecated since Symfony 6.4. - Also, the - :class:`Symfony\\Component\\Serializer\\Mapping\\Loader\\AnnotationLoader` - was deprecated in Symfony 6.4. - -.. _component-serializer-attributes-groups-annotations: .. _component-serializer-attributes-groups-attributes: Then, create your groups definition: From 8510eb4be782212c1be9652f7b1c2c0a21aa3e9f Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Sat, 28 Oct 2023 12:38:55 +0200 Subject: [PATCH 041/477] remove versionadded directive for Symfony 6.4 --- components/phpunit_bridge.rst | 5 ----- 1 file changed, 5 deletions(-) diff --git a/components/phpunit_bridge.rst b/components/phpunit_bridge.rst index 44e7d40bb69..f1c81a5769e 100644 --- a/components/phpunit_bridge.rst +++ b/components/phpunit_bridge.rst @@ -428,11 +428,6 @@ configuration file: -.. versionadded:: 6.4 - - The support for the ``SYMFONY_PHPUNIT_LOCALE`` environment variable was - introduced in Symfony 6.4. - .. _write-assertions-about-deprecations: Write Assertions about Deprecations From 2a70cd2819f8a089702cd74b017635fee5de6932 Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Mon, 30 Oct 2023 10:58:07 +0100 Subject: [PATCH 042/477] - --- security/impersonating_user.rst | 4 ---- 1 file changed, 4 deletions(-) diff --git a/security/impersonating_user.rst b/security/impersonating_user.rst index 6b1a57b2eca..22c6ba11c73 100644 --- a/security/impersonating_user.rst +++ b/security/impersonating_user.rst @@ -74,10 +74,6 @@ as the value to the current URL: You can leverage the Twig function ``impersonation_path('thomas')`` - .. versionadded:: 6.4 - - The ``impersonation_path()`` function was introduced in Symfony 6.4. - .. tip:: Instead of adding a ``_switch_user`` query string parameter, you can pass From 7349989b9bb413653def0fda189e057845fdc081 Mon Sep 17 00:00:00 2001 From: Antoine Lamirault Date: Sun, 19 Nov 2023 15:01:25 +0100 Subject: [PATCH 043/477] [String] New locale aware casing methods --- components/string.rst | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/components/string.rst b/components/string.rst index f743849fd19..ba73e7387b6 100644 --- a/components/string.rst +++ b/components/string.rst @@ -203,7 +203,10 @@ Methods to Change Case :: // changes all graphemes/code points to lower case - u('FOO Bar')->lower(); // 'foo bar' + u('FOO Bar Brİan')->lower(); // 'foo bar bri̇an' + // changes all graphemes/code points to lower case according to locale-specific case mappings + u('FOO Bar Brİan')->localeLower('en'); // 'foo bar bri̇an' + u('FOO Bar Brİan')->localeLower('lt'); // 'foo bar bri̇̇an' // when dealing with different languages, uppercase/lowercase is not enough // there are three cases (lower, upper, title), some characters have no case, @@ -213,11 +216,17 @@ Methods to Change Case u('Die O\'Brian Straße')->folded(); // "die o'brian strasse" // changes all graphemes/code points to upper case - u('foo BAR')->upper(); // 'FOO BAR' + u('foo BAR bάz')->upper(); // 'FOO BAR BΆZ' + // changes all graphemes/code points to upper case according to locale-specific case mappings + u('foo BAR bάz')->localeUpper('en'); // 'FOO BAR BΆZ' + u('foo BAR bάz')->localeUpper('el'); // 'FOO BAR BAZ' // changes all graphemes/code points to "title case" - u('foo bar')->title(); // 'Foo bar' - u('foo bar')->title(true); // 'Foo Bar' + u('foo ijssel ')->title(); // 'Foo ijssel' + u('foo ijssel')->title(true); // 'Foo Ijssel' + // changes all graphemes/code points to "title case" according to locale-specific case mappings + u('foo ijssel')->localeTitle('en'); // 'Foo ijssel' + u('foo ijssel')->localeTitle('nl'); // 'Foo IJssel' // changes all graphemes/code points to camelCase u('Foo: Bar-baz.')->camel(); // 'fooBarBaz' @@ -226,6 +235,10 @@ Methods to Change Case // other cases can be achieved by chaining methods. E.g. PascalCase: u('Foo: Bar-baz.')->camel()->title(); // 'FooBarBaz' +.. versionadded:: 7.1 + The ``localeLower()``, ``localeUpper()`` and ``localeTitle()`` methods were + introduced in Symfony 7.1. + The methods of all string classes are case-sensitive by default. You can perform case-insensitive operations with the ``ignoreCase()`` method:: From 32807059cf0c0f42925eaf7af64320f7338d48e2 Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Mon, 20 Nov 2023 09:12:08 +0100 Subject: [PATCH 044/477] [Form] Deprecate using `UrlType` without setting `default_protocol` --- reference/forms/types/url.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/reference/forms/types/url.rst b/reference/forms/types/url.rst index 5f97fcb89a4..96984b23226 100644 --- a/reference/forms/types/url.rst +++ b/reference/forms/types/url.rst @@ -31,6 +31,11 @@ If a value is submitted that doesn't begin with some protocol (e.g. ``http://``, ``ftp://``, etc), this protocol will be prepended to the string when the data is submitted to the form. +.. deprecated:: 7.1 + + Not setting the ``default_protocol`` option is deprecated since Symfony 7.1 + and will default to ``null`` in Symfony 8.0. + Overridden Options ------------------ From 64ad9e659ac34d56611f8aaa6ef161ebb8bf5fc0 Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Mon, 20 Nov 2023 10:25:52 +0100 Subject: [PATCH 045/477] [DependencyInjection] Prepend extension config with ContainerConfigurator --- bundles/prepend_extension.rst | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/bundles/prepend_extension.rst b/bundles/prepend_extension.rst index bed3d06da43..4bd1c7c6a67 100644 --- a/bundles/prepend_extension.rst +++ b/bundles/prepend_extension.rst @@ -186,6 +186,34 @@ method:: The ``prependExtension()`` method, like ``prepend()``, is called only at compile time. +Alternatively, you can use the ``prepend`` parameter of the +:method:`Symfony\\Component\\DependencyInjection\\Loader\\ContainerConfigurator::extension` +method:: + + use Symfony\Component\DependencyInjection\ContainerBuilder; + use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; + use Symfony\Component\HttpKernel\Bundle\AbstractBundle; + + class FooBundle extends AbstractBundle + { + public function prependExtension(ContainerConfigurator $containerConfigurator, ContainerBuilder $containerBuilder): void + { + // ... + + $containerConfigurator->extension('framework', [ + 'cache' => ['prefix_seed' => 'foo/bar'], + ], prepend: true); + + // ... + } + } + +.. versionadded:: 7.1 + + The ``prepend`` parameter of the + :method:`Symfony\\Component\\DependencyInjection\\Loader\\ContainerConfigurator::extension` + method was added in Symfony 7.1. + More than one Bundle using PrependExtensionInterface ---------------------------------------------------- From 0091e415339f4ffa6d3300cde661cd58f0a92e8d Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Mon, 20 Nov 2023 16:28:23 +0100 Subject: [PATCH 046/477] Clean deprecated directives --- components/http_foundation.rst | 5 ----- components/var_exporter.rst | 6 ------ 2 files changed, 11 deletions(-) diff --git a/components/http_foundation.rst b/components/http_foundation.rst index 47be5693bb0..52b999f0f2c 100644 --- a/components/http_foundation.rst +++ b/components/http_foundation.rst @@ -518,11 +518,6 @@ It is possible to define partitioned cookies, also known as `CHIPS`_, by using t // you can also set the partitioned argument to true when using the `create()` factory method $cookie = Cookie::create('name', 'value', partitioned: true); -.. versionadded:: 6.4 - - The :method:`Symfony\\Component\\HttpFoundation\\Cookie::withPartitioned` - method was introduced in Symfony 6.4. - Managing the HTTP Cache ~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/components/var_exporter.rst b/components/var_exporter.rst index 2b01b7a3f2a..634e4be78cb 100644 --- a/components/var_exporter.rst +++ b/components/var_exporter.rst @@ -224,12 +224,6 @@ initialized:: } } -.. deprecated:: 6.4 - - Using an array of closures for property-based initialization in the - ``createLazyGhost()`` method is deprecated since Symfony 6.4. Pass - a single closure that initializes the whole object instead. - :class:`Symfony\\Component\\VarExporter\\LazyGhostTrait` also allows to convert non-lazy classes to lazy ones:: From 4eb2f258b6552f28e69691c34ab60978c82ab60c Mon Sep 17 00:00:00 2001 From: Antoine Lamirault Date: Sun, 19 Nov 2023 15:40:05 +0100 Subject: [PATCH 047/477] [DependencyInjection] Add urlencode function to EnvVarProcessor --- configuration/env_var_processors.rst | 50 ++++++++++++++++++++++++++++ doctrine.rst | 9 ++--- 2 files changed, 55 insertions(+), 4 deletions(-) diff --git a/configuration/env_var_processors.rst b/configuration/env_var_processors.rst index eba9f4a482c..fc512c84e8e 100644 --- a/configuration/env_var_processors.rst +++ b/configuration/env_var_processors.rst @@ -812,6 +812,56 @@ Symfony provides the following env var processors: // config/services.php $container->setParameter('typed_env', '%env(defined:FOO)%'); +.. _urlencode_environment_variable_processor: + +``env(urlencode:FOO)`` + Urlencode the content of ``FOO`` env var. This is especially useful when + ``FOO`` value is not compatible with DSN syntax. + + .. configuration-block:: + + .. code-block:: yaml + + # config/packages/framework.yaml + parameters: + 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 + namespace Symfony\Component\DependencyInjection\Loader\Configurator; + + use Symfony\Component\DependencyInjection\ContainerBuilder; + use Symfony\Config\FrameworkConfig; + + return static function (ContainerBuilder $container): void { + $container->setParameter('env(DATABASE_URL)', 'mysql://db_user:foo@b$r@127.0.0.1:3306/db_name'); + $container->setParameter('encoded_database_url', '%env(urlencode:DATABASE_URL)%'); + }; + + .. versionadded:: 7.1 + + The ``env(urlencode:...)`` env var processor was introduced in Symfony 7.1. + It is also possible to combine any number of processors: .. configuration-block:: diff --git a/doctrine.rst b/doctrine.rst index f17307108c1..b024c4e7a4c 100644 --- a/doctrine.rst +++ b/doctrine.rst @@ -59,10 +59,11 @@ The database connection information is stored as an environment variable called If the username, password, host or database name contain any character considered special in a URI (such as ``+``, ``@``, ``$``, ``#``, ``/``, ``:``, ``*``, ``!``, ``%``), - you must encode them. See `RFC 3986`_ for the full list of reserved characters or - use the :phpfunction:`urlencode` function to encode them. In this case you need to - remove the ``resolve:`` prefix in ``config/packages/doctrine.yaml`` to avoid errors: - ``url: '%env(DATABASE_URL)%'`` + you must encode them. See `RFC 3986`_ for the full list of reserved characters. + You can use the :phpfunction:`urlencode` function to encode them or + the :ref:`urlencode environment variable processor `. + In this case you need to remove the ``resolve:`` prefix in ``config/packages/doctrine.yaml`` + to avoid errors: ``url: '%env(DATABASE_URL)%'`` Now that your connection parameters are setup, Doctrine can create the ``db_name`` database for you: From 296ee9de94f2652b2ffed15b459d5dc2f13438b5 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Tue, 21 Nov 2023 14:39:56 +0100 Subject: [PATCH 048/477] Tweaks --- components/string.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/string.rst b/components/string.rst index ba73e7387b6..36df10f4597 100644 --- a/components/string.rst +++ b/components/string.rst @@ -222,11 +222,11 @@ Methods to Change Case u('foo BAR bάz')->localeUpper('el'); // 'FOO BAR BAZ' // changes all graphemes/code points to "title case" - u('foo ijssel ')->title(); // 'Foo ijssel' + u('foo ijssel')->title(); // 'Foo ijssel' u('foo ijssel')->title(true); // 'Foo Ijssel' // changes all graphemes/code points to "title case" according to locale-specific case mappings - u('foo ijssel')->localeTitle('en'); // 'Foo ijssel' - u('foo ijssel')->localeTitle('nl'); // 'Foo IJssel' + u('foo ijssel')->localeTitle('en'); // 'Foo ijssel' + u('foo ijssel')->localeTitle('nl'); // 'Foo IJssel' // changes all graphemes/code points to camelCase u('Foo: Bar-baz.')->camel(); // 'fooBarBaz' From bd32bca3dd78231b066d59e6af4aeba0e910492e Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Tue, 21 Nov 2023 14:47:57 +0100 Subject: [PATCH 049/477] Mention the PHP urlencode() function --- configuration/env_var_processors.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/configuration/env_var_processors.rst b/configuration/env_var_processors.rst index fc512c84e8e..6953781e187 100644 --- a/configuration/env_var_processors.rst +++ b/configuration/env_var_processors.rst @@ -815,8 +815,9 @@ Symfony provides the following env var processors: .. _urlencode_environment_variable_processor: ``env(urlencode:FOO)`` - Urlencode the content of ``FOO`` env var. This is especially useful when - ``FOO`` value is not compatible with DSN syntax. + Encodes the content of the ``FOO`` env var using the :phpfunction:`urlencode` + PHP function. This is especially useful when ``FOO`` value is not compatible + with DSN syntax. .. configuration-block:: From c3a8aac346ea87df859a3df276872ba58d3231ae Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Tue, 21 Nov 2023 17:16:37 +0100 Subject: [PATCH 050/477] remove versionadded directive for 6.3 --- components/serializer.rst | 5 ----- 1 file changed, 5 deletions(-) diff --git a/components/serializer.rst b/components/serializer.rst index 0a36d79be20..67aedbef466 100644 --- a/components/serializer.rst +++ b/components/serializer.rst @@ -1275,11 +1275,6 @@ to ``true``:: $result = $normalizer->denormalize($data, Dummy::class, 'json', [AbstractNormalizer::REQUIRE_ALL_PROPERTIES => true]); // throws Symfony\Component\Serializer\Exception\MissingConstructorArgumentException -.. versionadded:: 6.3 - - The ``AbstractNormalizer::PREVENT_NULLABLE_FALLBACK`` context option - was introduced in Symfony 6.3. - Skipping Uninitialized Properties --------------------------------- From 5e32c4bb2466c73d6b644bcd5647c3d42e953b17 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Wed, 22 Nov 2023 09:51:22 +0100 Subject: [PATCH 051/477] fix versionadded syntax --- components/string.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/components/string.rst b/components/string.rst index 36df10f4597..323750921a8 100644 --- a/components/string.rst +++ b/components/string.rst @@ -236,6 +236,7 @@ Methods to Change Case u('Foo: Bar-baz.')->camel()->title(); // 'FooBarBaz' .. versionadded:: 7.1 + The ``localeLower()``, ``localeUpper()`` and ``localeTitle()`` methods were introduced in Symfony 7.1. From 7cc8290969d30fd708807b8851558bfefbf173e5 Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Thu, 23 Nov 2023 09:08:07 +0100 Subject: [PATCH 052/477] [HttpKernel] Introduce `ExceptionEvent::isKernelTerminating()` --- components/http_kernel.rst | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/components/http_kernel.rst b/components/http_kernel.rst index 435ded9063a..fbc59a85a50 100644 --- a/components/http_kernel.rst +++ b/components/http_kernel.rst @@ -519,6 +519,17 @@ comes with an :class:`Symfony\\Component\\HttpKernel\\EventListener\\ErrorListen which if you choose to use, will do this and more by default (see the sidebar below for more details). +The :class:`Symfony\\Component\\HttpKernel\\Event\\ExceptionEvent` exposes the +:method:`Symfony\\Component\\HttpKernel\\Event\\ExceptionEvent::isKernelTerminating` +method, which you can use to determine if the kernel is currently terminating +at the moment the exception was thrown. + +.. versionadded:: 7.1 + + The + :method:`Symfony\\Component\\HttpKernel\\Event\\ExceptionEvent::isKernelTerminating` + method was introduced in Symfony 7.1. + .. note:: When setting a response for the ``kernel.exception`` event, the propagation From 412763397e1705707acb8cdb51a51e14f2ed2ba7 Mon Sep 17 00:00:00 2001 From: "Alexander M. Turek" Date: Sat, 25 Nov 2023 17:16:27 +0100 Subject: [PATCH 053/477] Document requirements for DoctrineDbalAdapter --- .../cache/adapters/doctrine_dbal_adapter.rst | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/components/cache/adapters/doctrine_dbal_adapter.rst b/components/cache/adapters/doctrine_dbal_adapter.rst index fc04410bffc..97b67724ce1 100644 --- a/components/cache/adapters/doctrine_dbal_adapter.rst +++ b/components/cache/adapters/doctrine_dbal_adapter.rst @@ -39,5 +39,22 @@ optional arguments:: necessary to detect the database engine and version without opening the connection. +The adapter uses SQL syntax that is optimized for database server that it is connected to. +The following database servers are known to be compatible: + +* MySQL 5.7 and newer +* MariaDB 10.2 and newer +* Oracle 10g and newer +* SQL Server 2012 and newer +* SQLite 3.24 or later +* PostgreSQL 9.5 or later + +.. note:: + + Newer releases of Doctrine DBAL might increase these minimal versions. Please check + the manual page on `Doctrine DBAL Platforms`_ if your database server is compatible + with the installed Doctrine DBAL version. + .. _`Doctrine DBAL Connection`: https://github.com/doctrine/dbal/blob/master/src/Connection.php -.. _`Doctrine DBAL URL`: https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url +.. _`Doctrine DBAL URL`: https://www.doctrine-project.org/projects/doctrine-dbal/en/current/reference/configuration.html#connecting-using-a-url +.. _`Doctrine DBAL Platforms`: https://www.doctrine-project.org/projects/doctrine-dbal/en/current/reference/platforms.html \ No newline at end of file From 875f4076713ad355283d76f4671dc26defc5192e Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Wed, 29 Nov 2023 10:43:22 +0100 Subject: [PATCH 054/477] remove versionadded directives for Symfony 6 --- frontend/asset_mapper.rst | 4 ---- messenger.rst | 5 ----- 2 files changed, 9 deletions(-) diff --git a/frontend/asset_mapper.rst b/frontend/asset_mapper.rst index 765668ed8ab..c0c8e11040e 100644 --- a/frontend/asset_mapper.rst +++ b/frontend/asset_mapper.rst @@ -951,10 +951,6 @@ is useful if you want to avoid leaking sensitive files like ``.env`` or This option is enabled by default. -.. versionadded:: 6.4 - - The ``exclude_dotfiles`` option was introduced in Symfony 6.4. - .. _config-importmap-polyfill: ``framework.asset_mapper.importmap_polyfill`` diff --git a/messenger.rst b/messenger.rst index d2f64e74230..8fc7e158cfe 100644 --- a/messenger.rst +++ b/messenger.rst @@ -1586,11 +1586,6 @@ sentinel_master String, if null or empty Sentinel null support is disabled ======================= ===================================== ================================= -.. versionadded:: 6.1 - - The ``persistent_id``, ``retry_interval``, ``read_timeout``, ``timeout``, and - ``sentinel_master`` options were introduced in Symfony 6.1. - .. caution:: There should never be more than one ``messenger:consume`` command running with the same From 1f64e6e878a19d719e636f003c76336b49295720 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Fri, 1 Dec 2023 16:10:52 +0100 Subject: [PATCH 055/477] Minor tweak --- components/cache/adapters/doctrine_dbal_adapter.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/components/cache/adapters/doctrine_dbal_adapter.rst b/components/cache/adapters/doctrine_dbal_adapter.rst index 97b67724ce1..68732ddd3fa 100644 --- a/components/cache/adapters/doctrine_dbal_adapter.rst +++ b/components/cache/adapters/doctrine_dbal_adapter.rst @@ -51,10 +51,10 @@ The following database servers are known to be compatible: .. note:: - Newer releases of Doctrine DBAL might increase these minimal versions. Please check - the manual page on `Doctrine DBAL Platforms`_ if your database server is compatible - with the installed Doctrine DBAL version. + Newer releases of Doctrine DBAL might increase these minimal versions. Check + the manual page on `Doctrine DBAL Platforms`_ if your database server is + compatible with the installed Doctrine DBAL version. .. _`Doctrine DBAL Connection`: https://github.com/doctrine/dbal/blob/master/src/Connection.php .. _`Doctrine DBAL URL`: https://www.doctrine-project.org/projects/doctrine-dbal/en/current/reference/configuration.html#connecting-using-a-url -.. _`Doctrine DBAL Platforms`: https://www.doctrine-project.org/projects/doctrine-dbal/en/current/reference/platforms.html \ No newline at end of file +.. _`Doctrine DBAL Platforms`: https://www.doctrine-project.org/projects/doctrine-dbal/en/current/reference/platforms.html From 7d0f640b523959f2ad6fc6938a36146867146c73 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Fri, 1 Dec 2023 16:29:41 +0100 Subject: [PATCH 056/477] Update the Uid version config --- components/uid.rst | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/components/uid.rst b/components/uid.rst index 8b1c496bdc3..26fd32989a9 100644 --- a/components/uid.rst +++ b/components/uid.rst @@ -90,10 +90,10 @@ configure the behavior of the factory using configuration files:: # config/packages/uid.yaml framework: uid: - default_uuid_version: 6 + default_uuid_version: 7 name_based_uuid_version: 5 name_based_uuid_namespace: 6ba7b810-9dad-11d1-80b4-00c04fd430c8 - time_based_uuid_version: 6 + time_based_uuid_version: 7 time_based_uuid_node: 121212121212 .. code-block:: xml @@ -109,10 +109,10 @@ configure the behavior of the factory using configuration files:: @@ -131,10 +131,10 @@ configure the behavior of the factory using configuration files:: $container->extension('framework', [ 'uid' => [ - 'default_uuid_version' => 6, + 'default_uuid_version' => 7, 'name_based_uuid_version' => 5, 'name_based_uuid_namespace' => '6ba7b810-9dad-11d1-80b4-00c04fd430c8', - 'time_based_uuid_version' => 6, + 'time_based_uuid_version' => 7, 'time_based_uuid_node' => 121212121212, ], ]); @@ -156,7 +156,7 @@ on the configuration you defined:: public function generate(): void { - // This creates a UUID of the version given in the configuration file (v6 by default) + // This creates a UUID of the version given in the configuration file (v7 by default) $uuid = $this->uuidFactory->create(); $nameBasedUuid = $this->uuidFactory->nameBased(/** ... */); From 03b72037ad4d8794bdf232340a702bfc6e5962f7 Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Mon, 4 Dec 2023 08:56:36 +0100 Subject: [PATCH 057/477] [PropertyInfo] Introduce `PropertyDocBlockExtractorInterface` --- components/property_info.rst | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/components/property_info.rst b/components/property_info.rst index 452966f57d5..ca05d944429 100644 --- a/components/property_info.rst +++ b/components/property_info.rst @@ -183,6 +183,26 @@ for a property:: See :ref:`components-property-info-type` for info about the ``Type`` class. +Documentation Block +~~~~~~~~~~~~~~~~~~~ + +Extractors that implement :class:`Symfony\\Component\\PropertyInfo\\PropertyDocBlockExtractorInterface` +can provide the full documentation block for a property as a string:: + + $docBlock = $propertyInfo->getDocBlock($class, $property); + /* + Example Result + -------------- + string(79): + This is the subsequent paragraph in the DocComment. + It can span multiple lines. + */ + +.. versionadded:: 7.1 + + The :class:`Symfony\\Component\\PropertyInfo\\PropertyDocBlockExtractorInterface`` + interface was introduced in Symfony 7.1. + .. _property-info-description: Description Information @@ -413,6 +433,12 @@ library is present:: // Description information. $phpDocExtractor->getShortDescription($class, $property); $phpDocExtractor->getLongDescription($class, $property); + $phpDocExtractor->getDocBlock($class, $property); + +.. versionadded:: 7.1 + + The :method:`Symfony\\Component\\PropertyInfo\\Extractor\\PhpDocExtractor::getDocBlock`` + method was introduced in Symfony 7.1. PhpStanExtractor ~~~~~~~~~~~~~~~~ From 9cc4a78d32588b009e0b6869376b82418f09180d Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Mon, 4 Dec 2023 09:04:40 +0100 Subject: [PATCH 058/477] remove versionadded directives for Symfony 6 --- frontend/asset_mapper.rst | 8 -------- 1 file changed, 8 deletions(-) diff --git a/frontend/asset_mapper.rst b/frontend/asset_mapper.rst index 730c62b1cbd..64768b8e77b 100644 --- a/frontend/asset_mapper.rst +++ b/frontend/asset_mapper.rst @@ -379,10 +379,6 @@ from inside ``app.js``: Handling CSS ------------ -.. versionadded:: 6.4 - - The ability to import CSS files was introduced in Symfony 6.4. - CSS can be added to your page by importing it from a JavaScript file. The default ``assets/app.js`` already imports ``assets/styles/app.css``: @@ -639,10 +635,6 @@ validate the performance of your site! Performance: Understanding Preloading ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.. versionadded:: 6.4 - - Automatic preloading of JavaScript files was introduced in Symfony 6.4. - One issue that LightHouse may report is: Avoid Chaining Critical Requests From 4120857b930db4037473660232d912ca4c3b64da Mon Sep 17 00:00:00 2001 From: Daniel Burger <48986191+danielburger1337@users.noreply.github.com> Date: Mon, 4 Dec 2023 09:04:13 +0100 Subject: [PATCH 059/477] [HttpFoundation] Add `UploadedFile::getClientOriginalPath()` to support directory uploads --- controller/upload_file.rst | 14 ++++++++++++-- reference/forms/types/file.rst | 10 +++++++--- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/controller/upload_file.rst b/controller/upload_file.rst index c05e78997ba..f638ed0d517 100644 --- a/controller/upload_file.rst +++ b/controller/upload_file.rst @@ -194,13 +194,23 @@ There are some important things to consider in the code of the above controller: users. This also applies to the files uploaded by your visitors. The ``UploadedFile`` class provides methods to get the original file extension (:method:`Symfony\\Component\\HttpFoundation\\File\\UploadedFile::getClientOriginalExtension`), - the original file size (:method:`Symfony\\Component\\HttpFoundation\\File\\UploadedFile::getSize`) - and the original file name (:method:`Symfony\\Component\\HttpFoundation\\File\\UploadedFile::getClientOriginalName`). + the original file size (:method:`Symfony\\Component\\HttpFoundation\\File\\UploadedFile::getSize`), + the original file name (:method:`Symfony\\Component\\HttpFoundation\\File\\UploadedFile::getClientOriginalName`) + and the original file path (:method:`Symfony\\Component\\HttpFoundation\\File\\UploadedFile::getClientOriginalPath`). However, they are considered *not safe* because a malicious user could tamper that information. That's why it's always better to generate a unique name and use the :method:`Symfony\\Component\\HttpFoundation\\File\\UploadedFile::guessExtension` method to let Symfony guess the right extension according to the file MIME type; +.. note:: + + If a directory was uploaded, ``getClientOriginalPath`` will contain the **webkitRelativePath** as provided by the browser. + Otherwise this value will be identical to ``getClientOriginalName``. + +.. versionadded:: 7.1 + + The ``getClientOriginalPath`` method was introduced in Symfony 7.1. + You can use the following code to link to the PDF brochure of a product: .. code-block:: html+twig diff --git a/reference/forms/types/file.rst b/reference/forms/types/file.rst index 95aab73783a..b4982859b98 100644 --- a/reference/forms/types/file.rst +++ b/reference/forms/types/file.rst @@ -55,6 +55,10 @@ You might calculate the filename in one of the following ways:: // use the original file name $file->move($directory, $file->getClientOriginalName()); + // when "webkitdirectory" upload was used + // otherwise the value will be the same as getClientOriginalName + // $file->move($directory, $file->getClientOriginalPath()); + // compute a random name and try to guess the extension (more secure) $extension = $file->guessExtension(); if (!$extension) { @@ -63,9 +67,9 @@ You might calculate the filename in one of the following ways:: } $file->move($directory, rand(1, 99999).'.'.$extension); -Using the original name via ``getClientOriginalName()`` is not safe as it -could have been manipulated by the end-user. Moreover, it can contain -characters that are not allowed in file names. You should sanitize the name +Using the original name via ``getClientOriginalName()`` or ``getClientOriginalPath`` +is not safe as it could have been manipulated by the end-user. Moreover, it can contain +characters that are not allowed in file names. You should sanitize the value before using it directly. Read :doc:`/controller/upload_file` for an example of how to manage a file From 1e14f408ff1e4df1e862acadb50a395a550b7efe Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Mon, 4 Dec 2023 21:59:51 +0100 Subject: [PATCH 060/477] append parentheses to method names --- controller/upload_file.rst | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/controller/upload_file.rst b/controller/upload_file.rst index f638ed0d517..f50432f5ee3 100644 --- a/controller/upload_file.rst +++ b/controller/upload_file.rst @@ -204,12 +204,13 @@ There are some important things to consider in the code of the above controller: .. note:: - If a directory was uploaded, ``getClientOriginalPath`` will contain the **webkitRelativePath** as provided by the browser. - Otherwise this value will be identical to ``getClientOriginalName``. + If a directory was uploaded, ``getClientOriginalPath()`` will contain + the **webkitRelativePath** as provided by the browser. Otherwise this + value will be identical to ``getClientOriginalName()``. .. versionadded:: 7.1 - The ``getClientOriginalPath`` method was introduced in Symfony 7.1. + The ``getClientOriginalPath()`` method was introduced in Symfony 7.1. You can use the following code to link to the PDF brochure of a product: From 07905b59655e2354eb5f145caff4685d328b6008 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Fri, 8 Dec 2023 11:32:08 +0100 Subject: [PATCH 061/477] fix markup --- components/property_info.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/property_info.rst b/components/property_info.rst index ca05d944429..892cd5345a3 100644 --- a/components/property_info.rst +++ b/components/property_info.rst @@ -200,7 +200,7 @@ can provide the full documentation block for a property as a string:: .. versionadded:: 7.1 - The :class:`Symfony\\Component\\PropertyInfo\\PropertyDocBlockExtractorInterface`` + The :class:`Symfony\\Component\\PropertyInfo\\PropertyDocBlockExtractorInterface` interface was introduced in Symfony 7.1. .. _property-info-description: @@ -437,7 +437,7 @@ library is present:: .. versionadded:: 7.1 - The :method:`Symfony\\Component\\PropertyInfo\\Extractor\\PhpDocExtractor::getDocBlock`` + The :method:`Symfony\\Component\\PropertyInfo\\Extractor\\PhpDocExtractor::getDocBlock` method was introduced in Symfony 7.1. PhpStanExtractor From 5d0f97dbc6a77485fb935aff780c47f6217fd773 Mon Sep 17 00:00:00 2001 From: Antoine Lamirault Date: Sat, 9 Dec 2023 10:58:46 +0100 Subject: [PATCH 062/477] [Cache][Messenger] make both options redis_sentinel and sentinel_master available everywhere --- components/cache/adapters/redis_adapter.rst | 8 ++++++++ messenger.rst | 7 ++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/components/cache/adapters/redis_adapter.rst b/components/cache/adapters/redis_adapter.rst index a25b1a510ed..1550d419081 100644 --- a/components/cache/adapters/redis_adapter.rst +++ b/components/cache/adapters/redis_adapter.rst @@ -200,6 +200,9 @@ Available Options ``redis_sentinel`` (type: ``string``, default: ``null``) Specifies the master name connected to the sentinels. +``sentinel_master`` (type: ``string``, default: ``null``) + Alias of ``redis_sentinel`` option. + ``dbindex`` (type: ``int``, default: ``0``) Specifies the database index to select. @@ -211,6 +214,11 @@ Available Options ``ssl`` (type: ``array``, default: ``null``) SSL context options. See `php.net/context.ssl`_ for more information. +.. versionadded:: 7.1 + + The option `sentinel_master` as an alias for `redis_sentinel` was introduced + in Symfony 7.1. + .. note:: When using the `Predis`_ library some additional Predis-specific options are available. diff --git a/messenger.rst b/messenger.rst index 14ce030f840..07a734d96c9 100644 --- a/messenger.rst +++ b/messenger.rst @@ -1582,9 +1582,14 @@ read_timeout Float, value in seconds ``0`` timeout Connection timeout. Float, value in ``0`` seconds default indicates unlimited sentinel_master String, if null or empty Sentinel null - support is disabled +redis_sentinel support is disabled ======================= ===================================== ================================= +.. versionadded:: 7.1 + + The option `redis_sentinel` as an alias for `sentinel_master` was introduced + in Symfony 7.1. + .. caution:: There should never be more than one ``messenger:consume`` command running with the same From ca09716046bd2bf2ccc74e191395e4b26cabd93a Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Sat, 9 Dec 2023 11:23:04 +0100 Subject: [PATCH 063/477] - --- workflow/dumping-workflows.rst | 4 ---- 1 file changed, 4 deletions(-) diff --git a/workflow/dumping-workflows.rst b/workflow/dumping-workflows.rst index d31b1eb15a8..8262fefd6c1 100644 --- a/workflow/dumping-workflows.rst +++ b/workflow/dumping-workflows.rst @@ -80,10 +80,6 @@ The DOT image will look like this : The ``label`` metadata is not included in the dumped metadata, because it is used as a place's title. -.. versionadded:: 6.4 - - The ``--with-metadata`` option was introduced in Symfony 6.4. - You can use ``metadata`` with the following keys to style the workflow: * for places: From 1601f09e61fb7b216eab6f09c43c7bb59841e62b Mon Sep 17 00:00:00 2001 From: Jade Xau <98119101+ChibyJade@users.noreply.github.com> Date: Sat, 9 Dec 2023 12:21:01 +0100 Subject: [PATCH 064/477] Add getEnabledTransition() method --- workflow.rst | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/workflow.rst b/workflow.rst index de69ef6ae73..eb824cc4531 100644 --- a/workflow.rst +++ b/workflow.rst @@ -310,6 +310,15 @@ machine type, use ``camelCased workflow name + StateMachine``:: } } +To get all enabled transitions of a Workflow, you can use +:method:`Symfony\\Component\\Workflow\\WorkflowInterface::getEnabledTransitions` +method. + +.. versionadded:: 7.1 + + The :method:`Symfony\\Component\\Workflow\\WorkflowInterface::getEnabledTransitions` method + was introduced in Symfony 7.1. + Workflows can also be injected thanks to their name and the :class:`Symfony\\Component\\DependencyInjection\\Attribute\\Target` attribute:: From 0dc5f71cc141f83d1e94543c387e07a14fd9f3a1 Mon Sep 17 00:00:00 2001 From: Jade Xau <98119101+ChibyJade@users.noreply.github.com> Date: Sat, 9 Dec 2023 12:25:04 +0100 Subject: [PATCH 065/477] Apply suggestions from code review --- workflow.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/workflow.rst b/workflow.rst index eb824cc4531..3f627d2170f 100644 --- a/workflow.rst +++ b/workflow.rst @@ -310,13 +310,13 @@ machine type, use ``camelCased workflow name + StateMachine``:: } } -To get all enabled transitions of a Workflow, you can use -:method:`Symfony\\Component\\Workflow\\WorkflowInterface::getEnabledTransitions` +To get the enabled transition of a Workflow, you can use +:method:`Symfony\\Component\\Workflow\\WorkflowInterface::getEnabledTransition` method. .. versionadded:: 7.1 - The :method:`Symfony\\Component\\Workflow\\WorkflowInterface::getEnabledTransitions` method + The :method:`Symfony\\Component\\Workflow\\WorkflowInterface::getEnabledTransition` method was introduced in Symfony 7.1. Workflows can also be injected thanks to their name and the From 0fe3b79a33ee91ea4f9470d282ebe2baf03b8899 Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Sat, 9 Dec 2023 12:25:45 +0100 Subject: [PATCH 066/477] Update workflow.rst --- workflow.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/workflow.rst b/workflow.rst index 3f627d2170f..99d23cdcfae 100644 --- a/workflow.rst +++ b/workflow.rst @@ -316,8 +316,8 @@ method. .. versionadded:: 7.1 - The :method:`Symfony\\Component\\Workflow\\WorkflowInterface::getEnabledTransition` method - was introduced in Symfony 7.1. + The :method:`Symfony\\Component\\Workflow\\WorkflowInterface::getEnabledTransition` + method was introduced in Symfony 7.1. Workflows can also be injected thanks to their name and the :class:`Symfony\\Component\\DependencyInjection\\Attribute\\Target` From 0c017fd5111e908ea177fc8625d8bacd9cf5ec35 Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Fri, 8 Dec 2023 15:55:19 +0100 Subject: [PATCH 067/477] Add Azure mailer --- mailer.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/mailer.rst b/mailer.rst index 3da6c120cb2..fe55ed2d858 100644 --- a/mailer.rst +++ b/mailer.rst @@ -103,6 +103,7 @@ via a third-party provider: Service Install with ===================== ============================================== `Amazon SES`_ ``composer require symfony/amazon-mailer`` +`Azure`_ ``composer require symfony/azure-mailer`` `Brevo`_ ``composer require symfony/brevo-mailer`` `Infobip`_ ``composer require symfony/infobip-mailer`` `Mailchimp Mandrill`_ ``composer require symfony/mailchimp-mailer`` @@ -115,6 +116,10 @@ Service Install with `SendGrid`_ ``composer require symfony/sendgrid-mailer`` ===================== ============================================== +.. versionadded:: 7.1 + + The Azure integration was introduced in Symfony 7.1. + .. note:: As a convenience, Symfony also provides support for Gmail (``composer @@ -167,6 +172,8 @@ party provider: | | - HTTP ses+https://ACCESS_KEY:SECRET_KEY@default | | | - API ses+api://ACCESS_KEY:SECRET_KEY@default | +------------------------+-----------------------------------------------------+ +| `Azure`_ | - API azure+api://ACS_RESOURCE_NAME:KEY@default | ++------------------------+-----------------------------------------------------+ | `Brevo`_ | - SMTP brevo+smtp://USERNAME:PASSWORD@default | | | - HTTP n/a | | | - API brevo+api://KEY@default | @@ -1815,6 +1822,7 @@ the :class:`Symfony\\Bundle\\FrameworkBundle\\Test\\MailerAssertionsTrait`:: handler. .. _`Amazon SES`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Mailer/Bridge/Amazon/README.md +.. _`Azure`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Mailer/Bridge/Azure/README.md .. _`App Password`: https://support.google.com/accounts/answer/185833 .. _`Brevo`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Mailer/Bridge/Brevo/README.md .. _`default_socket_timeout`: https://www.php.net/manual/en/filesystem.configuration.php#ini.default-socket-timeout From 566fdd0d6ea379e84d2b9c5db26a10ffa4716630 Mon Sep 17 00:00:00 2001 From: Yassine Guedidi Date: Sat, 9 Dec 2023 19:30:11 +0100 Subject: [PATCH 068/477] IsCsrfTokenValid documentation --- security/csrf.rst | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/security/csrf.rst b/security/csrf.rst index be7bb909f61..2e2197f1547 100644 --- a/security/csrf.rst +++ b/security/csrf.rst @@ -164,6 +164,26 @@ method to check its validity:: } } +Alternatively you can use the +:class:`Symfony\\Component\\Security\\Http\\Attribute\\IsCsrfTokenValid` +attribute on the controller action:: + + use Symfony\Component\HttpFoundation\Request; + use Symfony\Component\HttpFoundation\Response; + use Symfony\Component\Security\Http\Attribute\IsCsrfTokenValid; + // ... + + #[IsCsrfTokenValid('delete-item', tokenKey: 'token')] + public function delete(Request $request): Response + { + // ... do something, like deleting an object + } + +.. versionadded:: 7.1 + + The :class:`Symfony\\Component\\Security\\Http\\Attribute\\IsCsrfTokenValid` + attribute was introduced in Symfony 7.1. + CSRF Tokens and Compression Side-Channel Attacks ------------------------------------------------ From 47caec8a448b0ab696d419959bd7ca929ccbe60b Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Sat, 9 Dec 2023 19:37:43 +0100 Subject: [PATCH 069/477] Remove obsolete versionadded directive --- security/access_token.rst | 5 ----- 1 file changed, 5 deletions(-) diff --git a/security/access_token.rst b/security/access_token.rst index 37942e950c4..29fbfbc8bb6 100644 --- a/security/access_token.rst +++ b/security/access_token.rst @@ -700,11 +700,6 @@ create your own User from the claims, you must Creating Users from Token ------------------------- -.. versionadded:: 6.3 - - The possibility to omit the user provider in case of stateless firewalls - was introduced in Symfony 6.3. - Some types of tokens (for instance OIDC) contain all information required to create a user entity (e.g. username and roles). In this case, you don't need a user provider to create a user from the database:: From 7b47bdc409d47c082a7a0c7c5d9713ba9606d9b1 Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Sat, 9 Dec 2023 19:42:52 +0100 Subject: [PATCH 070/477] Add `#[IsCsrfTokenValid]` to attributes reference --- reference/attributes.rst | 1 + security/csrf.rst | 2 ++ 2 files changed, 3 insertions(+) diff --git a/reference/attributes.rst b/reference/attributes.rst index cf21c5a7c45..f61c78b9a3a 100644 --- a/reference/attributes.rst +++ b/reference/attributes.rst @@ -80,6 +80,7 @@ Security ~~~~~~~~ * :ref:`CurrentUser ` +* :ref:`IsCsrfTokenValid ` * :ref:`IsGranted ` Serializer diff --git a/security/csrf.rst b/security/csrf.rst index 2e2197f1547..0352d7e6f87 100644 --- a/security/csrf.rst +++ b/security/csrf.rst @@ -164,6 +164,8 @@ method to check its validity:: } } +.. _csrf-controller-attributes: + Alternatively you can use the :class:`Symfony\\Component\\Security\\Http\\Attribute\\IsCsrfTokenValid` attribute on the controller action:: From 2e45f6af526da40d228dafe40bf31e57e262da76 Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Sun, 10 Dec 2023 09:54:31 +0100 Subject: [PATCH 071/477] [Form] Add `keep_as_list` option --- reference/forms/types/collection.rst | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/reference/forms/types/collection.rst b/reference/forms/types/collection.rst index d1e1f0fb00b..2d91bfd06bd 100644 --- a/reference/forms/types/collection.rst +++ b/reference/forms/types/collection.rst @@ -229,6 +229,27 @@ you'd use the :doc:`EmailType `. If you want to embed a collection of some other form, pass the form type class as this option (e.g. ``MyFormType::class``). +keep_as_list +~~~~~~~~~~~~ + +**type**: ``boolean`` **default**: ``false`` + +When set to ``true``, the ``keep_as_list`` option affects the reindexing +of nested form names within a collection. This feature is particularly useful +when working with collection types and removing items from the collection +during form submission. + +When this option is set to ``false``, if you have a collection of 3 items and +you remove the second item, the indexes will be ``0`` and ``2`` when validating +the collection. However, by enabling the ``keep_as_list`` option and setting +it to ``true``, the indexes will be reindexed as ``0`` and ``1``. This ensures +that the indexes remain consecutive and do not have gaps, providing a clearer +and more predictable structure for your nested forms. + +.. versionadded:: 7.1 + + The ``keep_as_list`` option was introduced in Symfony 7.1. + prototype ~~~~~~~~~ From 2c88dc8c3162ad4e96bf6d309f19ed27eb13689e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Sch=C3=A4dlich?= Date: Sat, 25 Nov 2023 10:45:09 +0100 Subject: [PATCH 072/477] Improve `debug:serializer` command documentation by adding `serializedPath` --- serializer.rst | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/serializer.rst b/serializer.rst index ef155a1a45d..9731e9b869e 100644 --- a/serializer.rst +++ b/serializer.rst @@ -511,20 +511,22 @@ given class: | | "groups" => [ | | | "book:read", | | | "book:write", | - | | ] | + | | ], | | | "maxDepth" => 1, | - | | "serializedName" => "book_name" | - | | "ignore" => false | + | | "serializedName" => "book_name", | + | | "serializedPath" => null, | + | | "ignore" => false, | | | "normalizationContexts" => [], | | | "denormalizationContexts" => [] | | | ] | | isbn | [ | | | "groups" => [ | | | "book:read", | - | | ] | + | | ], | | | "maxDepth" => null, | - | | "serializedName" => null | - | | "ignore" => false | + | | "serializedName" => null, | + | | "serializedPath" => [data][isbn], | + | | "ignore" => false, | | | "normalizationContexts" => [], | | | "denormalizationContexts" => [] | | | ] | From 4336b8735cf2e22004c51302d7b5678afab3e32e Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Tue, 12 Dec 2023 12:15:00 +0100 Subject: [PATCH 073/477] - --- reference/configuration/framework.rst | 4 ---- webhook.rst | 4 ---- 2 files changed, 8 deletions(-) diff --git a/reference/configuration/framework.rst b/reference/configuration/framework.rst index b5a2c547eb1..894cf7a82c5 100644 --- a/reference/configuration/framework.rst +++ b/reference/configuration/framework.rst @@ -3550,10 +3550,6 @@ Adds a `Link HTTP header`_ to the response. webhook ~~~~~~~ -.. versionadded:: 6.3 - - The Webhook configuration was introduced in Symfony 6.3. - The ``webhook`` option (and its children) are used to configure the webhooks defined in your application. Read more about the options in the :ref:`Webhook documentation `. diff --git a/webhook.rst b/webhook.rst index f9bde7451a9..f65760182a8 100644 --- a/webhook.rst +++ b/webhook.rst @@ -1,10 +1,6 @@ Webhook ======= -.. versionadded:: 6.3 - - The Webhook component was introduced in Symfony 6.3. - The Webhook component is used to respond to remote webhooks to trigger actions in your application. This document focuses on using webhooks to listen to remote events in other Symfony components. From cc8abdd50c873b90d44ff91291c33fc9df0bb152 Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Tue, 12 Dec 2023 13:25:01 +0100 Subject: [PATCH 074/477] - --- webhook.rst | 9 --------- 1 file changed, 9 deletions(-) diff --git a/webhook.rst b/webhook.rst index 4e7377cf730..74e48499937 100644 --- a/webhook.rst +++ b/webhook.rst @@ -86,15 +86,6 @@ Sendgrid ``mailer.webhook.request_parser.sendgrid`` Vonage ``notifier.webhook.request_parser.vonage`` ======== ========================================== -.. versionadded:: 6.3 - - The support for Mailgun and Postmark was introduced in Symfony 6.3. - -.. versionadded:: 6.4 - - The support for Brevo, Mailjet, Sendgrid and Vonage was introduced in - Symfony 6.4. - Set up the webhook in the third-party mailer. For Mailgun, you can do this in the control panel. As URL, make sure to use the ``/webhook/mailer_mailgun`` path behind the domain you're using. From 8ebe0dd9de58c25e266bfcc943198f5829006d4f Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Tue, 12 Dec 2023 14:10:17 +0100 Subject: [PATCH 075/477] [Messenger] Add `--all` option to `messenger:consume` --- messenger.rst | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/messenger.rst b/messenger.rst index 133283fe465..adaec5a9883 100644 --- a/messenger.rst +++ b/messenger.rst @@ -485,6 +485,17 @@ The first argument is the receiver's name (or service id if you routed to a custom service). By default, the command will run forever: looking for new messages on your transport and handling them. This command is called your "worker". +If you want to consume messages from all available receivers, you can use the +command with the ``--all`` option: + +.. code-block:: terminal + + $ php bin/console messenger:consume --all + +.. versionadded:: 7.1 + + The ``--all`` option was introduced in Symfony 7.1. + .. tip:: To properly stop a worker, throw an instance of From 457d5e566b21758cc2b84f987eef3d56388f4ab4 Mon Sep 17 00:00:00 2001 From: Louis-Marie Date: Wed, 13 Dec 2023 08:50:00 +0100 Subject: [PATCH 076/477] Remove @dev --- setup.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/setup.rst b/setup.rst index 49b6f9482de..7da5a5fcb12 100644 --- a/setup.rst +++ b/setup.rst @@ -46,10 +46,10 @@ application: .. code-block:: terminal # run this if you are building a traditional web application - $ symfony new my_project_directory --version="7.0.*@dev" --webapp + $ symfony new my_project_directory --version="7.0.*" --webapp # run this if you are building a microservice, console application or API - $ symfony new my_project_directory --version="7.0.*@dev" + $ symfony new my_project_directory --version="7.0.*" The only difference between these two commands is the number of packages installed by default. The ``--webapp`` option installs all the packages that you @@ -61,12 +61,12 @@ Symfony application using Composer: .. code-block:: terminal # run this if you are building a traditional web application - $ composer create-project symfony/skeleton:"7.0.*@dev" my_project_directory + $ composer create-project symfony/skeleton:"7.0.*" my_project_directory $ cd my_project_directory $ composer require webapp # run this if you are building a microservice, console application or API - $ composer create-project symfony/skeleton:"7.0.*@dev" my_project_directory + $ composer create-project symfony/skeleton:"7.0.*" my_project_directory No matter which command you run to create the Symfony application. All of them will create a new ``my_project_directory/`` directory, download some dependencies From 46de3924533620cd415c2f5f3d5123b134c96da7 Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Wed, 13 Dec 2023 08:52:43 +0100 Subject: [PATCH 077/477] [Cache] Deprecate `CouchbaseBucketAdapter` --- components/cache/adapters/couchbasebucket_adapter.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/components/cache/adapters/couchbasebucket_adapter.rst b/components/cache/adapters/couchbasebucket_adapter.rst index c279e1f8780..8927a8c53f8 100644 --- a/components/cache/adapters/couchbasebucket_adapter.rst +++ b/components/cache/adapters/couchbasebucket_adapter.rst @@ -1,6 +1,12 @@ Couchbase Bucket Cache Adapter ============================== +.. deprecated:: 7.1 + + The ``CouchbaseBucketAdapter`` is deprecated since Symfony 7.1, use the + :doc:`CouchbaseCollectionAdapter ` + instead. + This adapter stores the values in-memory using one (or more) `Couchbase server`_ instances. Unlike the :doc:`APCu adapter `, and similarly to the :doc:`Memcached adapter `, it is not limited to the current server's From 62b41a0cd5c01d15731d637a00a1799e61b767b9 Mon Sep 17 00:00:00 2001 From: Matthieu Lempereur Date: Wed, 13 Dec 2023 09:36:51 +0100 Subject: [PATCH 078/477] remove 6.x versionnaded in webhook --- webhook.rst | 8 -------- 1 file changed, 8 deletions(-) diff --git a/webhook.rst b/webhook.rst index 889f6bac174..8be38d80408 100644 --- a/webhook.rst +++ b/webhook.rst @@ -145,14 +145,6 @@ Twilio ``notifier.webhook.request_parser.twilio`` Vonage ``notifier.webhook.request_parser.vonage`` ============ ========================================== -.. versionadded:: 6.3 - - The support for Twilio was introduced in Symfony 6.3. - -.. versionadded:: 6.4 - - The support for Vonage was introduced in Symfony 6.4. - For SMS transports, an additional ``SmsEvent`` is available in the RemoteEvent consumer:: From 6de3f76d83cae369726403e8af132cadfa492da3 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Wed, 13 Dec 2023 10:30:46 +0100 Subject: [PATCH 079/477] remove versionadded directive for Symfony 6 --- security.rst | 5 ----- 1 file changed, 5 deletions(-) diff --git a/security.rst b/security.rst index 2c67ec8d073..e275ec4add0 100644 --- a/security.rst +++ b/security.rst @@ -1857,11 +1857,6 @@ you have imported the logout route loader in your routes: $routes->import('security.route_loader.logout', 'service'); }; -.. versionadded:: 6.4 - - The :class:`Symfony\\Bundle\\SecurityBundle\\Routing\\LogoutRouteLoader` was - introduced in Symfony 6.4. - Logout programmatically ~~~~~~~~~~~~~~~~~~~~~~~ From 57f78401f85694b174572dadab73a0ffdab6380b Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Thu, 14 Dec 2023 08:21:40 +0100 Subject: [PATCH 080/477] - --- messenger.rst | 4 ---- 1 file changed, 4 deletions(-) diff --git a/messenger.rst b/messenger.rst index 58573dab7a9..25d6b519960 100644 --- a/messenger.rst +++ b/messenger.rst @@ -884,10 +884,6 @@ running the ``messenger:consume`` command. Rate limited transport ~~~~~~~~~~~~~~~~~~~~~~ -.. versionadded:: 6.2 - - The ``rate_limiter`` option was introduced in Symfony 6.2. - Sometimes you might need to rate limit your message worker. You can configure a rate limiter on a transport (requires the :doc:`RateLimiter component `) by setting its ``rate_limiter`` option: From be9cb027cc149a1ae6f1b8b17339b0d21c02d661 Mon Sep 17 00:00:00 2001 From: Maxime Doutreluingne Date: Fri, 15 Dec 2023 18:10:04 +0100 Subject: [PATCH 081/477] [Notifier] Add Bluesky notifier bridge --- console.rst | 4 ---- notifier.rst | 6 ++++++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/console.rst b/console.rst index 6a0806c730a..700ed536486 100644 --- a/console.rst +++ b/console.rst @@ -611,10 +611,6 @@ profile is accessible through the web page of the profiler. terminal supports links). If you run it in debug verbosity (``-vvv``) you'll also see the time and memory consumed by the command. -.. versionadded:: 6.4 - - The ``--profile`` option was introduced in Symfony 6.4. - Learn More ---------- diff --git a/notifier.rst b/notifier.rst index 42f55201073..8cb9b87c0dd 100644 --- a/notifier.rst +++ b/notifier.rst @@ -221,6 +221,7 @@ integration with these chat services: Service Package DSN ======================================= ==================================== ============================================================================= `AmazonSns`_ ``symfony/amazon-sns-notifier`` ``sns://ACCESS_KEY:SECRET_KEY@default?region=REGION`` +`Bluesky`_ ``symfony/bluesky-notifier`` ``bluesky://USERNAME:PASSWORD@default`` `Chatwork`_ ``symfony/chatwork-notifier`` ``chatwork://API_TOKEN@default?room_id=ID`` `Discord`_ ``symfony/discord-notifier`` ``discord://TOKEN@default?webhook_id=ID`` `FakeChat`_ ``symfony/fake-chat-notifier`` ``fakechat+email://default?to=TO&from=FROM`` or ``fakechat+logger://default`` @@ -241,6 +242,10 @@ Service Package D `Zulip`_ ``symfony/zulip-notifier`` ``zulip://EMAIL:TOKEN@HOST?channel=CHANNEL`` ====================================== ==================================== ============================================================================= +.. versionadded:: 7.1 + + The ``Bluesky`` integration was introduced in Symfony 7.1. + Chatters are configured using the ``chatter_transports`` setting: .. code-block:: bash @@ -942,6 +947,7 @@ is dispatched. Listeners receive a .. _`AllMySms`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/AllMySms/README.md .. _`AmazonSns`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/AmazonSns/README.md .. _`Bandwidth`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Bandwidth/README.md +.. _`Bluesky`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Bluesky/README.md .. _`Brevo`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Brevo/README.md .. _`Chatwork`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Chatwork/README.md .. _`Clickatell`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Clickatell/README.md From dbcfe2f3bd91a421007e44ecc372f7f5294c27fc Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Sat, 16 Dec 2023 09:57:50 +0100 Subject: [PATCH 082/477] - --- console.rst | 4 ---- 1 file changed, 4 deletions(-) diff --git a/console.rst b/console.rst index 6a0806c730a..700ed536486 100644 --- a/console.rst +++ b/console.rst @@ -611,10 +611,6 @@ profile is accessible through the web page of the profiler. terminal supports links). If you run it in debug verbosity (``-vvv``) you'll also see the time and memory consumed by the command. -.. versionadded:: 6.4 - - The ``--profile`` option was introduced in Symfony 6.4. - Learn More ---------- From 9e47f5fe8489c1b6aadbb241a4fe30faf1aebfea Mon Sep 17 00:00:00 2001 From: Farhad Safarov Date: Sun, 17 Dec 2023 01:03:31 +0300 Subject: [PATCH 083/477] [Notifier] Add Unifonic notifier bridge --- notifier.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/notifier.rst b/notifier.rst index 8cb9b87c0dd..b57f501687d 100644 --- a/notifier.rst +++ b/notifier.rst @@ -98,6 +98,7 @@ Service Package DSN `Telnyx`_ ``symfony/telnyx-notifier`` ``telnyx://API_KEY@default?from=FROM&messaging_profile_id=MESSAGING_PROFILE_ID`` `TurboSms`_ ``symfony/turbo-sms-notifier`` ``turbosms://AUTH_TOKEN@default?from=FROM`` `Twilio`_ ``symfony/twilio-notifier`` ``twilio://SID:TOKEN@default?from=FROM`` yes +`Unifonic`_ ``symfony/unifonic-notifier`` ``unifonic://APP_SID@default?from=FROM`` `Vonage`_ ``symfony/vonage-notifier`` ``vonage://KEY:SECRET@default?from=FROM`` yes `Yunpian`_ ``symfony/yunpian-notifier`` ``yunpian://APIKEY@default`` ================== ===================================== ========================================================================================================================= =============== @@ -244,7 +245,7 @@ Service Package D .. versionadded:: 7.1 - The ``Bluesky`` integration was introduced in Symfony 7.1. + The ``Bluesky`` and ``Unifonic`` integrations were introduced in Symfony 7.1. Chatters are configured using the ``chatter_transports`` setting: @@ -1008,6 +1009,7 @@ is dispatched. Listeners receive a .. _`TurboSms`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/TurboSms/README.md .. _`Twilio`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Twilio/README.md .. _`Twitter`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Twitter/README.md +.. _`Unifonic`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Unifonic/README.md .. _`Vonage`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Vonage/README.md .. _`Yunpian`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Yunpian/README.md .. _`Zendesk`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Zendesk/README.md From 6bd49488eebe6195e7df021b9057988c539b49cb Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Sun, 17 Dec 2023 20:29:35 +0100 Subject: [PATCH 084/477] [HttpClient] Add `JsonMockResponse::fromFile()` and `MockResponse::fromFile()` shortcuts --- http_client.rst | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/http_client.rst b/http_client.rst index 2ca591a5098..6d45fc6d6d7 100644 --- a/http_client.rst +++ b/http_client.rst @@ -1905,6 +1905,20 @@ in order when requests are made:: $response1 = $client->request('...'); // returns $responses[0] $response2 = $client->request('...'); // returns $responses[1] +It is also possible to create a +:class:`Symfony\\Component\\HttpClient\\Response\\MockResponse` directly +from a file, which is particularly useful when storing your responses +snapshots in files:: + + use Symfony\Component\HttpClient\Response\MockResponse; + + $response = MockResponse::fromFile('tests/fixtures/response.xml'); + +.. versionadded:: 7.1 + + The :method:`Symfony\\Component\\HttpClient\\Response\\MockResponse::fromFile` + method was introduced in Symfony 7.1. + Another way of using :class:`Symfony\\Component\\HttpClient\\MockHttpClient` is to pass a callback that generates the responses dynamically when it's called:: @@ -2079,6 +2093,19 @@ You can use :class:`Symfony\\Component\\HttpClient\\Response\\JsonMockResponse` 'foo' => 'bar', ]); +Just like :class:`Symfony\\Component\\HttpClient\\Response\\MockResponse`, you can +also create a :class:`Symfony\\Component\\HttpClient\\Response\\JsonMockResponse` +directly from a file:: + + use Symfony\Component\HttpClient\Response\JsonMockResponse; + + $response = JsonMockResponse::fromFile('tests/fixtures/response.json'); + +.. versionadded:: 7.1 + + The :method:`Symfony\\Component\\HttpClient\\Response\\JsonMockResponse::fromFile` + method was introduced in Symfony 7.1. + Testing Request Data ~~~~~~~~~~~~~~~~~~~~ From b89fb23bdd9ed4b8607d69d287cd6136f9d0fbcc Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Tue, 19 Dec 2023 20:51:02 +0100 Subject: [PATCH 085/477] [FrameworkBundle][RateLimiter] Add `rate_limiter` tag to rate limiter services --- rate_limiter.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/rate_limiter.rst b/rate_limiter.rst index 7453e1e70bc..8c667dd3f59 100644 --- a/rate_limiter.rst +++ b/rate_limiter.rst @@ -215,6 +215,16 @@ at a rate of another 500 requests every 15 minutes. If you don't make that number of requests, the unused ones don't accumulate (the ``limit`` option prevents that number from being higher than 5,000). +.. tip:: + + All rate-limiters are tagged with the ``rate_limiter`` tag, so you can + easily find them with a tagged iterator or locator. + + .. versionadded:: 7.1 + + The automatic addition of the ``rate_limiter`` tag was introduced + in Symfony 7.1. + Rate Limiting in Action ----------------------- From e12c974d310d690472d9b67d062fa316dc2b5983 Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Wed, 20 Dec 2023 08:49:58 +0100 Subject: [PATCH 086/477] [Validator] Add `list` and `associative_array` types to Type constraint --- reference/constraints/Type.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/reference/constraints/Type.rst b/reference/constraints/Type.rst index 1bb4035c7fd..b8f41fbd524 100644 --- a/reference/constraints/Type.rst +++ b/reference/constraints/Type.rst @@ -190,6 +190,11 @@ PHP class/interface or a valid PHP datatype (checked by PHP's ``is_()`` function * :phpfunction:`resource ` * :phpfunction:`null ` +If you're dealing with arrays, you can use the following types in the constraint: + +* ``list`` which uses :phpfunction:`array_is_list ` internally +* ``associative_array`` which is true for any **non-empty** array that is not a list + Also, you can use ``ctype_*()`` functions from corresponding `built-in PHP extension`_. Consider `a list of ctype functions`_: @@ -208,6 +213,11 @@ Also, you can use ``ctype_*()`` functions from corresponding Make sure that the proper :phpfunction:`locale ` is set before using one of these. +.. versionadded:: 7.1 + + The ``list`` and ``associative_array`` types were introduced in Symfony + 7.1. + Finally, you can use aggregated functions: * ``number``: ``is_int || is_float && !is_nan`` From c7ac483dd76079af66756a35eb27ab401b72abd6 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Wed, 20 Dec 2023 09:14:11 +0100 Subject: [PATCH 087/477] fix typo --- http_client.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/http_client.rst b/http_client.rst index 81e3b3068c9..530b2aeaf8f 100644 --- a/http_client.rst +++ b/http_client.rst @@ -1907,7 +1907,7 @@ in order when requests are made:: It is also possible to create a :class:`Symfony\\Component\\HttpClient\\Response\\MockResponse` directly -from a file, which is particularly useful when storing your responses +from a file, which is particularly useful when storing your response snapshots in files:: use Symfony\Component\HttpClient\Response\MockResponse; From 62aeccb52ec4ef5b6ea39aa0632c5c480ffda10d Mon Sep 17 00:00:00 2001 From: Alan ZARLI Date: Mon, 18 Dec 2023 16:36:01 +0100 Subject: [PATCH 088/477] [Notifier] Add Smsbox notifier bridge --- notifier.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/notifier.rst b/notifier.rst index b57f501687d..a8f658cbe62 100644 --- a/notifier.rst +++ b/notifier.rst @@ -92,6 +92,7 @@ Service Package DSN `Sinch`_ ``symfony/sinch-notifier`` ``sinch://ACCOUNT_ID:AUTH_TOKEN@default?from=FROM`` `Smsapi`_ ``symfony/smsapi-notifier`` ``smsapi://TOKEN@default?from=FROM`` `SmsBiuras`_ ``symfony/sms-biuras-notifier`` ``smsbiuras://UID:API_KEY@default?from=FROM&test_mode=0`` +`Smsbox`_ ``symfony/smsbox-notifier`` ``smsbox://APIKEY@default?mode=MODE&strategy=STRATEGY&sender=SENDER`` `Smsc`_ ``symfony/smsc-notifier`` ``smsc://LOGIN:PASSWORD@default?from=FROM`` `SMSFactor`_ ``symfony/sms-factor-notifier`` ``sms-factor://TOKEN@default?sender=SENDER&push_type=PUSH_TYPE`` `SpotHit`_ ``symfony/spot-hit-notifier`` ``spothit://TOKEN@default?from=FROM`` @@ -245,7 +246,7 @@ Service Package D .. versionadded:: 7.1 - The ``Bluesky`` and ``Unifonic`` integrations were introduced in Symfony 7.1. + The ``Bluesky``, ``Unifonic`` and ``Smsbox`` integrations were introduced in Symfony 7.1. Chatters are configured using the ``chatter_transports`` setting: From 6eaf0d28c4a51d322a1f4dac9945cecf1c262d39 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 20 Dec 2023 15:44:04 +0100 Subject: [PATCH 089/477] Minor tweak --- rate_limiter.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rate_limiter.rst b/rate_limiter.rst index 8c667dd3f59..818660498a8 100644 --- a/rate_limiter.rst +++ b/rate_limiter.rst @@ -218,7 +218,8 @@ prevents that number from being higher than 5,000). .. tip:: All rate-limiters are tagged with the ``rate_limiter`` tag, so you can - easily find them with a tagged iterator or locator. + find them with a :doc:`tagged iterator ` or + :doc:`locator `. .. versionadded:: 7.1 From f32a8cf34775c2b509c2312a610213aa5de29291 Mon Sep 17 00:00:00 2001 From: Matthieu Lempereur Date: Wed, 20 Dec 2023 13:58:44 +0100 Subject: [PATCH 090/477] [Security] Update request matcher doc --- security/access_control.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/security/access_control.rst b/security/access_control.rst index 1da469a1f33..a8a0a3e2987 100644 --- a/security/access_control.rst +++ b/security/access_control.rst @@ -19,10 +19,10 @@ things: 1. Matching Options ------------------- -Symfony creates an instance of :class:`Symfony\\Component\\HttpFoundation\\RequestMatcher` -for each ``access_control`` entry, which determines whether or not a given -access control should be used on this request. The following ``access_control`` -options are used for matching: +Symfony uses :class:`Symfony\\Component\\HttpFoundation\\ChainRequestMatcher` for +each ``access_control`` entry, which determines which implementation of +:class:`Symfony\\Component\\HttpFoundation\\RequestMatcherInterface` should be used +on this request. The following ``access_control`` options are used for matching: * ``path``: a regular expression (without delimiters) * ``ip`` or ``ips``: netmasks are also supported (can be a comma-separated string) From 9f4b6263f317b38b9294a6d0622cc79ea6d598ae Mon Sep 17 00:00:00 2001 From: Simon Date: Thu, 21 Dec 2023 09:54:44 +0100 Subject: [PATCH 091/477] [String] Remove confusing paragraph about `withEmoji('strip')` --- components/intl.rst | 9 +++++++++ components/string.rst | 10 ---------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/components/intl.rst b/components/intl.rst index 46146e47e1b..8dde23105a6 100644 --- a/components/intl.rst +++ b/components/intl.rst @@ -424,6 +424,15 @@ platforms:: $transliterator->transliterate('Menus with 🥗 or 🧆'); // => 'Menus with :green_salad: or :falafel:' +Furthermore the ``EmojiTransliterator`` provides a special ``strip`` locale +that removes all the emojis from a string:: + + use Symfony\Component\Intl\Transliterator\EmojiTransliterator; + + $transliterator = EmojiTransliterator::create('strip'); + $transliterator->transliterate('🎉Hey!🥳 🎁Happy Birthday!🎁'); + // => 'Hey! Happy Birthday!' + .. tip:: Combine this emoji transliterator with the :ref:`Symfony String slugger ` diff --git a/components/string.rst b/components/string.rst index f743849fd19..b3d9bb7954b 100644 --- a/components/string.rst +++ b/components/string.rst @@ -589,16 +589,6 @@ from GitHub or Slack, use the first argument of ``withEmoji()`` method:: $slug = $slugger->slug('a 😺, 🐈‍⬛, and a 🦁'); // $slug = 'a-smiley-cat-black-cat-and-a-lion'; -If you want to strip emojis from slugs, use the special ``strip`` locale:: - - use Symfony\Component\String\Slugger\AsciiSlugger; - - $slugger = new AsciiSlugger(); - $slugger = $slugger->withEmoji('strip'); - - $slug = $slugger->slug('a 😺, 🐈‍⬛, and a 🦁'); - // $slug = 'a-and-a'; - .. _string-inflector: Inflector From 8d69319ff59ef8ae2498469e405289c5bbdb604c Mon Sep 17 00:00:00 2001 From: Matthieu Lempereur Date: Sat, 23 Dec 2023 18:37:12 +0100 Subject: [PATCH 092/477] Remove reference to some removed classes --- create_framework/http_kernel_httpkernel_class.rst | 5 ----- introduction/from_flat_php_to_symfony.rst | 11 +++++------ messenger.rst | 2 +- 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/create_framework/http_kernel_httpkernel_class.rst b/create_framework/http_kernel_httpkernel_class.rst index fa673f9ba57..ecf9d4c7879 100644 --- a/create_framework/http_kernel_httpkernel_class.rst +++ b/create_framework/http_kernel_httpkernel_class.rst @@ -114,11 +114,6 @@ client; that's what the ``ResponseListener`` does:: $dispatcher->addSubscriber(new HttpKernel\EventListener\ResponseListener('UTF-8')); -If you want out of the box support for streamed responses, subscribe -to ``StreamedResponseListener``:: - - $dispatcher->addSubscriber(new HttpKernel\EventListener\StreamedResponseListener()); - And in your controller, return a ``StreamedResponse`` instance instead of a ``Response`` instance. diff --git a/introduction/from_flat_php_to_symfony.rst b/introduction/from_flat_php_to_symfony.rst index 7386f629546..3ae6a16d8a3 100644 --- a/introduction/from_flat_php_to_symfony.rst +++ b/introduction/from_flat_php_to_symfony.rst @@ -240,7 +240,7 @@ the ``templates/layout.php``: You now have a setup that will allow you to reuse the layout. Unfortunately, to accomplish this, you're forced to use a few ugly PHP functions (``ob_start()``, ``ob_get_clean()``) in the template. Symfony -solves this using a `Templating`_ component. You'll see it in action shortly. +solves this using `Twig`_. You'll see it in action shortly. Adding a Blog "show" Page ------------------------- @@ -568,9 +568,8 @@ nice way to group related pages. The controller functions are also sometimes cal The two controllers (or actions) are still lightweight. Each uses the :doc:`Doctrine ORM library ` to retrieve objects from the -database and the Templating component to render a template and return a -``Response`` object. The ``list.html.twig`` template is now quite a bit simpler, -and uses Twig: +database and Twig to render a template and return a ``Response`` object. +The ``list.html.twig`` template is now quite a bit simpler, and uses Twig: .. code-block:: html+twig @@ -677,7 +676,7 @@ migrating the blog from flat PHP to Symfony has improved your life: :doc:`routing `, or rendering :doc:`controllers `; * Symfony gives you **access to open source tools** such as `Doctrine`_ and the - `Templating`_, :doc:`Security `, :doc:`Form `, + `Twig`_, :doc:`Security `, :doc:`Form `, `Validator`_ and `Translation`_ components (to name a few); * The application now enjoys **fully-flexible URLs** thanks to the Routing @@ -694,7 +693,7 @@ A good selection of `Symfony community tools`_ can be found on GitHub. .. _`Model-View-Controller`: https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller .. _`Doctrine`: https://www.doctrine-project.org/ -.. _Templating: https://github.com/symfony/templating +.. _Twig: https://github.com/twigphp/twig .. _Translation: https://github.com/symfony/translation .. _`Composer`: https://getcomposer.org .. _`download Composer`: https://getcomposer.org/download/ diff --git a/messenger.rst b/messenger.rst index 5d620fde6a4..bdd74c4750a 100644 --- a/messenger.rst +++ b/messenger.rst @@ -2381,7 +2381,7 @@ will not be rolled back. If ``WhenUserRegisteredThenSendWelcomeEmail`` throws an exception, that exception will be wrapped into a ``DelayedMessageHandlingException``. Using - ``DelayedMessageHandlingException::getExceptions`` will give you all + ``DelayedMessageHandlingException::getWrappedExceptions`` will give you all exceptions that are thrown while handling a message with the ``DispatchAfterCurrentBusStamp``. From 436f69e60f3177827ffb162bd48824433dd2acc5 Mon Sep 17 00:00:00 2001 From: Thomas Durand Date: Thu, 14 Dec 2023 15:41:19 +0100 Subject: [PATCH 093/477] [HttpClient] Add `HttpOptions::addHeader` method --- http_client.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/http_client.rst b/http_client.rst index 2ca591a5098..b76c8e25199 100644 --- a/http_client.rst +++ b/http_client.rst @@ -150,10 +150,17 @@ brings most of the available options with type-hinted getters and setters:: $this->client = $client->withOptions( (new HttpOptions()) ->setBaseUri('https://...') + // setHeaders() replaces *all* headers at once, and deletes the headers you do not provide ->setHeaders(['header-name' => 'header-value']) + // add or replace a single header using addHeader() + ->addHeader('another-header-name', 'another-header-value') ->toArray() ); +.. versionadded:: 7.1 + + The :method:`Symfony\\Component\\HttpClient\\HttpOptions::addHeader` method was introduced in Symfony 7.1. + Some options are described in this guide: * `Authentication`_ From e9c7ec718bd2842d30d8886880a2ad43229dc767 Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Tue, 26 Dec 2023 21:54:15 +0100 Subject: [PATCH 094/477] - --- http_client.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/http_client.rst b/http_client.rst index dc316fb09dc..09c8aaa28b6 100644 --- a/http_client.rst +++ b/http_client.rst @@ -150,7 +150,7 @@ brings most of the available options with type-hinted getters and setters:: $this->client = $client->withOptions( (new HttpOptions()) ->setBaseUri('https://...') - // setHeaders() replaces *all* headers at once, and deletes the headers you do not provide + // replaces *all* headers at once, and deletes the headers you do not provide ->setHeaders(['header-name' => 'header-value']) // add or replace a single header using addHeader() ->addHeader('another-header-name', 'another-header-value') @@ -159,7 +159,8 @@ brings most of the available options with type-hinted getters and setters:: .. versionadded:: 7.1 - The :method:`Symfony\\Component\\HttpClient\\HttpOptions::addHeader` method was introduced in Symfony 7.1. + The :method:`Symfony\\Component\\HttpClient\\HttpOptions::addHeader` + method was introduced in Symfony 7.1. Some options are described in this guide: From fc23fa3625a421d0710638ec493e7c4e8c81ef34 Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Tue, 26 Dec 2023 21:59:30 +0100 Subject: [PATCH 095/477] Add missing link --- notifier.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/notifier.rst b/notifier.rst index c58c777887e..e68ca298bda 100644 --- a/notifier.rst +++ b/notifier.rst @@ -1002,6 +1002,7 @@ is dispatched. Listeners receive a .. _`Slack`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Slack/README.md .. _`Sms77`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Sms77/README.md .. _`SmsBiuras`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/SmsBiuras/README.md +.. _`Smsbox`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Smsbox/README.md .. _`Smsapi`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Smsapi/README.md .. _`Smsc`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Smsc/README.md .. _`SpotHit`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/SpotHit/README.md From 2a8e749d28a630a167a8f86d50b81fa6722c9deb Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Tue, 26 Dec 2023 21:59:55 +0100 Subject: [PATCH 096/477] - --- notifier.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/notifier.rst b/notifier.rst index e68ca298bda..663398a5c0c 100644 --- a/notifier.rst +++ b/notifier.rst @@ -246,7 +246,8 @@ Service Package D .. versionadded:: 7.1 - The ``Bluesky``, ``Unifonic`` and ``Smsbox`` integrations were introduced in Symfony 7.1. + The ``Bluesky``, ``Unifonic`` and ``Smsbox`` integrations + were introduced in Symfony 7.1. Chatters are configured using the ``chatter_transports`` setting: From 35e2703636f49277122c1d158d3c989e930cd6be Mon Sep 17 00:00:00 2001 From: Franklin LIA <46316603+lbbyf@users.noreply.github.com> Date: Mon, 18 Dec 2023 10:51:26 +0100 Subject: [PATCH 097/477] Update routing.rst In Symfony version 7, we don't have a loader for the annotations --- routing.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routing.rst b/routing.rst index 77b035ddd16..941c074cb0d 100644 --- a/routing.rst +++ b/routing.rst @@ -2600,7 +2600,7 @@ same URL, but with the HTTPS scheme. If you want to force a group of routes to use HTTPS, you can define the default scheme when importing them. The following example forces HTTPS on all routes -defined as annotations: +defined as attributes: .. configuration-block:: From bc95bcc4e0df59e662366c9809f636c82a5964a8 Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Wed, 27 Dec 2023 09:45:56 +0100 Subject: [PATCH 098/477] Rename `addHeader` to `setHeader` --- http_client.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/http_client.rst b/http_client.rst index 09c8aaa28b6..1966dfba064 100644 --- a/http_client.rst +++ b/http_client.rst @@ -152,14 +152,14 @@ brings most of the available options with type-hinted getters and setters:: ->setBaseUri('https://...') // replaces *all* headers at once, and deletes the headers you do not provide ->setHeaders(['header-name' => 'header-value']) - // add or replace a single header using addHeader() - ->addHeader('another-header-name', 'another-header-value') + // set or replace a single header using addHeader() + ->setHeader('another-header-name', 'another-header-value') ->toArray() ); .. versionadded:: 7.1 - The :method:`Symfony\\Component\\HttpClient\\HttpOptions::addHeader` + The :method:`Symfony\\Component\\HttpClient\\HttpOptions::setHeader` method was introduced in Symfony 7.1. Some options are described in this guide: From 78703b5aae4a0327c8fc0e5cc290f82e0e679530 Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Wed, 27 Dec 2023 11:29:37 +0100 Subject: [PATCH 099/477] [Validator] Add `Charset` constraint --- reference/constraints/Charset.rst | 112 ++++++++++++++++++++++++++++++ reference/constraints/map.rst.inc | 1 + 2 files changed, 113 insertions(+) create mode 100644 reference/constraints/Charset.rst diff --git a/reference/constraints/Charset.rst b/reference/constraints/Charset.rst new file mode 100644 index 00000000000..6f8592fa5e1 --- /dev/null +++ b/reference/constraints/Charset.rst @@ -0,0 +1,112 @@ +Charset +======= + +.. versionadded:: 7.1 + + The ``Charset`` constraint was introduced in Symfony 7.1. + +Validates that a string is encoded in a given charset. + +========== ===================================================================== +Applies to :ref:`property or method ` +Class :class:`Symfony\\Component\\Validator\\Constraints\\Charset` +Validator :class:`Symfony\\Component\\Validator\\Constraints\\CharsetValidator` +========== ===================================================================== + +Basic Usage +----------- + +If you wanted to ensure that the ``content`` property of an ``FileDTO`` +class uses UTF-8, you could do the following: + +.. configuration-block:: + + .. code-block:: php-attributes + + // src/Entity/FileDTO.php + namespace App\Entity; + + use Symfony\Component\Validator\Constraints as Assert; + + class FileDTO + { + #[Assert\Charset('UTF-8')] + protected string $content; + } + + .. code-block:: yaml + + # config/validator/validation.yaml + App\Entity\FileDTO: + properties: + content: + - Charset: 'UTF-8' + + .. code-block:: xml + + + + + + + + + + + + + + + .. code-block:: php + + // src/Entity/FileDTO.php + namespace App\Entity; + + use Symfony\Component\Validator\Constraints as Assert; + use Symfony\Component\Validator\Mapping\ClassMetadata; + + class FileDTO + { + // ... + + public static function loadValidatorMetadata(ClassMetadata $metadata): void + { + $metadata->addPropertyConstraint('content', new Assert\Charset('UTF-8')); + } + } + +Options +------- + +``encodings`` +~~~~~~~~~~~~~ + +**type**: ``array`` | ``string`` **default**: ``[]`` + +An encoding or a set of encodings to check against. If you pass an array of +encodings, the validator will check if the value is encoded in *any* of the +encodings. This option accept any value that can be passed to +:phpfunction:`mb_detect_encoding()`. + +.. include:: /reference/constraints/_groups-option.rst.inc + +``message`` +~~~~~~~~~~~ + +**type**: ``string`` **default**: ``The detected encoding "{{ detected }}" does not match one of the accepted encoding: "{{ encodings }}".`` + +This is the message that will be shown if the value does not match any of the +accepted encodings. + +You can use the following parameters in this message: + +=================== ============================================================== +Parameter Description +=================== ============================================================== +``{{ detected }}`` The detected encoding +``{{ encodings }}`` The accepted encodings +=================== ============================================================== + +.. include:: /reference/constraints/_payload-option.rst.inc diff --git a/reference/constraints/map.rst.inc b/reference/constraints/map.rst.inc index 2fa03ac9a3e..a9692062d28 100644 --- a/reference/constraints/map.rst.inc +++ b/reference/constraints/map.rst.inc @@ -31,6 +31,7 @@ String Constraints * :doc:`PasswordStrength ` * :doc:`CssColor ` * :doc:`NoSuspiciousCharacters ` +* :doc:`Charset ` Comparison Constraints ~~~~~~~~~~~~~~~~~~~~~~ From 17663e273ec9b29b3ad42e50ea9c5a35d8ab1c30 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Thu, 28 Dec 2023 00:12:25 +0100 Subject: [PATCH 100/477] fix typos --- reference/constraints/Charset.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/reference/constraints/Charset.rst b/reference/constraints/Charset.rst index 6f8592fa5e1..5dfa7037c6b 100644 --- a/reference/constraints/Charset.rst +++ b/reference/constraints/Charset.rst @@ -16,7 +16,7 @@ Validator :class:`Symfony\\Component\\Validator\\Constraints\\CharsetValidator Basic Usage ----------- -If you wanted to ensure that the ``content`` property of an ``FileDTO`` +If you wanted to ensure that the ``content`` property of a ``FileDTO`` class uses UTF-8, you could do the following: .. configuration-block:: @@ -87,7 +87,7 @@ Options An encoding or a set of encodings to check against. If you pass an array of encodings, the validator will check if the value is encoded in *any* of the -encodings. This option accept any value that can be passed to +encodings. This option accepts any value that can be passed to :phpfunction:`mb_detect_encoding()`. .. include:: /reference/constraints/_groups-option.rst.inc From 951328319aaf384ae93e2091a7c5dd7bb00fdfaa Mon Sep 17 00:00:00 2001 From: Dennis Fridrich Date: Sun, 10 Dec 2023 14:57:22 +0100 Subject: [PATCH 101/477] [Notifier] Add docs of sms-sluzba.cz bridge --- notifier.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/notifier.rst b/notifier.rst index 663398a5c0c..23d6c300216 100644 --- a/notifier.rst +++ b/notifier.rst @@ -88,6 +88,7 @@ Service Package DSN `RingCentral`_ ``symfony/ring-central-notifier`` ``ringcentral://API_TOKEN@default?from=FROM`` `Sendberry`_ ``symfony/sendberry-notifier`` ``sendberry://USERNAME:PASSWORD@default?auth_key=AUTH_KEY&from=FROM`` `Sms77`_ ``symfony/sms77-notifier`` ``sms77://API_KEY@default?from=FROM`` +`SmsSluzba`_ ``symfony/sms-sluzba-notifier`` ``sms-sluzba://USERNAME:PASSWORD@default`` `SimpleTextin`_ ``symfony/simple-textin-notifier`` ``simpletextin://API_KEY@default?from=FROM`` `Sinch`_ ``symfony/sinch-notifier`` ``sinch://ACCOUNT_ID:AUTH_TOKEN@default?from=FROM`` `Smsapi`_ ``symfony/smsapi-notifier`` ``smsapi://TOKEN@default?from=FROM`` @@ -110,6 +111,10 @@ Service Package DSN via webhooks. See the :doc:`Webhook documentation ` for more details. +.. versionadded:: 7.1 + + The `SmsSluzba`_ integration was introduced in Symfony 7.1. + To enable a texter, add the correct DSN in your ``.env`` file and configure the ``texter_transports``: @@ -1006,6 +1011,7 @@ is dispatched. Listeners receive a .. _`Smsbox`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Smsbox/README.md .. _`Smsapi`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Smsapi/README.md .. _`Smsc`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Smsc/README.md +.. _`SmsSluzba`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/SmsSluzba/README.md .. _`SpotHit`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/SpotHit/README.md .. _`Telegram`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Telegram/README.md .. _`Telnyx`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Telnyx/README.md From b995787767e2f356afea15b774904dc93a32f727 Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Thu, 28 Dec 2023 21:57:15 +0100 Subject: [PATCH 102/477] - --- notifier.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/notifier.rst b/notifier.rst index 23d6c300216..c8aa863413d 100644 --- a/notifier.rst +++ b/notifier.rst @@ -72,7 +72,6 @@ Service Package DSN `GoIP`_ ``symfony/goip-notifier`` ``goip://USERNAME:PASSWORD@HOST:80?sim_slot=SIM_SLOT`` `Infobip`_ ``symfony/infobip-notifier`` ``infobip://AUTH_TOKEN@HOST?from=FROM`` `Iqsms`_ ``symfony/iqsms-notifier`` ``iqsms://LOGIN:PASSWORD@default?from=FROM`` -`iSendPro`_ ``symfony/isendpro-notifier`` ``isendpro://ACCOUNT_KEY_ID@default?from=FROM&no_stop=NO_STOP&sandbox=SANDBOX`` `KazInfoTeh`_ ``symfony/kaz-info-teh-notifier`` ``kaz-info-teh://USERNAME:PASSWORD@default?sender=FROM`` `LightSms`_ ``symfony/light-sms-notifier`` ``lightsms://LOGIN:TOKEN@default?from=PHONE`` `Mailjet`_ ``symfony/mailjet-notifier`` ``mailjet://TOKEN@default?from=FROM`` @@ -86,16 +85,16 @@ Service Package DSN `Plivo`_ ``symfony/plivo-notifier`` ``plivo://AUTH_ID:AUTH_TOKEN@default?from=FROM`` `Redlink`_ ``symfony/redlink-notifier`` ``redlink://API_KEY:APP_KEY@default?from=SENDER_NAME&version=API_VERSION`` `RingCentral`_ ``symfony/ring-central-notifier`` ``ringcentral://API_TOKEN@default?from=FROM`` +`SMSFactor`_ ``symfony/sms-factor-notifier`` ``sms-factor://TOKEN@default?sender=SENDER&push_type=PUSH_TYPE`` `Sendberry`_ ``symfony/sendberry-notifier`` ``sendberry://USERNAME:PASSWORD@default?auth_key=AUTH_KEY&from=FROM`` -`Sms77`_ ``symfony/sms77-notifier`` ``sms77://API_KEY@default?from=FROM`` -`SmsSluzba`_ ``symfony/sms-sluzba-notifier`` ``sms-sluzba://USERNAME:PASSWORD@default`` `SimpleTextin`_ ``symfony/simple-textin-notifier`` ``simpletextin://API_KEY@default?from=FROM`` `Sinch`_ ``symfony/sinch-notifier`` ``sinch://ACCOUNT_ID:AUTH_TOKEN@default?from=FROM`` -`Smsapi`_ ``symfony/smsapi-notifier`` ``smsapi://TOKEN@default?from=FROM`` +`Sms77`_ ``symfony/sms77-notifier`` ``sms77://API_KEY@default?from=FROM`` `SmsBiuras`_ ``symfony/sms-biuras-notifier`` ``smsbiuras://UID:API_KEY@default?from=FROM&test_mode=0`` +`SmsSluzba`_ ``symfony/sms-sluzba-notifier`` ``sms-sluzba://USERNAME:PASSWORD@default`` +`Smsapi`_ ``symfony/smsapi-notifier`` ``smsapi://TOKEN@default?from=FROM`` `Smsbox`_ ``symfony/smsbox-notifier`` ``smsbox://APIKEY@default?mode=MODE&strategy=STRATEGY&sender=SENDER`` `Smsc`_ ``symfony/smsc-notifier`` ``smsc://LOGIN:PASSWORD@default?from=FROM`` -`SMSFactor`_ ``symfony/sms-factor-notifier`` ``sms-factor://TOKEN@default?sender=SENDER&push_type=PUSH_TYPE`` `SpotHit`_ ``symfony/spot-hit-notifier`` ``spothit://TOKEN@default?from=FROM`` `Telnyx`_ ``symfony/telnyx-notifier`` ``telnyx://API_KEY@default?from=FROM&messaging_profile_id=MESSAGING_PROFILE_ID`` `TurboSms`_ ``symfony/turbo-sms-notifier`` ``turbosms://AUTH_TOKEN@default?from=FROM`` @@ -103,6 +102,7 @@ Service Package DSN `Unifonic`_ ``symfony/unifonic-notifier`` ``unifonic://APP_SID@default?from=FROM`` `Vonage`_ ``symfony/vonage-notifier`` ``vonage://KEY:SECRET@default?from=FROM`` yes `Yunpian`_ ``symfony/yunpian-notifier`` ``yunpian://APIKEY@default`` +`iSendPro`_ ``symfony/isendpro-notifier`` ``isendpro://ACCOUNT_KEY_ID@default?from=FROM&no_stop=NO_STOP&sandbox=SANDBOX`` ================== ===================================== ========================================================================================================================= =============== .. tip:: From 3f638192d8b781335c0d4b1165277c72eb51cd27 Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Thu, 28 Dec 2023 21:57:15 +0100 Subject: [PATCH 103/477] - --- notifier.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/notifier.rst b/notifier.rst index 23d6c300216..c8aa863413d 100644 --- a/notifier.rst +++ b/notifier.rst @@ -72,7 +72,6 @@ Service Package DSN `GoIP`_ ``symfony/goip-notifier`` ``goip://USERNAME:PASSWORD@HOST:80?sim_slot=SIM_SLOT`` `Infobip`_ ``symfony/infobip-notifier`` ``infobip://AUTH_TOKEN@HOST?from=FROM`` `Iqsms`_ ``symfony/iqsms-notifier`` ``iqsms://LOGIN:PASSWORD@default?from=FROM`` -`iSendPro`_ ``symfony/isendpro-notifier`` ``isendpro://ACCOUNT_KEY_ID@default?from=FROM&no_stop=NO_STOP&sandbox=SANDBOX`` `KazInfoTeh`_ ``symfony/kaz-info-teh-notifier`` ``kaz-info-teh://USERNAME:PASSWORD@default?sender=FROM`` `LightSms`_ ``symfony/light-sms-notifier`` ``lightsms://LOGIN:TOKEN@default?from=PHONE`` `Mailjet`_ ``symfony/mailjet-notifier`` ``mailjet://TOKEN@default?from=FROM`` @@ -86,16 +85,16 @@ Service Package DSN `Plivo`_ ``symfony/plivo-notifier`` ``plivo://AUTH_ID:AUTH_TOKEN@default?from=FROM`` `Redlink`_ ``symfony/redlink-notifier`` ``redlink://API_KEY:APP_KEY@default?from=SENDER_NAME&version=API_VERSION`` `RingCentral`_ ``symfony/ring-central-notifier`` ``ringcentral://API_TOKEN@default?from=FROM`` +`SMSFactor`_ ``symfony/sms-factor-notifier`` ``sms-factor://TOKEN@default?sender=SENDER&push_type=PUSH_TYPE`` `Sendberry`_ ``symfony/sendberry-notifier`` ``sendberry://USERNAME:PASSWORD@default?auth_key=AUTH_KEY&from=FROM`` -`Sms77`_ ``symfony/sms77-notifier`` ``sms77://API_KEY@default?from=FROM`` -`SmsSluzba`_ ``symfony/sms-sluzba-notifier`` ``sms-sluzba://USERNAME:PASSWORD@default`` `SimpleTextin`_ ``symfony/simple-textin-notifier`` ``simpletextin://API_KEY@default?from=FROM`` `Sinch`_ ``symfony/sinch-notifier`` ``sinch://ACCOUNT_ID:AUTH_TOKEN@default?from=FROM`` -`Smsapi`_ ``symfony/smsapi-notifier`` ``smsapi://TOKEN@default?from=FROM`` +`Sms77`_ ``symfony/sms77-notifier`` ``sms77://API_KEY@default?from=FROM`` `SmsBiuras`_ ``symfony/sms-biuras-notifier`` ``smsbiuras://UID:API_KEY@default?from=FROM&test_mode=0`` +`SmsSluzba`_ ``symfony/sms-sluzba-notifier`` ``sms-sluzba://USERNAME:PASSWORD@default`` +`Smsapi`_ ``symfony/smsapi-notifier`` ``smsapi://TOKEN@default?from=FROM`` `Smsbox`_ ``symfony/smsbox-notifier`` ``smsbox://APIKEY@default?mode=MODE&strategy=STRATEGY&sender=SENDER`` `Smsc`_ ``symfony/smsc-notifier`` ``smsc://LOGIN:PASSWORD@default?from=FROM`` -`SMSFactor`_ ``symfony/sms-factor-notifier`` ``sms-factor://TOKEN@default?sender=SENDER&push_type=PUSH_TYPE`` `SpotHit`_ ``symfony/spot-hit-notifier`` ``spothit://TOKEN@default?from=FROM`` `Telnyx`_ ``symfony/telnyx-notifier`` ``telnyx://API_KEY@default?from=FROM&messaging_profile_id=MESSAGING_PROFILE_ID`` `TurboSms`_ ``symfony/turbo-sms-notifier`` ``turbosms://AUTH_TOKEN@default?from=FROM`` @@ -103,6 +102,7 @@ Service Package DSN `Unifonic`_ ``symfony/unifonic-notifier`` ``unifonic://APP_SID@default?from=FROM`` `Vonage`_ ``symfony/vonage-notifier`` ``vonage://KEY:SECRET@default?from=FROM`` yes `Yunpian`_ ``symfony/yunpian-notifier`` ``yunpian://APIKEY@default`` +`iSendPro`_ ``symfony/isendpro-notifier`` ``isendpro://ACCOUNT_KEY_ID@default?from=FROM&no_stop=NO_STOP&sandbox=SANDBOX`` ================== ===================================== ========================================================================================================================= =============== .. tip:: From d289bcb3d8190d090057cbe2ee000ec4e36c7d0b Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Thu, 28 Dec 2023 22:14:04 +0100 Subject: [PATCH 104/477] [Notifier] Add Seven.io bridge --- notifier.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/notifier.rst b/notifier.rst index c8aa863413d..434b783b747 100644 --- a/notifier.rst +++ b/notifier.rst @@ -87,6 +87,7 @@ Service Package DSN `RingCentral`_ ``symfony/ring-central-notifier`` ``ringcentral://API_TOKEN@default?from=FROM`` `SMSFactor`_ ``symfony/sms-factor-notifier`` ``sms-factor://TOKEN@default?sender=SENDER&push_type=PUSH_TYPE`` `Sendberry`_ ``symfony/sendberry-notifier`` ``sendberry://USERNAME:PASSWORD@default?auth_key=AUTH_KEY&from=FROM`` +`Seven.io`_ ``symfony/sevenio-notifier`` ``sevenio://API_KEY@default?from=FROM`` `SimpleTextin`_ ``symfony/simple-textin-notifier`` ``simpletextin://API_KEY@default?from=FROM`` `Sinch`_ ``symfony/sinch-notifier`` ``sinch://ACCOUNT_ID:AUTH_TOKEN@default?from=FROM`` `Sms77`_ ``symfony/sms77-notifier`` ``sms77://API_KEY@default?from=FROM`` @@ -115,6 +116,11 @@ Service Package DSN The `SmsSluzba`_ integration was introduced in Symfony 7.1. +.. deprecated:: 7.1 + + The `Sms77`_ integration is deprecated since + Symfony 7.1, use the `Seven.io`_ integration instead. + To enable a texter, add the correct DSN in your ``.env`` file and configure the ``texter_transports``: @@ -1003,6 +1009,7 @@ is dispatched. Listeners receive a .. _`RocketChat`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/RocketChat/README.md .. _`SMSFactor`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/SmsFactor/README.md .. _`Sendberry`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Sendberry/README.md +.. _`Seven.io`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Sevenio/README.md .. _`SimpleTextin`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/SimpleTextin/README.md .. _`Sinch`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Sinch/README.md .. _`Slack`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Slack/README.md From 420bf581e50dd273feebaf2fdbed523e744f387f Mon Sep 17 00:00:00 2001 From: Priyadi Iman Nurcahyo Date: Wed, 27 Dec 2023 20:21:30 +0700 Subject: [PATCH 105/477] Document `#[WithHttpStatus]` and `#[WithLogLevel]` on interfaces. --- reference/configuration/framework.rst | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/reference/configuration/framework.rst b/reference/configuration/framework.rst index 894cf7a82c5..2e82f352af0 100644 --- a/reference/configuration/framework.rst +++ b/reference/configuration/framework.rst @@ -3806,6 +3806,26 @@ the ``#[WithLogLevel]`` attribute:: { } +The attributes can also be added to interfaces directly:: + + namespace App\Exception; + + use Symfony\Component\HttpKernel\Attribute\WithHttpStatus; + + #[WithHttpStatus(422)] + interface CustomExceptionInterface + { + } + + class CustomException extends \Exception implements CustomExceptionInterface + { + } + +.. versionadded:: 7.1 + + Support to use ``#[WithHttpStatus]`` and ``#[WithLogLevel]`` attributes + on interfaces, was introduced in Symfony 7.1. + .. _`HTTP Host header attacks`: https://www.skeletonscribe.net/2013/05/practical-http-host-header-attacks.html .. _`Security Advisory Blog post`: https://symfony.com/blog/security-releases-symfony-2-0-24-2-1-12-2-2-5-and-2-3-3-released#cve-2013-4752-request-gethost-poisoning .. _`phpstorm-url-handler`: https://github.com/sanduhrs/phpstorm-url-handler From 6a36a2217e22215deba87ff0a8c405e060516cb6 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Fri, 29 Dec 2023 08:46:14 +0100 Subject: [PATCH 106/477] [Validator] Mention support of Stringable objects in Charset constraint --- reference/constraints/Charset.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/reference/constraints/Charset.rst b/reference/constraints/Charset.rst index 5dfa7037c6b..66bdb4c99c4 100644 --- a/reference/constraints/Charset.rst +++ b/reference/constraints/Charset.rst @@ -5,7 +5,8 @@ Charset The ``Charset`` constraint was introduced in Symfony 7.1. -Validates that a string is encoded in a given charset. +Validates that a string (or an object implementing the ``Stringable`` PHP interface) +is encoded in a given charset. ========== ===================================================================== Applies to :ref:`property or method ` From cf4d72446c92c2049a16b6a147abe856f627003d Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Sat, 30 Dec 2023 09:21:13 +0100 Subject: [PATCH 107/477] update the default message of the Charset constraint --- reference/constraints/Charset.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reference/constraints/Charset.rst b/reference/constraints/Charset.rst index 66bdb4c99c4..278ea570831 100644 --- a/reference/constraints/Charset.rst +++ b/reference/constraints/Charset.rst @@ -96,7 +96,7 @@ encodings. This option accepts any value that can be passed to ``message`` ~~~~~~~~~~~ -**type**: ``string`` **default**: ``The detected encoding "{{ detected }}" does not match one of the accepted encoding: "{{ encodings }}".`` +**type**: ``string`` **default**: ``The detected character encoding is invalid ({{ detected }}). Allowed encodings are {{ encodings }}.`` This is the message that will be shown if the value does not match any of the accepted encodings. From 09675098c807f8fbbf8be96565d1d2e2e474dcfc Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Sat, 30 Dec 2023 22:50:58 +0100 Subject: [PATCH 108/477] Update framework config --- reference/configuration/framework.rst | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/reference/configuration/framework.rst b/reference/configuration/framework.rst index 894cf7a82c5..50bfc03530b 100644 --- a/reference/configuration/framework.rst +++ b/reference/configuration/framework.rst @@ -53,13 +53,11 @@ out all the application users. handle_all_throwables ~~~~~~~~~~~~~~~~~~~~~ -**type**: ``boolean`` **default**: ``false`` +**type**: ``boolean`` **default**: ``true`` -If set to ``true``, the Symfony kernel will catch all ``\Throwable`` exceptions +When set to ``true``, the Symfony kernel will catch all ``\Throwable`` exceptions thrown by the application and will turn them into HTTP responses. -Starting from Symfony 7.0, the default value of this option will be ``true``. - .. _configuration-framework-http_cache: http_cache @@ -1575,11 +1573,13 @@ To see a list of all available storages, run: handler_id .......... -**type**: ``string`` **default**: ``session.handler.native_file`` +**type**: ``string`` | ``null`` **default**: ``null`` + +By default at ``null`` if ``framework.session.save_path`` is not set. +The session handler configured by php.ini is used, unless option +``framework.session.save_path`` is used, in which case the default is to store sessions +using the native file session handler. -The service id or DSN used for session storage. The default value ``'session.handler.native_file'`` -will let Symfony manage the sessions itself using files to store the session metadata. -Set it to ``null`` to use the native PHP session mechanism. It is possible to :ref:`store sessions in a database `, and also to configure the session handler with a DSN: @@ -1844,7 +1844,7 @@ If not set, ``php.ini``'s `session.sid_bits_per_character`_ directive will be re save_path ......... -**type**: ``string`` or ``null`` **default**: ``%kernel.cache_dir%/sessions`` +**type**: ``string`` | ``null`` **default**: ``%kernel.cache_dir%/sessions`` This determines the argument to be passed to the save handler. If you choose the default file handler, this is the path where the session files are created. @@ -2940,7 +2940,7 @@ php_errors log ... -**type**: ``boolean|int`` **default**: ``%kernel.debug%`` +**type**: ``boolean`` | ``int`` **default**: ``true`` Use the application logger instead of the PHP logger for logging PHP errors. When an integer value is used, it also sets the log level. Those integer From d271d42221180b45bbf01dfadc5293ac17638033 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Mon, 1 Jan 2024 12:57:07 +0100 Subject: [PATCH 109/477] fix typo --- reference/configuration/framework.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reference/configuration/framework.rst b/reference/configuration/framework.rst index ee22e85f7e8..c8686c3d7bb 100644 --- a/reference/configuration/framework.rst +++ b/reference/configuration/framework.rst @@ -3824,7 +3824,7 @@ The attributes can also be added to interfaces directly:: .. versionadded:: 7.1 Support to use ``#[WithHttpStatus]`` and ``#[WithLogLevel]`` attributes - on interfaces, was introduced in Symfony 7.1. + on interfaces was introduced in Symfony 7.1. .. _`HTTP Host header attacks`: https://www.skeletonscribe.net/2013/05/practical-http-host-header-attacks.html .. _`Security Advisory Blog post`: https://symfony.com/blog/security-releases-symfony-2-0-24-2-1-12-2-2-5-and-2-3-3-released#cve-2013-4752-request-gethost-poisoning From 80fa0a34618d2480e6b3acce32977ea4ff143e89 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Tue, 2 Jan 2024 09:27:16 +0100 Subject: [PATCH 110/477] Minor reword --- reference/configuration/framework.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/reference/configuration/framework.rst b/reference/configuration/framework.rst index a0650093bb5..f5f5f8df3f9 100644 --- a/reference/configuration/framework.rst +++ b/reference/configuration/framework.rst @@ -1575,10 +1575,10 @@ handler_id **type**: ``string`` | ``null`` **default**: ``null`` -By default at ``null`` if ``framework.session.save_path`` is not set. -The session handler configured by php.ini is used, unless option -``framework.session.save_path`` is used, in which case the default is to store sessions -using the native file session handler. +If ``framework.session.save_path`` is not set, the default value of this option +is ``null``, which means to use the session handler configured in php.ini. If the +``framework.session.save_path`` option is set, then Symfony stores sessions using +the native file session handler. It is possible to :ref:`store sessions in a database `, and also to configure the session handler with a DSN: From 6b319a22eab53a36e291ef9096537abd617a7d28 Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Tue, 2 Jan 2024 09:20:17 +0100 Subject: [PATCH 111/477] [Uid] Add `UuidV1::toV6()`, `UuidV1::toV7()` and `UuidV6::toV7()` --- components/uid.rst | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/components/uid.rst b/components/uid.rst index 26fd32989a9..96dda1e149d 100644 --- a/components/uid.rst +++ b/components/uid.rst @@ -180,6 +180,26 @@ Use these methods to transform the UUID object into different bases:: $uuid->toRfc4122(); // string(36) "d9e7a184-5d5b-11ea-a62a-3499710062d0" $uuid->toHex(); // string(34) "0xd9e7a1845d5b11eaa62a3499710062d0" +Some UUID versions support being converted from one version to another:: + + // convert V1 to V6 or V7 + $uuid = Uuid::v1(); + + $uuid->toV6(); // returns a Symfony\Component\Uid\UuidV6 instance + $uuid->toV7(); // returns a Symfony\Component\Uid\UuidV7 instance + + // convert V6 to V7 + $uuid = Uuid::v6(); + + $uuid->toV7(); // returns a Symfony\Component\Uid\UuidV7 instance + +.. versionadded:: 7.1 + + The :method:`Symfony\\Component\\Uid\\UuidV1::toV6`, + :method:`Symfony\\Component\\Uid\\UuidV1::toV7` and + :method:`Symfony\\Component\\Uid\\UuidV6::toV7` + methods were introduced in Symfony 7.1. + Working with UUIDs ~~~~~~~~~~~~~~~~~~ From 50a296fc648774e3cab0c60331f664727424fcb7 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Tue, 2 Jan 2024 11:24:51 +0100 Subject: [PATCH 112/477] Minor tweak --- components/uid.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/uid.rst b/components/uid.rst index 96dda1e149d..6e69e36a610 100644 --- a/components/uid.rst +++ b/components/uid.rst @@ -180,7 +180,7 @@ Use these methods to transform the UUID object into different bases:: $uuid->toRfc4122(); // string(36) "d9e7a184-5d5b-11ea-a62a-3499710062d0" $uuid->toHex(); // string(34) "0xd9e7a1845d5b11eaa62a3499710062d0" -Some UUID versions support being converted from one version to another:: +You can also convert some UUID versions to others:: // convert V1 to V6 or V7 $uuid = Uuid::v1(); From c9ff43ee840cfdea207b315a83c44f35ce221961 Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Wed, 3 Jan 2024 09:06:43 +0100 Subject: [PATCH 113/477] [Dotenv] Add `SYMFONY_DOTENV_PATH` --- configuration.rst | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/configuration.rst b/configuration.rst index 5ab7d5e2c27..4efc7d73bd9 100644 --- a/configuration.rst +++ b/configuration.rst @@ -932,6 +932,28 @@ get the environment variables and will not spend time parsing the ``.env`` files Update your deployment tools/workflow to run the ``dotenv:dump`` command after each deploy to improve the application performance. +Store Environment Variables In Another File +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +By default, the environment variables are stored in the ``.env`` file located +at the root of your project. However, you can store them in another file by +setting the ``SYMFONY_DOTENV_PATH`` environment variable to the path and +filename of the file where the environment variables are stored. Symfony will +then look for the environment variables in that file, but also in the local +and environment-specific files (e.g. ``.*.local`` and +``.*..local``). You can find more information about this +in the :ref:`dedicated section `. + +Because this environment variable is used to find the files where you +application environment variable are store, it must be defined at the +system level (e.g. in your web server configuration) and not in the +``.env`` files. + +.. versionadded:: 7.1 + + The support for the ``SYMFONY_DOTENV_PATH`` environment variable was + introduced in Symfony 7.1. + .. _configuration-secrets: Encrypting Environment Variables (Secrets) From e926d7cec47260fc30d8edb5d9fd659c43810b58 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 3 Jan 2024 17:58:46 +0100 Subject: [PATCH 114/477] Minor reword --- configuration.rst | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/configuration.rst b/configuration.rst index 2d02d77c771..078ec57b49f 100644 --- a/configuration.rst +++ b/configuration.rst @@ -932,27 +932,29 @@ get the environment variables and will not spend time parsing the ``.env`` files Update your deployment tools/workflow to run the ``dotenv:dump`` command after each deploy to improve the application performance. -Store Environment Variables In Another File -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Storing Environment Variables In Other Files +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ By default, the environment variables are stored in the ``.env`` file located -at the root of your project. However, you can store them in another file by -setting the ``SYMFONY_DOTENV_PATH`` environment variable to the path and -filename of the file where the environment variables are stored. Symfony will -then look for the environment variables in that file, but also in the local -and environment-specific files (e.g. ``.*.local`` and -``.*..local``). You can find more information about this -in the :ref:`dedicated section `. - -Because this environment variable is used to find the files where you -application environment variable are store, it must be defined at the -system level (e.g. in your web server configuration) and not in the -``.env`` files. +at the root of your project. However, you can store them in other file by +setting the ``SYMFONY_DOTENV_PATH`` environment variable to the absolute path of +that custom file. + +Symfony will then look for the environment variables in that file, but also in +the local and environment-specific files (e.g. ``.*.local`` and +``.*..local``). Read +:ref:`how to override environment variables ` +to learn more about this. + +.. caution:: + + The ``SYMFONY_DOTENV_PATH`` environment variable must be defined at the + system level (e.g. in your web server configuration) and not in any default + or custom ``.env`` file. .. versionadded:: 7.1 - The support for the ``SYMFONY_DOTENV_PATH`` environment variable was - introduced in Symfony 7.1. + The ``SYMFONY_DOTENV_PATH`` environment variable was introduced in Symfony 7.1. .. _configuration-secrets: From 597a0886e03b9a68560aa82e76465e1c6acfc444 Mon Sep 17 00:00:00 2001 From: Antoine Lamirault Date: Sat, 6 Jan 2024 12:12:41 +0100 Subject: [PATCH 115/477] [Validator] Add constraint --- reference/constraints/MacAddress.rst | 104 +++++++++++++++++++++++++++ reference/constraints/map.rst.inc | 1 + 2 files changed, 105 insertions(+) create mode 100644 reference/constraints/MacAddress.rst diff --git a/reference/constraints/MacAddress.rst b/reference/constraints/MacAddress.rst new file mode 100644 index 00000000000..e13420bd832 --- /dev/null +++ b/reference/constraints/MacAddress.rst @@ -0,0 +1,104 @@ +MacAddress +========== + +.. versionadded:: 7.1 + + The ``MacAddress`` constraint was introduced in Symfony 7.1. + +This constraint ensures that the given value is a valid MAC address (internally it +uses the ``FILTER_VALIDATE_MAC`` option of the :phpfunction:`filter_var` PHP +function). + +========== ===================================================================== +Applies to :ref:`property or method ` +Class :class:`Symfony\\Component\\Validator\\Constraints\\MacAddress` +Validator :class:`Symfony\\Component\\Validator\\Constraints\\MacAddressValidator` +========== ===================================================================== + +Basic Usage +----------- + +To use the MacAddress validator, apply it to a property on an object that +will contain a host name. + +.. configuration-block:: + + .. code-block:: php-attributes + + // src/Entity/Author.php + namespace App\Entity; + + use Symfony\Component\Validator\Constraints as Assert; + + class Author + { + #[Assert\MacAddress] + protected string $mac; + } + + .. code-block:: yaml + + # config/validator/validation.yaml + App\Entity\Author: + properties: + mac: + - MacAddress: ~ + + .. code-block:: xml + + + + + + + + + + + + + .. code-block:: php + + // src/Entity/Author.php + namespace App\Entity; + + use Symfony\Component\Validator\Constraints as Assert; + use Symfony\Component\Validator\Mapping\ClassMetadata; + + class Author + { + // ... + + public static function loadValidatorMetadata(ClassMetadata $metadata): void + { + $metadata->addPropertyConstraint('mac', new Assert\MacAddress()); + } + } + +.. include:: /reference/constraints/_empty-values-are-valid.rst.inc + +Options +------- + +.. include:: /reference/constraints/_groups-option.rst.inc + +``message`` +~~~~~~~~~~~ + +**type**: ``string`` **default**: ``This is not a valid MAC address.`` + +This is the message that will be shown if the value is not a valid MAC address. + +You can use the following parameters in this message: + +=============== ============================================================== +Parameter Description +=============== ============================================================== +``{{ value }}`` The current (invalid) value +=============== ============================================================== + +.. include:: /reference/constraints/_normalizer-option.rst.inc + +.. include:: /reference/constraints/_payload-option.rst.inc diff --git a/reference/constraints/map.rst.inc b/reference/constraints/map.rst.inc index a9692062d28..690e98c6bf9 100644 --- a/reference/constraints/map.rst.inc +++ b/reference/constraints/map.rst.inc @@ -32,6 +32,7 @@ String Constraints * :doc:`CssColor ` * :doc:`NoSuspiciousCharacters ` * :doc:`Charset ` +* :doc:`MacAddress ` Comparison Constraints ~~~~~~~~~~~~~~~~~~~~~~ From c11a4310fcd4c4c2c4e8af4354b4ae594c535478 Mon Sep 17 00:00:00 2001 From: Antoine Lamirault Date: Sat, 6 Jan 2024 12:48:46 +0100 Subject: [PATCH 116/477] [Uid] Add AbstractUid::toString() --- components/uid.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/components/uid.rst b/components/uid.rst index 6e69e36a610..e8f2f599573 100644 --- a/components/uid.rst +++ b/components/uid.rst @@ -179,6 +179,11 @@ Use these methods to transform the UUID object into different bases:: $uuid->toBase58(); // string(22) "TuetYWNHhmuSQ3xPoVLv9M" $uuid->toRfc4122(); // string(36) "d9e7a184-5d5b-11ea-a62a-3499710062d0" $uuid->toHex(); // string(34) "0xd9e7a1845d5b11eaa62a3499710062d0" + $uuid->toString(); // string(36) "d9e7a184-5d5b-11ea-a62a-3499710062d0" + +.. versionadded:: 7.1 + + The ``toString()`` method was introduced in Symfony 7.1. You can also convert some UUID versions to others:: From 0ac3068bb9c905bf0233da835d498c900b2992e4 Mon Sep 17 00:00:00 2001 From: Antoine Lamirault Date: Sat, 6 Jan 2024 12:29:15 +0100 Subject: [PATCH 117/477] [FrameworkBundle] add a private_ranges shortcut for trusted_proxies --- deployment/proxies.rst | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/deployment/proxies.rst b/deployment/proxies.rst index e846f95a808..2ebb1bb6a8f 100644 --- a/deployment/proxies.rst +++ b/deployment/proxies.rst @@ -33,6 +33,8 @@ and what headers your reverse proxy uses to send information: # ... # the IP address (or range) of your proxy trusted_proxies: '192.0.0.1,10.0.0.0/8' + # shortcut for private IP address ranges of your proxy + trusted_proxies: 'private_ranges' # trust *all* "X-Forwarded-*" headers trusted_headers: ['x-forwarded-for', 'x-forwarded-host', 'x-forwarded-proto', 'x-forwarded-port', 'x-forwarded-prefix'] # or, if your proxy instead uses the "Forwarded" header @@ -53,6 +55,8 @@ and what headers your reverse proxy uses to send information: 192.0.0.1,10.0.0.0/8 + + private_ranges x-forwarded-for @@ -75,6 +79,8 @@ and what headers your reverse proxy uses to send information: $framework // the IP address (or range) of your proxy ->trustedProxies('192.0.0.1,10.0.0.0/8') + // shortcut for private IP address ranges of your proxy + ->trustedProxies('private_ranges') // trust *all* "X-Forwarded-*" headers (the ! prefix means to not trust those headers) ->trustedHeaders(['x-forwarded-for', 'x-forwarded-host', 'x-forwarded-proto', 'x-forwarded-port', 'x-forwarded-prefix']) // or, if your proxy instead uses the "Forwarded" header @@ -82,6 +88,11 @@ and what headers your reverse proxy uses to send information: ; }; +.. versionadded:: 7.1 + + ``private_ranges`` as a shortcut for private IP address ranges for the + `trusted_proxies` option was introduced in Symfony 7.1. + .. caution:: Enabling the ``Request::HEADER_X_FORWARDED_HOST`` option exposes the From d6e3cf99d576f5443a5457f3e6b5f348183089f0 Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Sat, 6 Jan 2024 17:45:04 +0100 Subject: [PATCH 118/477] - --- deployment/proxies.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deployment/proxies.rst b/deployment/proxies.rst index 2ebb1bb6a8f..6d2b4e7bd52 100644 --- a/deployment/proxies.rst +++ b/deployment/proxies.rst @@ -91,7 +91,7 @@ and what headers your reverse proxy uses to send information: .. versionadded:: 7.1 ``private_ranges`` as a shortcut for private IP address ranges for the - `trusted_proxies` option was introduced in Symfony 7.1. + ``trusted_proxies`` option was introduced in Symfony 7.1. .. caution:: From a7e57059acc12854419455b457a0cabd4cef7c41 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Sun, 7 Jan 2024 18:00:53 +0100 Subject: [PATCH 119/477] [#18757] fix merge --- routing.rst | 1 - 1 file changed, 1 deletion(-) diff --git a/routing.rst b/routing.rst index 941c074cb0d..402a26e09e9 100644 --- a/routing.rst +++ b/routing.rst @@ -2610,7 +2610,6 @@ defined as attributes: controllers: resource: '../../src/Controller/' type: attribute - defaults: schemes: [https] .. code-block:: xml From dc1854310e8a4d4675cbb75dc994add35d02d682 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rokas=20Mikalk=C4=97nas?= Date: Mon, 8 Jan 2024 07:36:00 +0200 Subject: [PATCH 120/477] [Messenger] Add jitter parameter to MultiplierRetryStrategy --- messenger.rst | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/messenger.rst b/messenger.rst index 4b218d7c286..fbf0933f1be 100644 --- a/messenger.rst +++ b/messenger.rst @@ -986,6 +986,8 @@ this is configurable for each transport: # e.g. 1 second delay, 2 seconds, 4 seconds multiplier: 2 max_delay: 0 + # applies randomness to the delay that can prevent the thundering herd effect + jitter: 0.1 # override all of this with a service that # implements Symfony\Component\Messenger\Retry\RetryStrategyInterface # service: null @@ -1005,7 +1007,7 @@ this is configurable for each transport: - + @@ -1030,6 +1032,8 @@ this is configurable for each transport: // e.g. 1 second delay, 2 seconds, 4 seconds ->multiplier(2) ->maxDelay(0) + // applies randomness to the delay that can prevent the thundering herd effect + ->jitter(0.1) // override all of this with a service that // implements Symfony\Component\Messenger\Retry\RetryStrategyInterface ->service(null) From e72beecb26dbccb06bb49ef8af7c77ee5ed7fce9 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Mon, 8 Jan 2024 09:35:23 +0100 Subject: [PATCH 121/477] use PHP 8.2 for Symfony 7 builds We were actually never running our test application with Symfony 7.0/7.1 as our CI config prevented Symfony 7 components to be installed: Your requirements could not be resolved to an installable set of packages. Problem 1 - Root composer.json requires symfony/asset * -> satisfiable by symfony/asset[7.1.x-dev]. - symfony/asset 7.1.x-dev requires php >=8.2 -> your php version (8.1.27) does not satisfy that requirement. --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index af2ea3a28a7..c9eb6ae7b38 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -90,7 +90,7 @@ jobs: - name: Set-up PHP uses: shivammathur/setup-php@v2 with: - php-version: 8.1 + php-version: 8.2 coverage: none - name: Fetch branch from where the PR started From 9fc538bf61f6e0d0932e1fcb4ddf853975aa8e3d Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Mon, 8 Jan 2024 09:48:40 +0100 Subject: [PATCH 122/477] Minor tweak --- messenger.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/messenger.rst b/messenger.rst index fbf0933f1be..5f376ffbb31 100644 --- a/messenger.rst +++ b/messenger.rst @@ -987,6 +987,7 @@ this is configurable for each transport: multiplier: 2 max_delay: 0 # applies randomness to the delay that can prevent the thundering herd effect + # the value (between 0 and 1.0) is the percentage of 'delay' that will be added/subtracted jitter: 0.1 # override all of this with a service that # implements Symfony\Component\Messenger\Retry\RetryStrategyInterface @@ -1033,6 +1034,7 @@ this is configurable for each transport: ->multiplier(2) ->maxDelay(0) // applies randomness to the delay that can prevent the thundering herd effect + // the value (between 0 and 1.0) is the percentage of 'delay' that will be added/subtracted ->jitter(0.1) // override all of this with a service that // implements Symfony\Component\Messenger\Retry\RetryStrategyInterface @@ -1040,6 +1042,10 @@ this is configurable for each transport: ; }; +.. versionadded:: 7.1 + + The ``jitter`` option was introduced in Symfony 7.1. + .. tip:: Symfony triggers a :class:`Symfony\\Component\\Messenger\\Event\\WorkerMessageRetriedEvent` From 5dcaa08af2484f5ce2a3e7604433d216ffb04487 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Mon, 8 Jan 2024 09:59:28 +0100 Subject: [PATCH 123/477] update default message --- reference/constraints/MacAddress.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reference/constraints/MacAddress.rst b/reference/constraints/MacAddress.rst index e13420bd832..952412c4061 100644 --- a/reference/constraints/MacAddress.rst +++ b/reference/constraints/MacAddress.rst @@ -87,7 +87,7 @@ Options ``message`` ~~~~~~~~~~~ -**type**: ``string`` **default**: ``This is not a valid MAC address.`` +**type**: ``string`` **default**: ``This value is not a valid MAC address.`` This is the message that will be shown if the value is not a valid MAC address. From 26ca6ea010e453a8cfe6c6eb74d5a014a33b08fe Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Mon, 8 Jan 2024 11:03:52 +0100 Subject: [PATCH 124/477] [Validator] Added a link in a constraint description --- reference/constraints/MacAddress.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/reference/constraints/MacAddress.rst b/reference/constraints/MacAddress.rst index e13420bd832..cff74936c29 100644 --- a/reference/constraints/MacAddress.rst +++ b/reference/constraints/MacAddress.rst @@ -5,7 +5,7 @@ MacAddress The ``MacAddress`` constraint was introduced in Symfony 7.1. -This constraint ensures that the given value is a valid MAC address (internally it +This constraint ensures that the given value is a valid `MAC address`_ (internally it uses the ``FILTER_VALIDATE_MAC`` option of the :phpfunction:`filter_var` PHP function). @@ -102,3 +102,5 @@ Parameter Description .. include:: /reference/constraints/_normalizer-option.rst.inc .. include:: /reference/constraints/_payload-option.rst.inc + +.. _`MAC address`: https://en.wikipedia.org/wiki/MAC_address From 47e0be071d55b58026214d4ebc3177b52d4fb364 Mon Sep 17 00:00:00 2001 From: Quentin Devos <4972091+Okhoshi@users.noreply.github.com> Date: Mon, 8 Jan 2024 23:03:32 +0100 Subject: [PATCH 125/477] [FrameworkBundle] Update cache_dir config Signed-off-by: Quentin Devos <4972091+Okhoshi@users.noreply.github.com> --- reference/configuration/framework.rst | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/reference/configuration/framework.rst b/reference/configuration/framework.rst index 254fe7fcbd1..2d54d54c79a 100644 --- a/reference/configuration/framework.rst +++ b/reference/configuration/framework.rst @@ -1511,6 +1511,19 @@ cache_dir The directory where routing information will be cached. Can be set to ``~`` (``null``) to disable route caching. +.. deprecated:: 7.1 + + Setting the ``cache_dir`` option is deprecated since Symfony 7.1. The routes + are now always cached in the ``%kernel.build_dir%`` directory. If you want + to disable route caching, set the ``ignore_cache`` option to ``true``. + +ignore_cache +............ + +**type**: ``boolean`` **default**: ``false`` + +When this option is set to ``true``, routing information will not be cached. + secrets ~~~~~~~ From 8e5a16460e85ff5a54151ebc34a2d0fc4bb289da Mon Sep 17 00:00:00 2001 From: Antoine Lamirault Date: Wed, 10 Jan 2024 22:09:18 +0100 Subject: [PATCH 126/477] [Form] Add option separator to ChoiceType to use a custom separator after preferred choices --- reference/constraints/Choice.rst | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/reference/constraints/Choice.rst b/reference/constraints/Choice.rst index 5a9c365be37..1a3e6d356f0 100644 --- a/reference/constraints/Choice.rst +++ b/reference/constraints/Choice.rst @@ -389,3 +389,25 @@ Parameter Description =============== ============================================================== .. include:: /reference/constraints/_payload-option.rst.inc + +``separator`` +~~~~~~~~~~~~~ + +**type**: ``string`` **default**: ``-------------------`` + +This option allows you to customize separator after preferred choices. + +.. versionadded:: 7.1 + + The ``separator`` option was introduced in Symfony 7.1. + +``separator_html`` +~~~~~~~~~~~~~~~~~~ + +**type**: ``boolean`` **default**: ``false`` + +If this option is true, `separator`_ option will be display as HTML instead of text + +.. versionadded:: 7.1 + + The ``separator_html`` option was introduced in Symfony 7.1. From dcd25e7ca2275cb511cf7b0d65ee551661bcf5fe Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Wed, 3 Jan 2024 08:49:32 +0100 Subject: [PATCH 127/477] [Contracts][DependencyInjection] Mention that locators are traversable --- .../service_subscribers_locators.rst | 31 +++++++++++++++---- 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/service_container/service_subscribers_locators.rst b/service_container/service_subscribers_locators.rst index 3db82ad3007..897a82f8195 100644 --- a/service_container/service_subscribers_locators.rst +++ b/service_container/service_subscribers_locators.rst @@ -110,17 +110,36 @@ in the service subscriber:: that you have :ref:`autoconfigure ` enabled. You can also manually add the ``container.service_subscriber`` tag. -The injected service is an instance of :class:`Symfony\\Component\\DependencyInjection\\ServiceLocator` -which implements both the PSR-11 ``ContainerInterface`` and :class:`Symfony\\Contracts\\Service\\ServiceProviderInterface`. -It is also a callable and a countable:: +A service locator is a PSR11 container that contains a set of services, +but only instantiates them when they are actually used. Let's take a closer +look at this part:: + + // ... + $handler = $this->locator->get($commandClass); + + return $handler->handle($command); + +In the example above, the ``$handler`` service is only instantiated when the +``$this->locator->get($commandClass)`` method is called. + +You can also type-hint the service locator argument with +:class:`Symfony\\Contracts\\Service\\ServiceCollectionInterface` instead of +:class:`Psr\\Container\\ContainerInterface`. By doing so, you'll be able to +count and iterate over the services of the locator:: // ... $numberOfHandlers = count($this->locator); $nameOfHandlers = array_keys($this->locator->getProvidedServices()); - // ... - $handler = ($this->locator)($commandClass); - return $handler->handle($command); + // you can iterate through all services of the locator + foreach ($this->locator as $serviceId => $service) { + // do something with the service, the service id or both + } + +.. versionadded:: 7.1 + + The :class:`Symfony\\Contracts\\Service\\ServiceCollectionInterface` was + introduced in Symfony 7.1. Including Services ------------------ From a7f5f3062f976017cd516aeea68bddd3f42ce664 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Thu, 11 Jan 2024 13:34:37 +0100 Subject: [PATCH 128/477] Tweak --- reference/constraints/Choice.rst | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/reference/constraints/Choice.rst b/reference/constraints/Choice.rst index 1a3e6d356f0..8bafaaede7b 100644 --- a/reference/constraints/Choice.rst +++ b/reference/constraints/Choice.rst @@ -395,7 +395,9 @@ Parameter Description **type**: ``string`` **default**: ``-------------------`` -This option allows you to customize separator after preferred choices. +This option allows you to customize the visual separator shown after the preferred +choices. You can use HTML elements like ``
`` to display a more modern separator, +but you'll also need to set the `separator_html`_ option to ``true``. .. versionadded:: 7.1 @@ -406,7 +408,9 @@ This option allows you to customize separator after preferred choices. **type**: ``boolean`` **default**: ``false`` -If this option is true, `separator`_ option will be display as HTML instead of text +If this option is true, the `separator`_ option will be displayed as HTML instead +of text. This is useful when using HTML elements (e.g. ``
``) as a more modern +visual separator. .. versionadded:: 7.1 From ee5e28f3c5a67aeb72c73e115d0bb95edb97d6bb Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Fri, 12 Jan 2024 16:56:22 +0100 Subject: [PATCH 129/477] Tweak --- service_container/service_subscribers_locators.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/service_container/service_subscribers_locators.rst b/service_container/service_subscribers_locators.rst index 897a82f8195..31a9fa55f3b 100644 --- a/service_container/service_subscribers_locators.rst +++ b/service_container/service_subscribers_locators.rst @@ -110,16 +110,15 @@ in the service subscriber:: that you have :ref:`autoconfigure ` enabled. You can also manually add the ``container.service_subscriber`` tag. -A service locator is a PSR11 container that contains a set of services, -but only instantiates them when they are actually used. Let's take a closer -look at this part:: +A service locator is a `PSR-11 container`_ that contains a set of services, +but only instantiates them when they are actually used. Consider the following code:: // ... $handler = $this->locator->get($commandClass); return $handler->handle($command); -In the example above, the ``$handler`` service is only instantiated when the +In this example, the ``$handler`` service is only instantiated when the ``$this->locator->get($commandClass)`` method is called. You can also type-hint the service locator argument with @@ -1066,3 +1065,4 @@ Another alternative is to mock it using ``PHPUnit``:: // ... .. _`Command pattern`: https://en.wikipedia.org/wiki/Command_pattern +.. _`PSR-11 container`: https://www.php-fig.org/psr/psr-11/ From 1bd553588da3450112c6e51f93baa29cf9cb0f1f Mon Sep 17 00:00:00 2001 From: HypeMC Date: Fri, 12 Jan 2024 19:30:48 +0100 Subject: [PATCH 130/477] [Cache] Document using DSN with PDOAdapter --- cache.rst | 29 ++++++++--------------------- 1 file changed, 8 insertions(+), 21 deletions(-) diff --git a/cache.rst b/cache.rst index 98ec11123fc..d1da8c87560 100644 --- a/cache.rst +++ b/cache.rst @@ -133,12 +133,7 @@ Some of these adapters could be configured via shortcuts. default_psr6_provider: 'app.my_psr6_service' default_redis_provider: 'redis://localhost' default_memcached_provider: 'memcached://localhost' - default_pdo_provider: 'app.my_pdo_service' - - services: - app.my_pdo_service: - class: \PDO - arguments: ['pgsql:host=localhost'] + default_pdo_provider: 'pgsql:host=localhost' .. code-block:: xml @@ -159,24 +154,17 @@ Some of these adapters could be configured via shortcuts. default-psr6-provider="app.my_psr6_service" default-redis-provider="redis://localhost" default-memcached-provider="memcached://localhost" - default-pdo-provider="app.my_pdo_service" + default-pdo-provider="pgsql:host=localhost" />
- - - - pgsql:host=localhost - - .. code-block:: php // config/packages/cache.php - use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; use Symfony\Config\FrameworkConfig; - return static function (FrameworkConfig $framework, ContainerConfigurator $container): void { + return static function (FrameworkConfig $framework): void { $framework->cache() // Only used with cache.adapter.filesystem ->directory('%kernel.cache_dir%/pools') @@ -185,15 +173,14 @@ Some of these adapters could be configured via shortcuts. ->defaultPsr6Provider('app.my_psr6_service') ->defaultRedisProvider('redis://localhost') ->defaultMemcachedProvider('memcached://localhost') - ->defaultPdoProvider('app.my_pdo_service') - ; - - $container->services() - ->set('app.my_pdo_service', \PDO::class) - ->args(['pgsql:host=localhost']) + ->defaultPdoProvider('pgsql:host=localhost') ; }; +.. versionadded:: 7.1 + + Using a DSN as the provider for the PDO adapter was introduced in Symfony 7.1. + .. _cache-create-pools: Creating Custom (Namespaced) Pools From f3ca92f7a685928b9f1a5895a584f0dce0981ecc Mon Sep 17 00:00:00 2001 From: Simon Date: Mon, 15 Jan 2024 09:15:18 +0100 Subject: [PATCH 131/477] [Validator] Fix mb_detect_encoding link in Charset Fix mb_detect_encoding link sending to 404 ( https://www.php.net/manual/en/function.mb-detect-encoding().php ) --- reference/constraints/Charset.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reference/constraints/Charset.rst b/reference/constraints/Charset.rst index 278ea570831..4f1a260356f 100644 --- a/reference/constraints/Charset.rst +++ b/reference/constraints/Charset.rst @@ -89,7 +89,7 @@ Options An encoding or a set of encodings to check against. If you pass an array of encodings, the validator will check if the value is encoded in *any* of the encodings. This option accepts any value that can be passed to -:phpfunction:`mb_detect_encoding()`. +:phpfunction:`mb_detect_encoding`. .. include:: /reference/constraints/_groups-option.rst.inc From 43862c49f30e0428d6c02fa5bd63cb2dea34fce1 Mon Sep 17 00:00:00 2001 From: Maxime Doutreluingne Date: Sat, 30 Dec 2023 16:21:22 +0100 Subject: [PATCH 132/477] [Form] Add `model_type` option to `MoneyType` --- reference/forms/types/money.rst | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/reference/forms/types/money.rst b/reference/forms/types/money.rst index 9f98b49158b..65f24ac93a3 100644 --- a/reference/forms/types/money.rst +++ b/reference/forms/types/money.rst @@ -76,6 +76,18 @@ If set to ``true``, the HTML input will be rendered as a native HTML5 As HTML5 number format is normalized, it is incompatible with ``grouping`` option. +model_type +~~~~~~~~~~ + +**type**: ``string`` **default**: ``float`` + +If, for some reason, you need the value to be converted to an ``integer`` instead of a ``float``, +you can set the option value to ``integer``. + +.. versionadded:: 7.1 + + The ``model_type`` option was introduced in Symfony 7.1. + scale ~~~~~ From 6b55e576c16edbd75dd2477435b52636cf3567cd Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Mon, 15 Jan 2024 13:27:16 +0100 Subject: [PATCH 133/477] Minor reword --- reference/forms/types/money.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/reference/forms/types/money.rst b/reference/forms/types/money.rst index 65f24ac93a3..8e2130a5909 100644 --- a/reference/forms/types/money.rst +++ b/reference/forms/types/money.rst @@ -81,8 +81,9 @@ model_type **type**: ``string`` **default**: ``float`` -If, for some reason, you need the value to be converted to an ``integer`` instead of a ``float``, -you can set the option value to ``integer``. +By default, the money value is converted to a ``float`` PHP type. If you need the +value to be converted into an integer (e.g. because some library needs money +values stored in cents as integers) set this option to ``integer``. .. versionadded:: 7.1 From cf8cc5beeadda756a679875593b7fc08ef169b7b Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Tue, 16 Jan 2024 13:19:19 +0100 Subject: [PATCH 134/477] [Scheduler] Remove some unneeded versionadded directives --- scheduler.rst | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/scheduler.rst b/scheduler.rst index 8e172412559..18d0f60fe69 100644 --- a/scheduler.rst +++ b/scheduler.rst @@ -1,10 +1,6 @@ Scheduler ========= -.. versionadded:: 6.3 - - The Scheduler component was introduced in Symfony 6.3 - The scheduler component manages task scheduling within your PHP application, like running a task each night at 3 AM, every two weeks except for holidays or any other custom schedule you might need. @@ -143,10 +139,6 @@ It uses the same syntax as the `cron command-line utility`_:: // optionally you can define the timezone used by the cron expression RecurringMessage::cron('* * * * *', new Message(), new \DateTimeZone('Africa/Malabo')); -.. versionadded:: 6.4 - - The feature to define the cron timezone was introduced in Symfony 6.4. - Before using it, you must install the following dependency: .. code-block:: terminal @@ -266,9 +258,9 @@ the Messenger component: .. image:: /_images/components/scheduler/generate_consume.png :alt: Symfony Scheduler - generate and consume -.. versionadded:: 6.4 +.. tip:: - Since version 6.4, you can define your messages via a ``callback`` via the + You can also define your messages via a ``callback`` using the :class:`Symfony\\Component\\Scheduler\\Trigger\\CallbackMessageProvider`. Debugging the Schedule @@ -300,10 +292,6 @@ recurring messages. You can narrow down the list to a specific schedule: # use the --all option to also display the terminated recurring messages $ php bin/console --all -.. versionadded:: 6.4 - - The ``--date`` and ``--all`` options were introduced in Symfony 6.4. - Efficient management with Symfony Scheduler ------------------------------------------- From 667d3af3aada3beccd155985f939f4008e35350c Mon Sep 17 00:00:00 2001 From: Mathieu Santostefano Date: Wed, 17 Jan 2024 10:00:36 +0100 Subject: [PATCH 135/477] Add Resend bridge documentation --- mailer.rst | 7 +++++++ webhook.rst | 1 + 2 files changed, 8 insertions(+) diff --git a/mailer.rst b/mailer.rst index dc981437e3e..37a955efe42 100644 --- a/mailer.rst +++ b/mailer.rst @@ -110,6 +110,7 @@ Service Install with Webhook su `MailerSend`_ ``composer require symfony/mailer-send-mailer`` `Mandrill`_ ``composer require symfony/mailchimp-mailer`` `Postmark`_ ``composer require symfony/postmark-mailer`` yes +`Resend`_ ``composer require symfony/resend-mailer`` yes `Scaleway`_ ``composer require symfony/scaleway-mailer`` `SendGrid`_ ``composer require symfony/sendgrid-mailer`` yes ===================== =============================================== =============== @@ -208,6 +209,10 @@ party provider: | | - HTTP n/a | | | - API postmark+api://KEY@default | +------------------------+-----------------------------------------------------+ +| `Resend`_ | - SMTP resend+smtp://resend:API_KEY@default | +| | - HTTP n/a | +| | - API resend+api://API_KEY@default | ++------------------------+-----------------------------------------------------+ | `Scaleway`_ | - SMTP scaleway+smtp://PROJECT_ID:API_KEY@default | | | - HTTP n/a | | | - API scaleway+api://PROJECT_ID:API_KEY@default | @@ -1503,6 +1508,7 @@ The following transports currently support tags and metadata: The following transports only support tags: * MailPace +* Resend The following transports only support metadata: @@ -1847,6 +1853,7 @@ the :class:`Symfony\\Bundle\\FrameworkBundle\\Test\\MailerAssertionsTrait`:: .. _`OpenSSL PHP extension`: https://www.php.net/manual/en/book.openssl.php .. _`PEM encoded`: https://en.wikipedia.org/wiki/Privacy-Enhanced_Mail .. _`Postmark`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Mailer/Bridge/Postmark/README.md +.. _`Resend`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Mailer/Bridge/Resend/README.md .. _`RFC 3986`: https://www.ietf.org/rfc/rfc3986.txt .. _`S/MIME`: https://en.wikipedia.org/wiki/S/MIME .. _`Scaleway`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Mailer/Bridge/Scaleway/README.md diff --git a/webhook.rst b/webhook.rst index d6e14f12805..32567bfe29d 100644 --- a/webhook.rst +++ b/webhook.rst @@ -82,6 +82,7 @@ Brevo ``mailer.webhook.request_parser.brevo`` Mailgun ``mailer.webhook.request_parser.mailgun`` Mailjet ``mailer.webhook.request_parser.mailjet`` Postmark ``mailer.webhook.request_parser.postmark`` +Resend ``mailer.webhook.request_parser.resend`` Sendgrid ``mailer.webhook.request_parser.sendgrid`` ============== ========================================== From 0d779a50c6b458f42cfb63751869fc3f56f3a245 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 17 Jan 2024 10:29:19 +0100 Subject: [PATCH 136/477] [Scheduler] Remove unneded versionadded directives --- scheduler.rst | 6 ------ 1 file changed, 6 deletions(-) diff --git a/scheduler.rst b/scheduler.rst index e51e8243af3..3d04d8c0a58 100644 --- a/scheduler.rst +++ b/scheduler.rst @@ -160,12 +160,6 @@ methods:: $trigger->inner(); // CronExpressionTrigger $trigger->decorators(); // [ExcludeTimeTrigger, JitterTrigger] -.. versionadded:: 6.4 - - The :method:`Symfony\\Component\\Scheduler\\Trigger\\AbstractDecoratedTrigger::inner` - and :method:`Symfony\\Component\\Scheduler\\Trigger\\AbstractDecoratedTrigger::decorators` - methods were introduced in Symfony 6.4. - Most of them can be created via the :class:`Symfony\\Component\\Scheduler\\RecurringMessage` class, as shown in the following examples. From c19e8dffb5a671eef5ae3f452b4bd3a44066d2e1 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Thu, 18 Jan 2024 10:56:52 +0100 Subject: [PATCH 137/477] Updated the versionadded directive --- mailer.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mailer.rst b/mailer.rst index 37a955efe42..3d49efea597 100644 --- a/mailer.rst +++ b/mailer.rst @@ -117,7 +117,7 @@ Service Install with Webhook su .. versionadded:: 7.1 - The Azure integration was introduced in Symfony 7.1. + The Azure and Resend integrations were introduced in Symfony 7.1. .. note:: From 78ef5d52d16d58f7b24db4939f8b78e76f458d67 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Thu, 18 Jan 2024 10:58:00 +0100 Subject: [PATCH 138/477] [Webhook] Added a missing versionadded directive --- webhook.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/webhook.rst b/webhook.rst index 32567bfe29d..05885602074 100644 --- a/webhook.rst +++ b/webhook.rst @@ -86,6 +86,10 @@ Resend ``mailer.webhook.request_parser.resend`` Sendgrid ``mailer.webhook.request_parser.sendgrid`` ============== ========================================== +.. versionadded:: 7.1 + + The Resend webhook was introduced in Symfony 7.1. + Set up the webhook in the third-party mailer. For Mailgun, you can do this in the control panel. As URL, make sure to use the ``/webhook/mailer_mailgun`` path behind the domain you're using. From 617249b4c4d67f62e8133bc9b007e390f673b017 Mon Sep 17 00:00:00 2001 From: Stefan Doorn Date: Mon, 22 Jan 2024 11:02:12 +0100 Subject: [PATCH 139/477] [Messenger] Clarify UnrecoverableMessageHandlingException message going to failure transport --- messenger.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/messenger.rst b/messenger.rst index 0f1c00baae4..43a7f256343 100644 --- a/messenger.rst +++ b/messenger.rst @@ -1044,6 +1044,12 @@ and should not be retried. If you throw :class:`Symfony\\Component\\Messenger\\Exception\\UnrecoverableMessageHandlingException`, the message will not be retried. +.. note:: + + Messages that will not be retried, will still show up in the configured failure transport. + If you want to avoid that, consider handling the error yourself and let the handler + successfully end. + Forcing Retrying ~~~~~~~~~~~~~~~~ From 56b46c7cdc2b8b1865ee65e27dacae36690a303f Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Wed, 24 Jan 2024 22:40:33 +0100 Subject: [PATCH 140/477] - --- webhook.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/webhook.rst b/webhook.rst index 29d2eea0849..0b8d2514a26 100644 --- a/webhook.rst +++ b/webhook.rst @@ -27,6 +27,7 @@ Brevo ``mailer.webhook.request_parser.brevo`` Mailgun ``mailer.webhook.request_parser.mailgun`` Mailjet ``mailer.webhook.request_parser.mailjet`` Postmark ``mailer.webhook.request_parser.postmark`` +Resend ``mailer.webhook.request_parser.resend`` Sendgrid ``mailer.webhook.request_parser.sendgrid`` ============== ========================================== @@ -34,6 +35,10 @@ Sendgrid ``mailer.webhook.request_parser.sendgrid`` The support for Brevo, Mailjet and Sendgrid was introduced in Symfony 6.4. +.. versionadded:: 7.1 + + The support for Resend was introduced in Symfony 7.1. + .. note:: Install the third-party mailer provider you want to use as described in the From ca3da8b3763f01954e4ad6ecaba02aac285f602c Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Wed, 24 Jan 2024 22:40:44 +0100 Subject: [PATCH 141/477] - --- webhook.rst | 4 ---- 1 file changed, 4 deletions(-) diff --git a/webhook.rst b/webhook.rst index 29d2eea0849..37422b75542 100644 --- a/webhook.rst +++ b/webhook.rst @@ -30,10 +30,6 @@ Postmark ``mailer.webhook.request_parser.postmark`` Sendgrid ``mailer.webhook.request_parser.sendgrid`` ============== ========================================== -.. versionadded:: 6.4 - - The support for Brevo, Mailjet and Sendgrid was introduced in Symfony 6.4. - .. note:: Install the third-party mailer provider you want to use as described in the From 3ee6a7fcb5baac802e7602678143ee2e7b42d563 Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Wed, 3 Jan 2024 18:35:45 +0100 Subject: [PATCH 142/477] [DotEnv] Fix incorrect way to modify .env path --- configuration.rst | 41 ++++++++++++++++++++++++++++++++--------- 1 file changed, 32 insertions(+), 9 deletions(-) diff --git a/configuration.rst b/configuration.rst index 078ec57b49f..24eebb1fa00 100644 --- a/configuration.rst +++ b/configuration.rst @@ -936,9 +936,38 @@ Storing Environment Variables In Other Files ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ By default, the environment variables are stored in the ``.env`` file located -at the root of your project. However, you can store them in other file by -setting the ``SYMFONY_DOTENV_PATH`` environment variable to the absolute path of -that custom file. +at the root of your project. However, you can store them in other files in +multiple ways. + +If you use the :doc:`Runtime component `, the dotenv +path is part of the options you can set in your ``composer.json`` file: + +.. code-block:: json + + { + // ... + "extra": { + // ... + "runtime": { + "dotenv_path": "my/custom/path/to/.env" + } + } + } + +You can also set the ``SYMFONY_DOTENV_PATH`` environment variable at system +level (e.g. in your web server configuration or in your Dockerfile): + +.. code-block:: bash + + # .env (or .env.local) + SYMFONY_DOTENV_PATH=my/custom/path/to/.env + +Finally, you can directly invoke the ``Dotenv`` class in your +``bootstrap.php`` file or any other file of your application:: + + use Symfony\Component\Dotenv\Dotenv; + + (new Dotenv())->bootEnv(dirname(__DIR__).'my/custom/path/to/.env'); Symfony will then look for the environment variables in that file, but also in the local and environment-specific files (e.g. ``.*.local`` and @@ -946,12 +975,6 @@ the local and environment-specific files (e.g. ``.*.local`` and :ref:`how to override environment variables ` to learn more about this. -.. caution:: - - The ``SYMFONY_DOTENV_PATH`` environment variable must be defined at the - system level (e.g. in your web server configuration) and not in any default - or custom ``.env`` file. - .. versionadded:: 7.1 The ``SYMFONY_DOTENV_PATH`` environment variable was introduced in Symfony 7.1. From ead19d00068fc1a6f22431cf3e71bc452dbc4248 Mon Sep 17 00:00:00 2001 From: Radoslaw Kowalewski Date: Tue, 30 Jan 2024 20:36:30 +0100 Subject: [PATCH 143/477] [Mailer][Smtp] Document 'auto_tls' param --- mailer.rst | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/mailer.rst b/mailer.rst index 07f341cf508..cf17a55a6e2 100644 --- a/mailer.rst +++ b/mailer.rst @@ -347,6 +347,30 @@ may be specified as SHA1 or MD5 hash:: $dsn = 'smtp://user:pass@smtp.example.com?peer_fingerprint=6A1CF3B08D175A284C30BC10DE19162307C7286E'; +Disabling automatic TLS +~~~~~~~~~~~~~~~~~~~~~~~ + +.. versionadded:: 7.1 + + Disabling automatic TLS was introduced in Symfony 7.1. + +By default, mailer will check if OpenSSL extension is enabled and if SMTP server +is capable of STARTTLS, it will issue this command to enable encryption on stream. +This behavior can be turned off by calling ``setAutoTls(false)`` on ``EsmtpTransport`` +instance, or by setting ``auto_tls`` option in DSN:: + + $dsn = 'smtp://user:pass@10.0.0.25?auto_tls=false'; + +.. caution:: + + It's not recommended to disable TLS while connecting to SMTP server over + internet, but it can be useful when both application and SMTP server are in + secured network, where there is no need for additional encryption. + +.. note:: + + This setting works only when ``smtp://`` protocol is used. + Overriding default SMTP authenticators ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ From c34a612a3ed938ffd8aae847507221504a199366 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 31 Jan 2024 10:13:25 +0100 Subject: [PATCH 144/477] Minor tweak --- mailer.rst | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/mailer.rst b/mailer.rst index cf17a55a6e2..8f48bd355fa 100644 --- a/mailer.rst +++ b/mailer.rst @@ -347,29 +347,29 @@ may be specified as SHA1 or MD5 hash:: $dsn = 'smtp://user:pass@smtp.example.com?peer_fingerprint=6A1CF3B08D175A284C30BC10DE19162307C7286E'; -Disabling automatic TLS +Disabling Automatic TLS ~~~~~~~~~~~~~~~~~~~~~~~ .. versionadded:: 7.1 - Disabling automatic TLS was introduced in Symfony 7.1. + The option to disable automatic TLS was introduced in Symfony 7.1. -By default, mailer will check if OpenSSL extension is enabled and if SMTP server -is capable of STARTTLS, it will issue this command to enable encryption on stream. -This behavior can be turned off by calling ``setAutoTls(false)`` on ``EsmtpTransport`` -instance, or by setting ``auto_tls`` option in DSN:: +By default, the Mailer component will use encryption when the OpenSSL extension +is enabled and the SMTP server supports ``STARTTLS``. This behavior can be turned +off by calling ``setAutoTls(false)`` on the ``EsmtpTransport`` instance, or by +setting the ``auto_tls`` option to ``false`` in the DSN:: $dsn = 'smtp://user:pass@10.0.0.25?auto_tls=false'; .. caution:: - It's not recommended to disable TLS while connecting to SMTP server over - internet, but it can be useful when both application and SMTP server are in - secured network, where there is no need for additional encryption. + It's not recommended to disable TLS while connecting to an SMTP server over + the Internet, but it can be useful when both the application and the SMTP + server are in a secured network, where there is no need for additional encryption. .. note:: - This setting works only when ``smtp://`` protocol is used. + This setting only works when the ``smtp://`` protocol is used. Overriding default SMTP authenticators ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ From 5495c1d47846e784ad0f5e7066d39d4db1385798 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Szymon=20Kami=C5=84ski?= Date: Sat, 3 Feb 2024 14:59:16 +0100 Subject: [PATCH 145/477] [Serializer] Document DateTimeNormalizer::CAST_KEY context option --- components/serializer.rst | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/components/serializer.rst b/components/serializer.rst index dce30b8932b..0dbd223877d 100644 --- a/components/serializer.rst +++ b/components/serializer.rst @@ -820,8 +820,14 @@ The Serializer component provides several built-in normalizers: :class:`Symfony\\Component\\Serializer\\Normalizer\\DateTimeNormalizer` This normalizer converts :phpclass:`DateTimeInterface` objects (e.g. - :phpclass:`DateTime` and :phpclass:`DateTimeImmutable`) into strings. - By default, it uses the `RFC3339`_ format. + :phpclass:`DateTime` and :phpclass:`DateTimeImmutable`) into strings, + integers or floats. By default, it converts them to strings using the `RFC3339`_ format. + To convert the objects to integers or floats, set the serializer context option + ``DateTimeNormalizer::CAST_KEY`` to ``int`` or ``float``. + +.. versionadded:: 7.1 + + ``DateTimeNormalizer::CAST_KEY`` context option was introduced in Symfony 7.1. :class:`Symfony\\Component\\Serializer\\Normalizer\\DateTimeZoneNormalizer` This normalizer converts :phpclass:`DateTimeZone` objects into strings that From 7edd5d171de559b4fa471a961c3a8b5e6143978c Mon Sep 17 00:00:00 2001 From: Antoine Lamirault Date: Sun, 4 Feb 2024 20:45:39 +0100 Subject: [PATCH 146/477] [ExpressionLanguage] Add min and max php functions --- reference/formats/expression_language.rst | 28 +++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/reference/formats/expression_language.rst b/reference/formats/expression_language.rst index 6c9b1bffe42..9a3e78ef485 100644 --- a/reference/formats/expression_language.rst +++ b/reference/formats/expression_language.rst @@ -120,6 +120,8 @@ following functions by default: * ``constant()`` * ``enum()`` +* ``min()`` +* ``max()`` ``constant()`` function ~~~~~~~~~~~~~~~~~~~~~~~ @@ -167,6 +169,32 @@ This function will return the case of an enumeration:: This will print out ``true``. +``min()`` function +~~~~~~~~~~~~~~~~~~ + +This function will return the lowest value:: + + var_dump($expressionLanguage->evaluate( + 'min(1, 2, 3)' + )); + +This will print out ``1``. + +``max()`` function +~~~~~~~~~~~~~~~~~~ + +This function will return the highest value:: + + var_dump($expressionLanguage->evaluate( + 'max(1, 2, 3)' + )); + +This will print out ``3``. + +.. versionadded:: 7.1 + + The ``min()`` and ``max()`` functions were introduced in Symfony 7.1. + .. tip:: To read how to register your own functions to use in an expression, see From ff7350028574a6585ff666f884b9fa882437f855 Mon Sep 17 00:00:00 2001 From: Antoine Lamirault Date: Sun, 4 Feb 2024 20:52:37 +0100 Subject: [PATCH 147/477] [Mailer][Webhook] Mailersend webhook remote event --- webhook.rst | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/webhook.rst b/webhook.rst index e423a55e524..0e975860055 100644 --- a/webhook.rst +++ b/webhook.rst @@ -20,20 +20,21 @@ receive webhook calls from this provider. Currently, the following third-party mailer providers support webhooks: -============== ========================================== +============== ============================================ Mailer Service Parser service name -============== ========================================== +============== ============================================ Brevo ``mailer.webhook.request_parser.brevo`` +MailerSend ``mailer.webhook.request_parser.mailersend`` Mailgun ``mailer.webhook.request_parser.mailgun`` Mailjet ``mailer.webhook.request_parser.mailjet`` Postmark ``mailer.webhook.request_parser.postmark`` Resend ``mailer.webhook.request_parser.resend`` Sendgrid ``mailer.webhook.request_parser.sendgrid`` -============== ========================================== +============== ============================================ .. versionadded:: 7.1 - The support for Resend was introduced in Symfony 7.1. + The support for ``Resend`` and ``MailerSend`` were introduced in Symfony 7.1. .. note:: From 22ad2d951a2e899f89fe5af4f8078f2de5b2e466 Mon Sep 17 00:00:00 2001 From: Daniel Burger <48986191+danielburger1337@users.noreply.github.com> Date: Sat, 3 Feb 2024 14:26:00 +0100 Subject: [PATCH 148/477] Document `secrets:reveal` command --- configuration/secrets.rst | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/configuration/secrets.rst b/configuration/secrets.rst index 653bd92f611..089f7da2892 100644 --- a/configuration/secrets.rst +++ b/configuration/secrets.rst @@ -166,6 +166,22 @@ secrets' values by passing the ``--reveal`` option: DATABASE_PASSWORD "my secret" ------------------- ------------ ------------- +Reveal Existing Secrets +----------------------- + +If you have the **decryption key**, the ``secrets:reveal`` command allows +you to reveal a single secrets value. + +.. code-block:: terminal + + $ php bin/console secrets:reveal DATABASE_PASSWORD + + my secret + +.. versionadded:: 7.1 + + The ``secrets:reveal`` command was introduced in Symfony 7.1. + Remove Secrets -------------- From d22ad24c30b338244566646729cfbaf58bfbb80e Mon Sep 17 00:00:00 2001 From: Antoine Lamirault Date: Sun, 4 Feb 2024 21:33:12 +0100 Subject: [PATCH 149/477] [Validator] Add additional versions (*_NO_PUBLIC, *_ONLY_PRIV & *_ONLY_RES) in IP address & CIDR constraint --- reference/constraints/Cidr.rst | 8 ++++---- reference/constraints/Ip.rst | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 4 deletions(-) diff --git a/reference/constraints/Cidr.rst b/reference/constraints/Cidr.rst index d7bc9e6b4a0..24abeb57338 100644 --- a/reference/constraints/Cidr.rst +++ b/reference/constraints/Cidr.rst @@ -124,10 +124,10 @@ Parameter Description **type**: ``string`` **default**: ``all`` This determines exactly *how* the CIDR notation is validated and can take one -of these values: +of :ref:`IP version ranges `. -* ``4``: validates for CIDR notations that have an IPv4; -* ``6``: validates for CIDR notations that have an IPv6; -* ``all``: validates all CIDR formats. +.. versionadded:: 7.1 + + The support of all IP version ranges was introduced in Symfony 7.1. .. _`CIDR`: https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing diff --git a/reference/constraints/Ip.rst b/reference/constraints/Ip.rst index 2f05f677601..9168d463f77 100644 --- a/reference/constraints/Ip.rst +++ b/reference/constraints/Ip.rst @@ -97,6 +97,8 @@ Parameter Description .. include:: /reference/constraints/_payload-option.rst.inc +.. _reference-constraint-ip-version: + ``version`` ~~~~~~~~~~~ @@ -132,6 +134,33 @@ of a variety of different values: ``all_no_res`` Validates for all IP formats but without reserved IP ranges +**No public ranges** + +``4_no_public`` + Validates for IPv4 but without public IP ranges +``6_no_public`` + Validates for IPv6 but without public IP ranges +``all_no_public`` + Validates for all IP formats but without public IP range + +**Only private ranges** + +``4_private`` + Validates for IPv4 but without public and reserved ranges +``6_private`` + Validates for IPv6 but without public and reserved ranges +``all_private`` + Validates for all IP formats but without public and reserved ranges + +**Only reserved ranges** + +``4_reserved`` + Validates for IPv4 but without private and public ranges +``6_reserved`` + Validates for IPv6 but without private and public ranges +``all_reserved`` + Validates for all IP formats but without private and public ranges + **Only public ranges** ``4_public`` @@ -140,3 +169,8 @@ of a variety of different values: Validates for IPv6 but without private and reserved ranges ``all_public`` Validates for all IP formats but without private and reserved ranges + +.. versionadded:: 7.1 + + The ``*_no_public``, ``*_reserved`` and ``*_public`` ranges were introduced + in Symfony 7.1. From f332fd8d41065fabaac8c3d50349822f36f19b5a Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Mon, 5 Feb 2024 08:21:51 +0100 Subject: [PATCH 150/477] Fix a minor syntax issue --- components/serializer.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/serializer.rst b/components/serializer.rst index 0dbd223877d..31c44216505 100644 --- a/components/serializer.rst +++ b/components/serializer.rst @@ -825,9 +825,9 @@ The Serializer component provides several built-in normalizers: To convert the objects to integers or floats, set the serializer context option ``DateTimeNormalizer::CAST_KEY`` to ``int`` or ``float``. -.. versionadded:: 7.1 + .. versionadded:: 7.1 - ``DateTimeNormalizer::CAST_KEY`` context option was introduced in Symfony 7.1. + ``DateTimeNormalizer::CAST_KEY`` context option was introduced in Symfony 7.1. :class:`Symfony\\Component\\Serializer\\Normalizer\\DateTimeZoneNormalizer` This normalizer converts :phpclass:`DateTimeZone` objects into strings that From 9388de664c185bec41a978ed1c18e4b71ac9cec9 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Mon, 5 Feb 2024 08:39:20 +0100 Subject: [PATCH 151/477] [ExpressionLanguage] Add more information about the min/max functions --- reference/formats/expression_language.rst | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/reference/formats/expression_language.rst b/reference/formats/expression_language.rst index 9a3e78ef485..7daa4c98957 100644 --- a/reference/formats/expression_language.rst +++ b/reference/formats/expression_language.rst @@ -172,7 +172,10 @@ This will print out ``true``. ``min()`` function ~~~~~~~~~~~~~~~~~~ -This function will return the lowest value:: +This function will return the lowest value of the given parameters. You can pass +different types of parameters (e.g. dates, strings, numeric values) and even mix +them (e.g. pass numeric values and strings). Internally it uses the :phpfunction:`min` +PHP function to find the lowest value:: var_dump($expressionLanguage->evaluate( 'min(1, 2, 3)' @@ -183,7 +186,10 @@ This will print out ``1``. ``max()`` function ~~~~~~~~~~~~~~~~~~ -This function will return the highest value:: +This function will return the highest value of the given parameters. You can pass +different types of parameters (e.g. dates, strings, numeric values) and even mix +them (e.g. pass numeric values and strings). Internally it uses the :phpfunction:`max` +PHP function to find the highest value:: var_dump($expressionLanguage->evaluate( 'max(1, 2, 3)' From 015aed4d2bc7ba2bdc2a1be47cc51a6041e21f6f Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Mon, 5 Feb 2024 08:49:05 +0100 Subject: [PATCH 152/477] fix typo --- configuration/secrets.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configuration/secrets.rst b/configuration/secrets.rst index 089f7da2892..f717456a22c 100644 --- a/configuration/secrets.rst +++ b/configuration/secrets.rst @@ -170,7 +170,7 @@ Reveal Existing Secrets ----------------------- If you have the **decryption key**, the ``secrets:reveal`` command allows -you to reveal a single secrets value. +you to reveal a single secret's value. .. code-block:: terminal From 17b273749d326ca45e385d296c036d4b402ab305 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Mon, 5 Feb 2024 08:50:11 +0100 Subject: [PATCH 153/477] fix typo --- components/serializer.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/serializer.rst b/components/serializer.rst index 31c44216505..eab0e616c23 100644 --- a/components/serializer.rst +++ b/components/serializer.rst @@ -827,7 +827,7 @@ The Serializer component provides several built-in normalizers: .. versionadded:: 7.1 - ``DateTimeNormalizer::CAST_KEY`` context option was introduced in Symfony 7.1. + The ``DateTimeNormalizer::CAST_KEY`` context option was introduced in Symfony 7.1. :class:`Symfony\\Component\\Serializer\\Normalizer\\DateTimeZoneNormalizer` This normalizer converts :phpclass:`DateTimeZone` objects into strings that From f61c919fdf937f1827489a7c6d5e7fcac108db42 Mon Sep 17 00:00:00 2001 From: "hubert.lenoir" Date: Wed, 28 Dec 2022 13:39:22 +0100 Subject: [PATCH 154/477] [CssSelector] add support for :is() and :where() --- components/css_selector.rst | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/components/css_selector.rst b/components/css_selector.rst index c09f80a3cf4..1331a11e616 100644 --- a/components/css_selector.rst +++ b/components/css_selector.rst @@ -92,7 +92,11 @@ Pseudo-classes are partially supported: * Not supported: ``*:first-of-type``, ``*:last-of-type``, ``*:nth-of-type`` and ``*:nth-last-of-type`` (all these work with an element name (e.g. ``li:first-of-type``) but not with the ``*`` selector). -* Supported: ``*:only-of-type``, ``*:scope``. +* Supported: ``*:only-of-type``, ``*:scope``, ``*:is`` and ``*:where``. + +.. versionadded:: 7.1 + + The support for ``*:is`` and ``*:where`` was introduced in Symfony 7.1. Learn more ---------- From 41bea4ef40b243db07c8d462e448fc9c679cf43e Mon Sep 17 00:00:00 2001 From: Maxime Doutreluingne Date: Fri, 2 Feb 2024 19:09:24 +0100 Subject: [PATCH 155/477] Add message to #[MapEntity] for NotFoundHttpException --- doctrine.rst | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/doctrine.rst b/doctrine.rst index e4be23664d3..01bd2e0aff7 100644 --- a/doctrine.rst +++ b/doctrine.rst @@ -820,6 +820,21 @@ control behavior: ``disabled`` If true, the ``EntityValueResolver`` will not try to replace the argument. +``message`` + If a ``message`` option is configured, the value of the ``message`` option will be displayed in the development + environment for the :class:`Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException` exception:: + + #[Route('/product/{product_id}')] + public function show( + #[MapEntity(id: 'product_id', message: 'The product does not exist')] + Product $product + ): Response { + } + +.. versionadded:: 7.1 + + The ``message`` option was introduced in Symfony 7.1. + Updating an Object ------------------ From 71c5335e821e028bd79448c342c0dc4a983a8486 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Mon, 5 Feb 2024 12:56:11 +0100 Subject: [PATCH 156/477] Minor tweaks --- doctrine.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doctrine.rst b/doctrine.rst index 01bd2e0aff7..96239723d7e 100644 --- a/doctrine.rst +++ b/doctrine.rst @@ -821,8 +821,8 @@ control behavior: If true, the ``EntityValueResolver`` will not try to replace the argument. ``message`` - If a ``message`` option is configured, the value of the ``message`` option will be displayed in the development - environment for the :class:`Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException` exception:: + An optional custom message displayed when there's a :class:`Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException`, + but **only in the development environment** (you won't see this message in production):: #[Route('/product/{product_id}')] public function show( From 9fddcaf033423b25ce7deb32768de0b9d87cdccc Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Mon, 5 Feb 2024 12:59:58 +0100 Subject: [PATCH 157/477] [HttpFoundation] Mention `HeaderRequestMatcher` and `QueryParameterRequestMatcher` --- components/http_foundation.rst | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/components/http_foundation.rst b/components/http_foundation.rst index cd52464420f..4ecc36f4fba 100644 --- a/components/http_foundation.rst +++ b/components/http_foundation.rst @@ -388,17 +388,19 @@ address, it uses a certain HTTP method, etc.): * :class:`Symfony\\Component\\HttpFoundation\\RequestMatcher\\AttributesRequestMatcher` * :class:`Symfony\\Component\\HttpFoundation\\RequestMatcher\\ExpressionRequestMatcher` +* :class:`Symfony\\Component\\HttpFoundation\\RequestMatcher\\HeaderRequestMatcher` * :class:`Symfony\\Component\\HttpFoundation\\RequestMatcher\\HostRequestMatcher` * :class:`Symfony\\Component\\HttpFoundation\\RequestMatcher\\IpsRequestMatcher` * :class:`Symfony\\Component\\HttpFoundation\\RequestMatcher\\IsJsonMatcher` * :class:`Symfony\\Component\\HttpFoundation\\RequestMatcher\\MethodRequestMatcher` * :class:`Symfony\\Component\\HttpFoundation\\RequestMatcher\\PathRequestMatcher` * :class:`Symfony\\Component\\HttpFoundation\\RequestMatcher\\PortRequestMatcher` +* :class:`Symfony\\Component\\HttpFoundation\\RequestMatcher\\QueryParameterRequestMatcher` +* :class:`Symfony\\Component\\HttpFoundation\\RequestMatcher\\SchemeRequestMatcher` * :class:`Symfony\\Component\\HttpFoundation\\RequestMatcher\\SchemeRequestMatcher` You can use them individually or combine them using the -:class:`Symfony\\Component\\HttpFoundation\\ChainRequestMatcher` -class:: +:class:`Symfony\\Component\\HttpFoundation\\ChainRequestMatcher` class:: use Symfony\Component\HttpFoundation\ChainRequestMatcher; use Symfony\Component\HttpFoundation\RequestMatcher\HostRequestMatcher; @@ -421,6 +423,11 @@ class:: // ... } +.. versionadded:: 7.1 + + The ``HeaderRequestMatcher`` and ``QueryParameterRequestMatcher`` were + introduced in Symfony 7.1. + Accessing other Data ~~~~~~~~~~~~~~~~~~~~ From 4f75745ddfcba84bd3fbc7e41da181ca7950be5d Mon Sep 17 00:00:00 2001 From: Antoine Makdessi Date: Mon, 5 Feb 2024 08:35:06 +0100 Subject: [PATCH 158/477] Document `twig:lint` new option `excludes` --- templates.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/templates.rst b/templates.rst index 7b6bb1ce68a..2abbf8053cc 100644 --- a/templates.rst +++ b/templates.rst @@ -818,6 +818,13 @@ errors. It's useful to run it before deploying your application to production # you can also show the deprecated features used in your templates $ php bin/console lint:twig --show-deprecations templates/email/ + # you can also excludes directories + $ php bin/console lint:twig templates/ --excludes=data_collector --excludes=dev_tool + +.. versionadded:: 7.1 + + The option to exclude directories was introduced in Symfony 7.1. + When running the linter inside `GitHub Actions`_, the output is automatically adapted to the format required by GitHub, but you can force that format too: From 6144627161d4482330a5ccff46759d40325a8c86 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Mon, 5 Feb 2024 09:28:06 +0100 Subject: [PATCH 159/477] [Validator] Reword the list of options for the version option of the Ip constraint --- reference/constraints/Ip.rst | 80 +++++++----------------------------- 1 file changed, 15 insertions(+), 65 deletions(-) diff --git a/reference/constraints/Ip.rst b/reference/constraints/Ip.rst index 9168d463f77..20cd4400c0a 100644 --- a/reference/constraints/Ip.rst +++ b/reference/constraints/Ip.rst @@ -104,71 +104,21 @@ Parameter Description **type**: ``string`` **default**: ``4`` -This determines exactly *how* the IP address is validated and can take one -of a variety of different values: - -**All ranges** - -``4`` - Validates for IPv4 addresses -``6`` - Validates for IPv6 addresses -``all`` - Validates all IP formats - -**No private ranges** - -``4_no_priv`` - Validates for IPv4 but without private IP ranges -``6_no_priv`` - Validates for IPv6 but without private IP ranges -``all_no_priv`` - Validates for all IP formats but without private IP ranges - -**No reserved ranges** - -``4_no_res`` - Validates for IPv4 but without reserved IP ranges -``6_no_res`` - Validates for IPv6 but without reserved IP ranges -``all_no_res`` - Validates for all IP formats but without reserved IP ranges - -**No public ranges** - -``4_no_public`` - Validates for IPv4 but without public IP ranges -``6_no_public`` - Validates for IPv6 but without public IP ranges -``all_no_public`` - Validates for all IP formats but without public IP range - -**Only private ranges** - -``4_private`` - Validates for IPv4 but without public and reserved ranges -``6_private`` - Validates for IPv6 but without public and reserved ranges -``all_private`` - Validates for all IP formats but without public and reserved ranges - -**Only reserved ranges** - -``4_reserved`` - Validates for IPv4 but without private and public ranges -``6_reserved`` - Validates for IPv6 but without private and public ranges -``all_reserved`` - Validates for all IP formats but without private and public ranges - -**Only public ranges** - -``4_public`` - Validates for IPv4 but without private and reserved ranges -``6_public`` - Validates for IPv6 but without private and reserved ranges -``all_public`` - Validates for all IP formats but without private and reserved ranges +This determines exactly *how* the IP address is validated. This option defines a +lot of different possible values based on the ranges and the type of IP address +that you want to allow/deny: + +==================== =================== =================== ================== +Ranges Allowed IPv4 addresses only IPv6 addresses only Both IPv4 and IPv6 +==================== =================== =================== ================== +All ``4`` ``6`` ``all`` +All except private ``4_no_priv`` ``6_no_priv`` ``all_no_priv`` +All except reserved ``4_no_res`` ``6_no_res`` ``all_no_res`` +All except public ``4_no_public`` ``6_no_public`` ``all_no_public`` +Only private ``4_private`` ``6_private`` ``all_private`` +Only reserved ``4_reserved`` ``6_reserved`` ``all_reserved`` +Only public ``4_public`` ``6_public`` ``all_public`` +==================== =================== =================== ================== .. versionadded:: 7.1 From aefde3c393007dfc4c903f6efc0806cefad093ba Mon Sep 17 00:00:00 2001 From: Antoine Lamirault Date: Mon, 5 Feb 2024 20:49:39 +0100 Subject: [PATCH 160/477] Remove SchemeRequestMatcher duplication --- components/http_foundation.rst | 1 - 1 file changed, 1 deletion(-) diff --git a/components/http_foundation.rst b/components/http_foundation.rst index ee88fb14595..06d59f78cae 100644 --- a/components/http_foundation.rst +++ b/components/http_foundation.rst @@ -397,7 +397,6 @@ address, it uses a certain HTTP method, etc.): * :class:`Symfony\\Component\\HttpFoundation\\RequestMatcher\\PortRequestMatcher` * :class:`Symfony\\Component\\HttpFoundation\\RequestMatcher\\QueryParameterRequestMatcher` * :class:`Symfony\\Component\\HttpFoundation\\RequestMatcher\\SchemeRequestMatcher` -* :class:`Symfony\\Component\\HttpFoundation\\RequestMatcher\\SchemeRequestMatcher` You can use them individually or combine them using the :class:`Symfony\\Component\\HttpFoundation\\ChainRequestMatcher` class:: From 0e03673ac31503aced6df4e42d6f45b4807133d8 Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Tue, 6 Feb 2024 10:27:22 +0100 Subject: [PATCH 161/477] [HttpFoundation] Add support for `\SplTempFileObject` in `BinaryFileResponse` --- components/http_foundation.rst | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/components/http_foundation.rst b/components/http_foundation.rst index 06d59f78cae..b08aeb8380b 100644 --- a/components/http_foundation.rst +++ b/components/http_foundation.rst @@ -841,6 +841,23 @@ It is possible to delete the file after the response is sent with the :method:`Symfony\\Component\\HttpFoundation\\BinaryFileResponse::deleteFileAfterSend` method. Please note that this will not work when the ``X-Sendfile`` header is set. +Alternatively, ``BinaryFileResponse`` supports instances of ``\SplTempFileObject``. +This is useful when you want to serve a file that has been created in memory +and that will be automatically deleted after the response is sent:: + + use Symfony\Component\HttpFoundation\BinaryFileResponse; + + $file = new \SplTempFileObject(); + $file->fwrite('Hello World'); + $file->rewind(); + + $response = new BinaryFileResponse($file); + +.. versionadded:: 7.1 + + The support for ``\SplTempFileObject`` in ``BinaryFileResponse`` + was introduced in Symfony 7.1. + If the size of the served file is unknown (e.g. because it's being generated on the fly, or because a PHP stream filter is registered on it, etc.), you can pass a ``Stream`` instance to ``BinaryFileResponse``. This will disable ``Range`` and ``Content-Length`` From 4085aeddc191f7823ae0dc093310028259e54a65 Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Wed, 7 Feb 2024 13:26:03 +0100 Subject: [PATCH 162/477] [Serializer] Add Default and "class name" default groups --- serializer.rst | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/serializer.rst b/serializer.rst index e3480c0b035..701e5918848 100644 --- a/serializer.rst +++ b/serializer.rst @@ -383,6 +383,18 @@ stored in one of the following locations: * All ``*.yaml`` and ``*.xml`` files in the ``Resources/config/serialization/`` directory of a bundle. +.. note:: + + By default, the ``Default`` group is used when normalizing and denormalizing + objects. A group corresponding to the class name is also used. For example, + if you are normalizing a ``App\Entity\Product`` object, the ``Product`` group + is also included by default. + + .. versionadded:: 7.1 + + The default use of the class name and ``Default`` groups when normalizing + and denormalizing objects was introduced in Symfony 7.1. + .. _serializer-enabling-metadata-cache: Using Nested Attributes From 5d2b2a6fd738c48de9275535cf1522e972c5d5f4 Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Wed, 7 Feb 2024 13:32:43 +0100 Subject: [PATCH 163/477] [Yaml] Allow to get all the enum cases --- components/yaml.rst | 20 ++++++++++++++++++++ reference/formats/yaml.rst | 13 +++++++++++++ 2 files changed, 33 insertions(+) diff --git a/components/yaml.rst b/components/yaml.rst index 627fc4479e0..5f724e0572c 100644 --- a/components/yaml.rst +++ b/components/yaml.rst @@ -355,6 +355,26 @@ and the special ``!php/enum`` syntax to parse them as proper PHP enums:: // the value of the 'foo' key is a string because it missed the `!php/enum` syntax // $parameters = ['foo' => 'FooEnum::Foo', 'bar' => 'foo']; +You can also use ``!php/enum`` to get all the enumeration cases by only +giving the enumeration FQCN:: + + enum FooEnum: string + { + case Foo = 'foo'; + case Bar = 'bar'; + } + + // ... + + $yaml = '{ bar: !php/enum FooEnum }'; + $parameters = Yaml::parse($yaml, Yaml::PARSE_CONSTANT); + // $parameters = ['bar' => ['foo', 'bar']]; + +.. versionadded:: 7.1 + + The support for using the enum FQCN without specifying a case + was introduced in Symfony 7.1. + Parsing and Dumping of Binary Data ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/reference/formats/yaml.rst b/reference/formats/yaml.rst index 64adac599fb..6a61cafa74a 100644 --- a/reference/formats/yaml.rst +++ b/reference/formats/yaml.rst @@ -346,6 +346,19 @@ official YAML specification but are useful in Symfony applications: # ... or you can also use "->value" to directly use the value of a BackedEnum case operator_type: !php/enum App\Operator\Enum\Type::Or->value + This tag allows to omit the enum case and only provide the enum FQCN + to return an array of all available enum cases: + + .. code-block:: yaml + + data: + operator_types: !php/enum App\Operator\Enum\Type + + .. versionadded:: 7.1 + + The support for using the enum FQCN without specifying a case + was introduced in Symfony 7.1. + Unsupported YAML Features ~~~~~~~~~~~~~~~~~~~~~~~~~ From a3ba7fcc34f3cdcbc7880a99dc91b47a319661dd Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Wed, 7 Feb 2024 14:01:49 +0100 Subject: [PATCH 164/477] [ExpressionLanguage] Add flags support in `parse()` and `lint()` --- components/expression_language.rst | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/components/expression_language.rst b/components/expression_language.rst index d335710923e..038251066e1 100644 --- a/components/expression_language.rst +++ b/components/expression_language.rst @@ -112,6 +112,30 @@ other hand, returns a boolean indicating if the expression is valid or not:: var_dump($expressionLanguage->lint('1 + 2')); // displays true +The call to these methods can be configured through flags. The available flags +are available in the :class:`Symfony\\Component\\ExpressionLanguage\\Parser` class +and are the following: + +* ``IGNORE_UNKNOWN_VARIABLES``: don't throw an exception if a variable is not + defined in the expression; +* ``IGNORE_UNKNOWN_FUNCTIONS``: don't throw an exception if a function is not + defined in the expression. + +This is how you can use these flags:: + + use Symfony\Component\ExpressionLanguage\ExpressionLanguage; + use Symfony\Component\ExpressionLanguage\Parser; + + $expressionLanguage = new ExpressionLanguage(); + + // this return true because the unknown variables and functions are ignored + var_dump($expressionLanguage->lint('unknown_var + unknown_function()', Parser::IGNORE_UNKNOWN_VARIABLES | Parser::IGNORE_UNKNOWN_FUNCTIONS)); + +.. versionadded:: 7.1 + + The support for flags in the ``parse()`` and ``lint()`` methods + was introduced in Symfony 7.1. + Passing in Variables -------------------- From add92fa186a6e9d824f28bd1110d19674e20ca8b Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 7 Feb 2024 15:52:31 +0100 Subject: [PATCH 165/477] Minor tweak --- components/expression_language.rst | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/components/expression_language.rst b/components/expression_language.rst index d43b9df0f6f..fa07903bbb7 100644 --- a/components/expression_language.rst +++ b/components/expression_language.rst @@ -110,9 +110,8 @@ other hand, returns a boolean indicating if the expression is valid or not:: var_dump($expressionLanguage->lint('1 + 2')); // displays true -The call to these methods can be configured through flags. The available flags -are available in the :class:`Symfony\\Component\\ExpressionLanguage\\Parser` class -and are the following: +The behavior of these methods can be configured with some flags defined in the +:class:`Symfony\\Component\\ExpressionLanguage\\Parser` class: * ``IGNORE_UNKNOWN_VARIABLES``: don't throw an exception if a variable is not defined in the expression; @@ -126,7 +125,7 @@ This is how you can use these flags:: $expressionLanguage = new ExpressionLanguage(); - // this return true because the unknown variables and functions are ignored + // this returns true because the unknown variables and functions are ignored var_dump($expressionLanguage->lint('unknown_var + unknown_function()', Parser::IGNORE_UNKNOWN_VARIABLES | Parser::IGNORE_UNKNOWN_FUNCTIONS)); .. versionadded:: 7.1 From 28254a6b33eaa2cee81eb5e46cb68d2a05a4f7d4 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 7 Feb 2024 16:41:34 +0100 Subject: [PATCH 166/477] Minor reword --- serializer.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/serializer.rst b/serializer.rst index 701e5918848..6f75d65afc4 100644 --- a/serializer.rst +++ b/serializer.rst @@ -385,10 +385,10 @@ stored in one of the following locations: .. note:: - By default, the ``Default`` group is used when normalizing and denormalizing - objects. A group corresponding to the class name is also used. For example, - if you are normalizing a ``App\Entity\Product`` object, the ``Product`` group - is also included by default. + The groups used by default when normalizing and denormalizing objects are + ``Default`` and the group that matches the class name. For example, if you + are normalizing a ``App\Entity\Product`` object, the groups used are + ``Default`` and ``Product``. .. versionadded:: 7.1 From 56c8b4d41f09af3d32730bdbda4ac0f2944e860a Mon Sep 17 00:00:00 2001 From: Mathias Arlaud Date: Thu, 8 Feb 2024 10:14:03 +0100 Subject: [PATCH 167/477] [Serializer] Fix recursive custom normalizer --- serializer/custom_normalizer.rst | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/serializer/custom_normalizer.rst b/serializer/custom_normalizer.rst index 447076fff46..636ba70fd37 100644 --- a/serializer/custom_normalizer.rst +++ b/serializer/custom_normalizer.rst @@ -12,8 +12,8 @@ Creating a New Normalizer Imagine you want add, modify, or remove some properties during the serialization process. For that you'll have to create your own normalizer. But it's usually preferable to let Symfony normalize the object, then hook into the normalization -to customize the normalized data. To do that, leverage the -``NormalizerAwareInterface`` and the ``NormalizerAwareTrait``. This will give +to customize the normalized data. To do that, you can inject a +``NormalizerInterface`` and wire it to Symfony's object normalizer. This will give you access to a ``$normalizer`` property which takes care of most of the normalization process:: @@ -21,16 +21,16 @@ normalization process:: namespace App\Serializer; use App\Entity\Topic; + use Symfony\Component\DependencyInjection\Attribute\Autowire; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; - use Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface; - use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; - class TopicNormalizer implements NormalizerInterface, NormalizerAwareInterface + class TopicNormalizer implements NormalizerInterface { - use NormalizerAwareTrait; - public function __construct( + #[Autowire(service: 'serializer.normalizer.object')] + private readonly NormalizerInterface $normalizer, + private UrlGeneratorInterface $router, ) { } From ebd373cafcd0cfe49cc8bbde7ba64b567722e4ac Mon Sep 17 00:00:00 2001 From: Antoine Lamirault Date: Thu, 8 Feb 2024 17:54:25 +0100 Subject: [PATCH 168/477] Fix broken class links --- bundles/prepend_extension.rst | 4 ++-- service_container/service_subscribers_locators.rst | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bundles/prepend_extension.rst b/bundles/prepend_extension.rst index 4bd1c7c6a67..613cda7489f 100644 --- a/bundles/prepend_extension.rst +++ b/bundles/prepend_extension.rst @@ -187,7 +187,7 @@ method:: The ``prependExtension()`` method, like ``prepend()``, is called only at compile time. Alternatively, you can use the ``prepend`` parameter of the -:method:`Symfony\\Component\\DependencyInjection\\Loader\\ContainerConfigurator::extension` +:method:`Symfony\\Component\\DependencyInjection\\Loader\\Configurator\\ContainerConfigurator::extension` method:: use Symfony\Component\DependencyInjection\ContainerBuilder; @@ -211,7 +211,7 @@ method:: .. versionadded:: 7.1 The ``prepend`` parameter of the - :method:`Symfony\\Component\\DependencyInjection\\Loader\\ContainerConfigurator::extension` + :method:`Symfony\\Component\\DependencyInjection\\Loader\\Configurator\\ContainerConfigurator::extension` method was added in Symfony 7.1. More than one Bundle using PrependExtensionInterface diff --git a/service_container/service_subscribers_locators.rst b/service_container/service_subscribers_locators.rst index 31a9fa55f3b..21a7ab295d2 100644 --- a/service_container/service_subscribers_locators.rst +++ b/service_container/service_subscribers_locators.rst @@ -123,7 +123,7 @@ In this example, the ``$handler`` service is only instantiated when the You can also type-hint the service locator argument with :class:`Symfony\\Contracts\\Service\\ServiceCollectionInterface` instead of -:class:`Psr\\Container\\ContainerInterface`. By doing so, you'll be able to +``Psr\Container\ContainerInterface``. By doing so, you'll be able to count and iterate over the services of the locator:: // ... From c881eab2864a24d9ec567d06630eeaa2d6331373 Mon Sep 17 00:00:00 2001 From: Antoine Lamirault Date: Thu, 8 Feb 2024 19:55:50 +0100 Subject: [PATCH 169/477] [Security] add CAS 2.0 AccessToken handler --- security/access_token.rst | 188 +++++++++++++++++++++++++++++++++++++- 1 file changed, 185 insertions(+), 3 deletions(-) diff --git a/security/access_token.rst b/security/access_token.rst index 29fbfbc8bb6..83e33bae901 100644 --- a/security/access_token.rst +++ b/security/access_token.rst @@ -697,6 +697,187 @@ create your own User from the claims, you must } } +Using CAS 2.0 +------------- + +`Central Authentication Service (CAS)`_ is an enterprise multilingual single +sign-on solution and identity provider for the web and attempts to be a +comprehensive platform for your authentication and authorization needs. + +Configure the Cas2Handler +~~~~~~~~~~~~~~~~~~~~~~~~~ + +Symfony provides a generic ``Cas2Handler`` to call your CAS server. It requires +the ``symfony/http-client`` package to make the needed HTTP requests. If you +haven't installed it yet, run this command: + +.. code-block:: terminal + + $ composer require symfony/http-client + +You can configure a ``cas`` ``token_handler``: + +.. configuration-block:: + + .. code-block:: yaml + + # config/packages/security.yaml + security: + firewalls: + main: + access_token: + token_handler: + cas: + validation_url: https://www.example.com/cas/validate + + .. code-block:: xml + + + + + + + + + + + + + + + + + .. code-block:: php + + // config/packages/security.php + use Symfony\Config\SecurityConfig; + + return static function (SecurityConfig $security) { + $security->firewall('main') + ->accessToken() + ->tokenHandler() + ->cas() + ->validationUrl('https://www.example.com/cas/validate') + ; + }; + +The ``cas`` token handler automatically creates an HTTP client to call +the specified ``validation_url``. If you prefer using your own client, you can +specify the service name via the ``http_client`` option: + +.. configuration-block:: + + .. code-block:: yaml + + # config/packages/security.yaml + security: + firewalls: + main: + access_token: + token_handler: + cas: + validation_url: https://www.example.com/cas/validate + http_client: cas.client + + .. code-block:: xml + + + + + + + + + + + + + + + + + .. code-block:: php + + // config/packages/security.php + use Symfony\Config\SecurityConfig; + + return static function (SecurityConfig $security) { + $security->firewall('main') + ->accessToken() + ->tokenHandler() + ->cas() + ->validationUrl('https://www.example.com/cas/validate') + ->httpClient('cas.client') + ; + }; + +By default the token handler will read the validation URL XML response with + ``cas`` prefix but you can configure another prefix: + +.. configuration-block:: + + .. code-block:: yaml + + # config/packages/security.yaml + security: + firewalls: + main: + access_token: + token_handler: + cas: + validation_url: https://www.example.com/cas/validate + prefix: cas-example + + .. code-block:: xml + + + + + + + + + + + + + + + + + .. code-block:: php + + // config/packages/security.php + use Symfony\Config\SecurityConfig; + + return static function (SecurityConfig $security) { + $security->firewall('main') + ->accessToken() + ->tokenHandler() + ->cas() + ->validationUrl('https://www.example.com/cas/validate') + ->prefix('cas-example') + ; + }; + Creating Users from Token ------------------------- @@ -727,8 +908,9 @@ need a user provider to create a user from the database:: When using this strategy, you can omit the ``user_provider`` configuration for :ref:`stateless firewalls `. +.. _`Central Authentication Service (CAS)`: https://en.wikipedia.org/wiki/Central_Authentication_Service .. _`JSON Web Tokens (JWT)`: https://datatracker.ietf.org/doc/html/rfc7519 -.. _`SAML2 (XML structures)`: https://docs.oasis-open.org/security/saml/Post2.0/sstc-saml-tech-overview-2.0.html -.. _`RFC6750`: https://datatracker.ietf.org/doc/html/rfc6750 -.. _`OpenID Connect Specification`: https://openid.net/specs/openid-connect-core-1_0.html .. _`OpenID Connect (OIDC)`: https://en.wikipedia.org/wiki/OpenID#OpenID_Connect_(OIDC) +.. _`OpenID Connect Specification`: https://openid.net/specs/openid-connect-core-1_0.html +.. _`RFC6750`: https://datatracker.ietf.org/doc/html/rfc6750 +.. _`SAML2 (XML structures)`: https://docs.oasis-open.org/security/saml/Post2.0/sstc-saml-tech-overview-2.0.html From 998929c21bbbaf9de1e3aa65d43309c951bf767b Mon Sep 17 00:00:00 2001 From: William Pinaud Date: Wed, 31 Jan 2024 12:36:17 +0100 Subject: [PATCH 170/477] Update form.rst for flattened form errors Updated to reflect the code. --- components/form.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/components/form.rst b/components/form.rst index 42a5a00bbae..7584d223032 100644 --- a/components/form.rst +++ b/components/form.rst @@ -749,10 +749,11 @@ method to access the list of errors. It returns a // "firstName" field $errors = $form['firstName']->getErrors(); - // a FormErrorIterator instance in a flattened structure + // a FormErrorIterator instance including child forms in a flattened structure + // use getOrigin() to determine the form causing the error $errors = $form->getErrors(true); - // a FormErrorIterator instance representing the form tree structure + // a FormErrorIterator instance including child forms without flattening the output structure $errors = $form->getErrors(true, false); Clearing Form Errors From 91d8296e948cce1ce4a11cb2d63cf31a1750fba4 Mon Sep 17 00:00:00 2001 From: Antoine Lamirault Date: Fri, 9 Feb 2024 19:31:40 +0100 Subject: [PATCH 171/477] [Config] Allow custom meta location in ConfigCache --- components/config/caching.rst | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/components/config/caching.rst b/components/config/caching.rst index 810db48107e..18620c0d8cf 100644 --- a/components/config/caching.rst +++ b/components/config/caching.rst @@ -55,3 +55,17 @@ the cache file itself. This ``.meta`` file contains the serialized resources, whose timestamps are used to determine if the cache is still fresh. When not in debug mode, the cache is considered to be "fresh" as soon as it exists, and therefore no ``.meta`` file will be generated. + +You can explicitly define the absolute path to the meta file:: + + use Symfony\Component\Config\ConfigCache; + use Symfony\Component\Config\Resource\FileResource; + + $cachePath = __DIR__.'/cache/appUserMatcher.php'; + + // the third optional argument indicates the absolute path to the meta file + $userMatcherCache = new ConfigCache($cachePath, true, '/my/absolute/path/to/cache.meta'); + +.. versionadded:: 7.1 + + The argument to customize the meta file path was introduced in Symfony 7.1. From f4d9b2c595d23b936541770c471d3631881f740e Mon Sep 17 00:00:00 2001 From: Antoine Lamirault Date: Mon, 12 Feb 2024 19:13:01 +0100 Subject: [PATCH 172/477] Minor: remove duplicated lines --- components/dependency_injection.rst | 1 - migration.rst | 1 - reference/configuration/framework.rst | 26 ------------------------- reference/configuration/security.rst | 1 - reference/constraints/Unique.rst | 1 - workflow/workflow-and-state-machine.rst | 1 - 6 files changed, 31 deletions(-) diff --git a/components/dependency_injection.rst b/components/dependency_injection.rst index 79b35bf312e..93e8af711cf 100644 --- a/components/dependency_injection.rst +++ b/components/dependency_injection.rst @@ -178,7 +178,6 @@ You can override this behavior as follows:: // the second argument is optional and defines what to do when the service doesn't exist $newsletterManager = $containerBuilder->get('newsletter_manager', ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE); - These are all the possible behaviors: * ``ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE``: throws an exception diff --git a/migration.rst b/migration.rst index 16fa43fa281..44485248545 100644 --- a/migration.rst +++ b/migration.rst @@ -340,7 +340,6 @@ somewhat like this:: throw new \Exception("Unhandled legacy mapping for $requestPathInfo"); } - public static function handleRequest(Request $request, Response $response, string $publicDirectory): void { $legacyScriptFilename = LegacyBridge::getLegacyScript($request); diff --git a/reference/configuration/framework.rst b/reference/configuration/framework.rst index 2491b94de5f..23975913173 100644 --- a/reference/configuration/framework.rst +++ b/reference/configuration/framework.rst @@ -2847,32 +2847,6 @@ annotation changes). For performance reasons, it is recommended to disable debug mode in production, which will happen automatically if you use the default value. -secrets -~~~~~~~ - -decryption_env_var -.................. - -**type**: ``string`` **default**: ``base64:default::SYMFONY_DECRYPTION_SECRET`` - -The environment variable that contains the decryption key. - -local_dotenv_file -................. - -**type**: ``string`` **default**: ``%kernel.project_dir%/.env.%kernel.environment%.local`` - -Path to an dotenv file that holds secrets. This is primarily used for testing. - -vault_directory -............... - -**type**: ``string`` **default**: ``%kernel.project_dir%/config/secrets/%kernel.environment%`` - -The directory where the vault of secrets is stored. - -.. _configuration-framework-serializer: - serializer ~~~~~~~~~~ diff --git a/reference/configuration/security.rst b/reference/configuration/security.rst index 64a16c7d616..590f2472425 100644 --- a/reference/configuration/security.rst +++ b/reference/configuration/security.rst @@ -495,7 +495,6 @@ user logs out:: ->domain('example.com'); }; - clear_site_data ............... diff --git a/reference/constraints/Unique.rst b/reference/constraints/Unique.rst index c7ee71329c4..8954f455086 100644 --- a/reference/constraints/Unique.rst +++ b/reference/constraints/Unique.rst @@ -95,7 +95,6 @@ Options **type**: ``array`` | ``string`` - This is defines the key or keys in a collection that should be checked for uniqueness. By default, all collection keys are checked for uniqueness. diff --git a/workflow/workflow-and-state-machine.rst b/workflow/workflow-and-state-machine.rst index e72b50f8d1e..c94214fc22f 100644 --- a/workflow/workflow-and-state-machine.rst +++ b/workflow/workflow-and-state-machine.rst @@ -282,7 +282,6 @@ machine type, use ``camelCased workflow name + StateMachine``:: // ... } - Automatic and Manual Validation ------------------------------- From 77c49b3fef00aa7b9f5df6d2ec88b4faaf6a38ed Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Tue, 13 Feb 2024 11:44:48 +0100 Subject: [PATCH 173/477] [Workflow] Support omitting `places` option --- workflow.rst | 17 ++++++++++++++++- workflow/workflow-and-state-machine.rst | 11 +++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/workflow.rst b/workflow.rst index 99d23cdcfae..7e45c7693c1 100644 --- a/workflow.rst +++ b/workflow.rst @@ -60,7 +60,7 @@ follows: supports: - App\Entity\BlogPost initial_marking: draft - places: + places: # defining places manually is optional - draft - reviewed - rejected @@ -97,10 +97,13 @@ follows: App\Entity\BlogPost draft + + draft reviewed rejected published + draft reviewed @@ -135,6 +138,7 @@ follows: ->type('method') ->property('currentPlace'); + // defining places manually is optional $blogPublishing->place()->name('draft'); $blogPublishing->place()->name('reviewed'); $blogPublishing->place()->name('rejected'); @@ -168,6 +172,17 @@ follows: ``'draft'`` or ``!php/const App\Entity\BlogPost::TRANSITION_TO_REVIEW`` instead of ``'to_review'``. +.. tip:: + + You can omit the ``places`` option if your transitions define all the places + that are used in the workflow. Symfony will automatically extract the places + from the transitions. + + .. versionadded:: 7.1 + + The support for omitting the ``places`` option was introduced in + Symfony 7.1. + The configured property will be used via its implemented getter/setter methods by the marking store:: // src/Entity/BlogPost.php diff --git a/workflow/workflow-and-state-machine.rst b/workflow/workflow-and-state-machine.rst index e72b50f8d1e..04abf590f2f 100644 --- a/workflow/workflow-and-state-machine.rst +++ b/workflow/workflow-and-state-machine.rst @@ -252,6 +252,17 @@ Below is the configuration for the pull request state machine. ->to(['review']); }; +.. tip:: + + You can omit the ``places`` option if your transitions define all the places + that are used in the workflow. Symfony will automatically extract the places + from the transitions. + + .. versionadded:: 7.1 + + The support for omitting the ``places`` option was introduced in + Symfony 7.1. + Symfony automatically creates a service for each workflow (:class:`Symfony\\Component\\Workflow\\Workflow`) or state machine (:class:`Symfony\\Component\\Workflow\\StateMachine`) you have defined in your configuration. You can use the workflow inside a class by using From e1203e74eebfad066a7acef86781608999d0e9e5 Mon Sep 17 00:00:00 2001 From: Joseph Bielawski Date: Wed, 14 Feb 2024 10:29:01 +0100 Subject: [PATCH 174/477] [Notifier] Add Pushy docs --- notifier.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/notifier.rst b/notifier.rst index 774294c3577..4e16edaf039 100644 --- a/notifier.rst +++ b/notifier.rst @@ -453,11 +453,16 @@ Service Package DSN `OneSignal`_ ``symfony/one-signal-notifier`` ``onesignal://APP_ID:API_KEY@default?defaultRecipientId=DEFAULT_RECIPIENT_ID`` `PagerDuty`_ ``symfony/pager-duty-notifier`` ``pagerduty://TOKEN@SUBDOMAIN`` `Pushover`_ ``symfony/pushover-notifier`` ``pushover://USER_KEY:APP_TOKEN@default`` +`Pushy`_ ``symfony/pushy-notifier`` ``pushy://API_KEY@default`` =============== ==================================== ============================================================================== To enable a texter, add the correct DSN in your ``.env`` file and configure the ``texter_transports``: +.. versionadded:: 7.1 + + The `Pushy`_ integration was introduced in Symfony 7.1. + .. code-block:: bash # .env @@ -1019,6 +1024,7 @@ is dispatched. Listeners receive a .. _`PagerDuty`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/PagerDuty/README.md .. _`Plivo`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Plivo/README.md .. _`Pushover`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Pushover/README.md +.. _`Pushy`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Pushy/README.md .. _`Redlink`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Redlink/README.md .. _`RFC 3986`: https://www.ietf.org/rfc/rfc3986.txt .. _`RingCentral`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/RingCentral/README.md From f3d9113d5a5d988144cc2b57d8a2b05cb4c01aad Mon Sep 17 00:00:00 2001 From: Xbird Date: Wed, 21 Feb 2024 21:59:16 +0100 Subject: [PATCH 175/477] Replace old docker compose filename docker-compose.yml/yaml to compose.yaml --- .doctor-rst.yaml | 1 + setup/docker.rst | 2 +- setup/symfony_server.rst | 12 ++++++------ 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.doctor-rst.yaml b/.doctor-rst.yaml index ac51116da5b..f4c48a0bf54 100644 --- a/.doctor-rst.yaml +++ b/.doctor-rst.yaml @@ -93,6 +93,7 @@ whitelist: - '/``.yml``/' - '/(.*)\.orm\.yml/' # currently DoctrineBundle only supports .yml - /docker-compose\.yml/ + - /compose\.yaml/ lines: - 'in config files, so the old ``app/config/config_dev.yml`` goes to' - '#. The most important config file is ``app/config/services.yml``, which now is' diff --git a/setup/docker.rst b/setup/docker.rst index 63da416e7bf..c00192e08d4 100644 --- a/setup/docker.rst +++ b/setup/docker.rst @@ -19,7 +19,7 @@ Flex Recipes & Docker Configuration The :ref:`Flex recipe ` for some packages also include Docker configuration. For example, when you run ``composer require doctrine`` (to get ``symfony/orm-pack``), -your ``docker-compose.yml`` file will automatically be updated to include a +your ``compose.yaml`` file will automatically be updated to include a ``database`` service. The first time you install a recipe containing Docker config, Flex will ask you diff --git a/setup/symfony_server.rst b/setup/symfony_server.rst index c6b817ebdb5..6c666a7ad2e 100644 --- a/setup/symfony_server.rst +++ b/setup/symfony_server.rst @@ -388,7 +388,7 @@ Consider the following configuration: .. code-block:: yaml - # docker-compose.yaml + # compose.yaml services: database: ports: [3306] @@ -401,12 +401,12 @@ variables accordingly with the service name (``database``) as a prefix: If the service is not in the supported list below, generic environment variables are set: ``PORT``, ``IP``, and ``HOST``. -If the ``docker-compose.yaml`` names do not match Symfony's conventions, add a +If the ``compose.yaml`` names do not match Symfony's conventions, add a label to override the environment variables prefix: .. code-block:: yaml - # docker-compose.yaml + # compose.yaml services: db: ports: [3306] @@ -471,7 +471,7 @@ check the "Symfony Server" section in the web debug toolbar; you'll see that .. code-block:: yaml - # docker-compose.yaml + # compose.yaml services: db: ports: [3306] @@ -485,10 +485,10 @@ its location, same as for ``docker-compose``: .. code-block:: bash # start your containers: - COMPOSE_FILE=docker/docker-compose.yaml COMPOSE_PROJECT_NAME=project_name docker-compose up -d + COMPOSE_FILE=docker/compose.yaml COMPOSE_PROJECT_NAME=project_name docker-compose up -d # run any Symfony CLI command: - COMPOSE_FILE=docker/docker-compose.yaml COMPOSE_PROJECT_NAME=project_name symfony var:export + COMPOSE_FILE=docker/compose.yaml COMPOSE_PROJECT_NAME=project_name symfony var:export .. note:: From 4fc32cdad4d9a6a1373ca267e0066b774316f2e4 Mon Sep 17 00:00:00 2001 From: Valentin-Nicusor Barbu Date: Thu, 8 Feb 2024 13:50:42 +0200 Subject: [PATCH 176/477] [Notifier] [SMSense] add docs --- notifier.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/notifier.rst b/notifier.rst index 774294c3577..3cf7f19d3df 100644 --- a/notifier.rst +++ b/notifier.rst @@ -96,6 +96,7 @@ Service Package DSN `Smsapi`_ ``symfony/smsapi-notifier`` ``smsapi://TOKEN@default?from=FROM`` `Smsbox`_ ``symfony/smsbox-notifier`` ``smsbox://APIKEY@default?mode=MODE&strategy=STRATEGY&sender=SENDER`` `Smsc`_ ``symfony/smsc-notifier`` ``smsc://LOGIN:PASSWORD@default?from=FROM`` +`SMSense`_ ``symfony/smsense-notifier`` ``smsense://API_TOKEN@default?from=FROM`` `SpotHit`_ ``symfony/spot-hit-notifier`` ``spothit://TOKEN@default?from=FROM`` `Telnyx`_ ``symfony/telnyx-notifier`` ``telnyx://API_KEY@default?from=FROM&messaging_profile_id=MESSAGING_PROFILE_ID`` `TurboSms`_ ``symfony/turbo-sms-notifier`` ``turbosms://AUTH_TOKEN@default?from=FROM`` @@ -114,7 +115,7 @@ Service Package DSN .. versionadded:: 7.1 - The `SmsSluzba`_ integration was introduced in Symfony 7.1. + The `SmsSluzba`_ and `SMSense`_ integrations were introduced in Symfony 7.1. .. deprecated:: 7.1 From 7c5c13f00a06be24f903c21bc422a037e4012097 Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Fri, 23 Feb 2024 08:46:30 +0100 Subject: [PATCH 177/477] - --- notifier.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/notifier.rst b/notifier.rst index 1241298d3ee..be51386544a 100644 --- a/notifier.rst +++ b/notifier.rst @@ -1041,6 +1041,7 @@ is dispatched. Listeners receive a .. _`Smsbox`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Smsbox/README.md .. _`Smsapi`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Smsapi/README.md .. _`Smsc`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Smsc/README.md +.. _`SMSense`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/SMSense/README.md .. _`SmsSluzba`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/SmsSluzba/README.md .. _`SpotHit`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/SpotHit/README.md .. _`Telegram`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Telegram/README.md From 858f548a0db0c335578be3307bd664e06aa98615 Mon Sep 17 00:00:00 2001 From: Antoine M Date: Mon, 26 Feb 2024 07:07:42 +0100 Subject: [PATCH 178/477] chore: document minor upgrade with latest versions follows https://github.com/symfony/symfony-docs/pull/19599 --- setup/upgrade_minor.rst | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/setup/upgrade_minor.rst b/setup/upgrade_minor.rst index 9e8c6943d1f..ec00e142b82 100644 --- a/setup/upgrade_minor.rst +++ b/setup/upgrade_minor.rst @@ -1,4 +1,4 @@ -Upgrading a Minor Version (e.g. 5.0.0 to 5.1.0) +Upgrading a Minor Version (e.g. 6.3.0 to 6.4.0) =============================================== If you're upgrading a minor version (where the middle number changes), then @@ -21,7 +21,7 @@ There are two steps to upgrading a minor version: The ``composer.json`` file is configured to allow Symfony packages to be upgraded to patch versions. But to upgrade to a new minor version, you will probably need to update the version constraint next to each library starting -``symfony/``. Suppose you are upgrading from Symfony 5.3 to 5.4: +``symfony/``. Suppose you are upgrading from Symfony 6.3 to 6.4: .. code-block:: diff @@ -29,19 +29,17 @@ probably need to update the version constraint next to each library starting "...": "...", "require": { - - "symfony/cache": "5.3.*", - + "symfony/cache": "5.4.*", - - "symfony/config": "5.3.*", - + "symfony/config": "5.4.*", - - "symfony/console": "5.3.*", - + "symfony/console": "5.4.*", + - "symfony/config": "6.3.*", + + "symfony/config": "6.4.*", + - "symfony/console": "6.3.*", + + "symfony/console": "6.4.*", "...": "...", "...": "A few libraries starting with symfony/ follow their own versioning scheme. You do not need to update these versions: you can upgrade them independently whenever you want", - "symfony/monolog-bundle": "^3.5", + "symfony/monolog-bundle": "^3.10", }, "...": "...", } @@ -54,8 +52,8 @@ Your ``composer.json`` file should also have an ``extra`` block that you will "extra": { "symfony": { "...": "...", - - "require": "5.3.*" - + "require": "5.4.*" + - "require": "6.3.*" + + "require": "6.4.*" } } @@ -79,7 +77,7 @@ to your code to get everything working. Additionally, some features you're using might still work, but might now be deprecated. While that's fine, if you know about these deprecations, you can start to fix them over time. -Every version of Symfony comes with an UPGRADE file (e.g. `UPGRADE-5.4.md`_) +Every version of Symfony comes with an UPGRADE file (e.g. `UPGRADE-6.4.md`_) included in the Symfony directory that describes these changes. If you follow the instructions in the document and update your code accordingly, it should be safe to update in the future. @@ -97,5 +95,5 @@ These documents can also be found in the `Symfony Repository`_. .. include:: /setup/_update_recipes.rst.inc .. _`Symfony Repository`: https://github.com/symfony/symfony -.. _`UPGRADE-5.4.md`: https://github.com/symfony/symfony/blob/5.4/UPGRADE-5.4.md +.. _`UPGRADE-6.4.md`: https://github.com/symfony/symfony/blob/6.4/UPGRADE-6.4.md .. _`Rector`: https://github.com/rectorphp/rector From cbac28f28e9e8c9ac236717730057db8ff3ae613 Mon Sep 17 00:00:00 2001 From: Antoine M Date: Mon, 26 Feb 2024 07:13:01 +0100 Subject: [PATCH 179/477] chore: document major upgrade with latest versions ref https://github.com/symfony/symfony-docs/pull/19600 --- setup/upgrade_major.rst | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/setup/upgrade_major.rst b/setup/upgrade_major.rst index 9e18c88ccd6..13f6feab6d1 100644 --- a/setup/upgrade_major.rst +++ b/setup/upgrade_major.rst @@ -1,4 +1,4 @@ -Upgrading a Major Version (e.g. 5.4.0 to 6.0.0) +Upgrading a Major Version (e.g. 6.4.0 to 7.0.0) =============================================== Every two years, Symfony releases a new major version release (the first number @@ -27,10 +27,10 @@ backwards incompatible changes. To accomplish this, the "old" (e.g. functions, classes, etc) code still works, but is marked as *deprecated*, indicating that it will be removed/changed in the future and that you should stop using it. -When the major version is released (e.g. 6.0.0), all deprecated features and +When the major version is released (e.g. 7.0.0), all deprecated features and functionality are removed. So, as long as you've updated your code to stop using these deprecated features in the last version before the major (e.g. -``5.4.*``), you should be able to upgrade without a problem. That means that +``6.4.*``), you should be able to upgrade without a problem. That means that you should first :doc:`upgrade to the last minor version ` (e.g. 5.4) so that you can see *all* the deprecations. @@ -107,7 +107,7 @@ done! .. sidebar:: Using the Weak Deprecations Mode Sometimes, you can't fix all deprecations (e.g. something was deprecated - in 5.4 and you still need to support 5.3). In these cases, you can still + in 6.4 and you still need to support 6.3). In these cases, you can still use the bridge to fix as many deprecations as possible and then allow more of them to make your tests pass again. You can do this by using the ``SYMFONY_DEPRECATIONS_HELPER`` env variable: @@ -144,12 +144,10 @@ starting with ``symfony/`` to the new major version: "...": "...", "require": { - - "symfony/cache": "5.4.*", - + "symfony/cache": "6.0.*", - - "symfony/config": "5.4.*", - + "symfony/config": "6.0.*", - - "symfony/console": "5.4.*", - + "symfony/console": "6.0.*", + - "symfony/config": "6.4.*", + + "symfony/config": "7.0.*", + - "symfony/console": "6.4.*", + + "symfony/console": "7.0.*", "...": "...", "...": "A few libraries starting with symfony/ follow their own @@ -157,22 +155,22 @@ starting with ``symfony/`` to the new major version: symfony/ux-[...], symfony/[...]-bundle). You do not need to update these versions: you can upgrade them independently whenever you want", - "symfony/monolog-bundle": "^3.5", + "symfony/monolog-bundle": "^3.10", }, "...": "...", } At the bottom of your ``composer.json`` file, in the ``extra`` block you can find a data setting for the Symfony version. Make sure to also upgrade -this one. For instance, update it to ``6.0.*`` to upgrade to Symfony 6.0: +this one. For instance, update it to ``7.0.*`` to upgrade to Symfony 7.0: .. code-block:: diff "extra": { "symfony": { "allow-contrib": false, - - "require": "5.4.*" - + "require": "6.0.*" + - "require": "6.4.*" + + "require": "7.0.*" } } @@ -215,13 +213,13 @@ included in the Symfony repository for any BC break that you need to be aware of Upgrading to Symfony 6: Add Native Return Types ----------------------------------------------- -Symfony 6 will come with native PHP return types to (almost all) methods. +Symfony 6 and Symfony 6 have come with native PHP return types to (almost all) methods. In PHP, if the parent has a return type declaration, any class implementing or overriding the method must have the return type as well. However, you can add a return type before the parent adds one. This means that it is important to add the native PHP return types to your classes before -upgrading to Symfony 6.0. Otherwise, you will get incompatible declaration +upgrading to Symfony 6.0 or 7.0. Otherwise, you will get incompatible declaration errors. When debug mode is enabled (typically in the dev and test environment), From 3dd28c0de085154c76848717267ade1ae6f09d4e Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Mon, 26 Feb 2024 09:08:27 +0100 Subject: [PATCH 180/477] [Clock] Introduce `get/setMicroseconds()` --- components/clock.rst | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/components/clock.rst b/components/clock.rst index b803c78e29d..d3879fba84e 100644 --- a/components/clock.rst +++ b/components/clock.rst @@ -235,6 +235,23 @@ The constructor also allows setting a timezone or custom referenced date:: error handling across versions of PHP, thanks to polyfilling `PHP 8.3's behavior`_ on the topic. +``DatePoint`` also allows to set and get the microsecond part of the date and time:: + + $datePoint = new DatePoint(); + $datePoint->setMicroseconds(345); + $microseconds = $datePoint->getMicroseconds(); + +.. note:: + + This feature polyfills PHP 8.4's behavior on the topic, as microseconds manipulation + is not available in previous versions of PHP. + +.. versionadded:: 7.1 + + The :method:`Symfony\\Component\\Clock\\DatePoint::setMicroseconds` and + :method:`Symfony\\Component\\Clock\\DatePoint::getMicroseconds` methods were + introduced in Symfony 7.1. + .. _clock_writing-tests: Writing Time-Sensitive Tests From 657ba77f68175293cbbabd2c789ddc9e89d44cb6 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Mon, 26 Feb 2024 13:33:08 +0100 Subject: [PATCH 181/477] Minor fix --- setup/upgrade_major.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup/upgrade_major.rst b/setup/upgrade_major.rst index 13f6feab6d1..13f839f36e1 100644 --- a/setup/upgrade_major.rst +++ b/setup/upgrade_major.rst @@ -213,7 +213,7 @@ included in the Symfony repository for any BC break that you need to be aware of Upgrading to Symfony 6: Add Native Return Types ----------------------------------------------- -Symfony 6 and Symfony 6 have come with native PHP return types to (almost all) methods. +Symfony 6 and Symfony 7 added native PHP return types to (almost all) methods. In PHP, if the parent has a return type declaration, any class implementing or overriding the method must have the return type as well. However, you From f5e545fd7f6640673f7f9524227fbc7934f172d2 Mon Sep 17 00:00:00 2001 From: Matthieu Lempereur Date: Tue, 5 Mar 2024 11:41:48 +0100 Subject: [PATCH 182/477] remove outdated directive --- frontend/asset_mapper.rst | 5 ----- 1 file changed, 5 deletions(-) diff --git a/frontend/asset_mapper.rst b/frontend/asset_mapper.rst index 8815126dd26..31bbf3718c9 100644 --- a/frontend/asset_mapper.rst +++ b/frontend/asset_mapper.rst @@ -233,11 +233,6 @@ You can update your third-party packages to their current versions by running: $ php bin/console importmap:update bootstrap lodash $ php bin/console importmap:outdated bootstrap lodash -.. versionadded:: 6.4 - - The ``importmap:install`` and ``importmap:outdated`` commands were introduced - in Symfony 6.4. - How does the importmap Work? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ From effeaf7a38f949722ad319222a5c9c69d2f4c0b8 Mon Sep 17 00:00:00 2001 From: Simon Date: Sat, 9 Mar 2024 08:55:33 +0100 Subject: [PATCH 183/477] Replace Webpack with AssetMapper --- templates.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates.rst b/templates.rst index 3ba9b9f59a5..05de5856878 100644 --- a/templates.rst +++ b/templates.rst @@ -330,7 +330,7 @@ Build, Versioning & More Advanced CSS, JavaScript and Image Handling ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ For help building, versioning and minifying your JavaScript and -CSS assets in a modern way, read about :doc:`Symfony's Webpack Encore `. +CSS assets in a modern way, read about :doc:`Symfony's Asset Mapper `. .. _twig-app-variable: From ea8efb0d8d05684afd0bdc2ab71dfbbe014973c8 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Mon, 11 Mar 2024 08:16:57 +0100 Subject: [PATCH 184/477] update method names to reflect latest code changes --- components/clock.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/components/clock.rst b/components/clock.rst index d3879fba84e..45ec484eef5 100644 --- a/components/clock.rst +++ b/components/clock.rst @@ -238,8 +238,8 @@ The constructor also allows setting a timezone or custom referenced date:: ``DatePoint`` also allows to set and get the microsecond part of the date and time:: $datePoint = new DatePoint(); - $datePoint->setMicroseconds(345); - $microseconds = $datePoint->getMicroseconds(); + $datePoint->setMicrosecond(345); + $microseconds = $datePoint->getMicrosecond(); .. note:: @@ -248,8 +248,8 @@ The constructor also allows setting a timezone or custom referenced date:: .. versionadded:: 7.1 - The :method:`Symfony\\Component\\Clock\\DatePoint::setMicroseconds` and - :method:`Symfony\\Component\\Clock\\DatePoint::getMicroseconds` methods were + The :method:`Symfony\\Component\\Clock\\DatePoint::setMicrosecond` and + :method:`Symfony\\Component\\Clock\\DatePoint::getMicrosecond` methods were introduced in Symfony 7.1. .. _clock_writing-tests: From bbe6d9133aaaec4cf870f109b8f8c4d77e127a31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Pillevesse?= Date: Mon, 11 Mar 2024 09:06:22 +0100 Subject: [PATCH 185/477] Update pull_requests.rst --- contributing/code/pull_requests.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contributing/code/pull_requests.rst b/contributing/code/pull_requests.rst index 95ee6bb89a6..7c9ab2579a5 100644 --- a/contributing/code/pull_requests.rst +++ b/contributing/code/pull_requests.rst @@ -31,7 +31,7 @@ Before working on Symfony, setup a friendly environment with the following software: * Git; -* PHP version 7.2.5 or above. +* PHP version 8.2 or above. Configure Git ~~~~~~~~~~~~~ From 075c29fa816c1a29c9d23d6418950b7e67bd2e9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Pillevesse?= Date: Sun, 10 Mar 2024 15:41:43 +0100 Subject: [PATCH 186/477] Update contributing/code/tests.rst page --- contributing/code/tests.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contributing/code/tests.rst b/contributing/code/tests.rst index e6af1170e3d..58b4aa74d61 100644 --- a/contributing/code/tests.rst +++ b/contributing/code/tests.rst @@ -32,7 +32,7 @@ tests, such as Doctrine, Twig and Monolog. To do so, .. code-block:: terminal - $ COMPOSER_ROOT_VERSION=6.4.x-dev composer update + $ COMPOSER_ROOT_VERSION=7.0.x-dev composer update .. _running: From 3b2a5bd3499315bf60e668f1bd3a9bf9dfa27758 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Mon, 11 Mar 2024 09:30:53 +0100 Subject: [PATCH 187/477] Update the test article of the contribution guide --- contributing/code/tests.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contributing/code/tests.rst b/contributing/code/tests.rst index 58b4aa74d61..08f6bc5df12 100644 --- a/contributing/code/tests.rst +++ b/contributing/code/tests.rst @@ -32,7 +32,7 @@ tests, such as Doctrine, Twig and Monolog. To do so, .. code-block:: terminal - $ COMPOSER_ROOT_VERSION=7.0.x-dev composer update + $ COMPOSER_ROOT_VERSION=7.1.x-dev composer update .. _running: From 3a6e5ec8f484fa8fe8d57309676537bf5416241d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Pillevesse?= Date: Mon, 11 Mar 2024 09:05:39 +0100 Subject: [PATCH 188/477] Update pull_requests.rst --- contributing/code/pull_requests.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contributing/code/pull_requests.rst b/contributing/code/pull_requests.rst index 7b51b2ab3cb..7c9ab2579a5 100644 --- a/contributing/code/pull_requests.rst +++ b/contributing/code/pull_requests.rst @@ -31,7 +31,7 @@ Before working on Symfony, setup a friendly environment with the following software: * Git; -* PHP version 8.1 or above. +* PHP version 8.2 or above. Configure Git ~~~~~~~~~~~~~ From 876cbc034f8a327277395d762af5dd63542259b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Andr=C3=A9?= Date: Sat, 3 Feb 2024 15:57:55 +0100 Subject: [PATCH 189/477] [Emoji] Emoji component --- components/emoji.rst | 122 +++++++++++++++++++++++++++++++++++++++++++ components/intl.rst | 57 ++++---------------- 2 files changed, 131 insertions(+), 48 deletions(-) create mode 100644 components/emoji.rst diff --git a/components/emoji.rst b/components/emoji.rst new file mode 100644 index 00000000000..b3f725a2585 --- /dev/null +++ b/components/emoji.rst @@ -0,0 +1,122 @@ +The Emoji Component +=================== + + The Emoji component provides utilities to work with emoji characters and + sequences from the `Unicode CLDR dataset`_. + +Installation +------------ + +.. code-block:: terminal + + $ composer require symfony/emoji + +.. include:: /components/require_autoload.rst.inc + + +Emoji Transliteration +--------------------- + +The ``EmojiTransliterator`` class offers a way to translate emojis into their +textual representation in all languages based on the `Unicode CLDR dataset`_:: + + use Symfony\Component\Emoji\EmojiTransliterator; + + // Describe emojis in English + $transliterator = EmojiTransliterator::create('en'); + $transliterator->transliterate('Menus with 🍕 or 🍝'); + // => 'Menus with pizza or spaghetti' + + // Describe emojis in Ukrainian + $transliterator = EmojiTransliterator::create('uk'); + $transliterator->transliterate('Menus with 🍕 or 🍝'); + // => 'Menus with піца or спагеті' + + +The ``EmojiTransliterator`` also provides special locales that convert emojis to +short codes and vice versa in specific platforms, such as GitHub and Slack. + +GitHub +~~~~~~ + +Convert GitHub emojis to short codes with the ``emoji-github`` locale:: + + $transliterator = EmojiTransliterator::create('emoji-github'); + $transliterator->transliterate('Teenage 🐢 really love 🍕'); + // => 'Teenage :turtle: really love :pizza:' + +Convert GitHub short codes to emojis with the ``github-emoji`` locale:: + + $transliterator = EmojiTransliterator::create('github-emoji'); + $transliterator->transliterate('Teenage :turtle: really love :pizza:'); + // => 'Teenage 🐢 really love 🍕' + +Slack +~~~~~ + +Convert Slack emojis to short codes with the ``emoji-slack`` locale:: + + $transliterator = EmojiTransliterator::create('emoji-slack'); + $transliterator->transliterate('Menus with 🥗 or 🧆'); + // => 'Menus with :green_salad: or :falafel:' + +Convert Slack short codes to emojis with the ``slack-emoji`` locale:: + + $transliterator = EmojiTransliterator::create('slack-emoji'); + $transliterator->transliterate('Menus with :green_salad: or :falafel:'); + // => 'Menus with 🥗 or 🧆' + + +Emoji Slugger +------------- + +Combine the emoji transliterator with the :doc:`/components/string` +to improve the slugs of contents that include emojis (e.g. for URLs). + +Call the ``AsciiSlugger::withEmoji()`` method to enable the emoji transliterator in the Slugger:: + + use Symfony\Component\String\Slugger\AsciiSlugger; + + $slugger = new AsciiSlugger(); + $slugger = $slugger->withEmoji(); + + $slug = $slugger->slug('a 😺, 🐈‍⬛, and a 🦁 go to 🏞️', '-', 'en'); + // $slug = 'a-grinning-cat-black-cat-and-a-lion-go-to-national-park'; + + $slug = $slugger->slug('un 😺, 🐈‍⬛, et un 🦁 vont au 🏞️', '-', 'fr'); + // $slug = 'un-chat-qui-sourit-chat-noir-et-un-tete-de-lion-vont-au-parc-national'; + +.. tip:: + + Integrating the Emoji Component with the String component is straightforward and requires no additional + configuration.string. + +Removing Emojis +--------------- + +The ``EmojiTransliterator`` can also be used to remove all emojis from a string, via the +special ``strip`` locale:: + + use Symfony\Component\Emoji\EmojiTransliterator; + + $transliterator = EmojiTransliterator::create('strip'); + $transliterator->transliterate('🎉Hey!🥳 🎁Happy Birthday!🎁'); + // => 'Hey! Happy Birthday!' + +Disk space +---------- + +The data needed to store the transliteration of all emojis (~5,000) into all +languages take a considerable disk space. + +If you need to save disk space (e.g. because you deploy to some service with tight +size constraints), run this command (e.g. as an automated script after ``composer install``) +to compress the internal Symfony emoji data files using the PHP ``zlib`` extension: + +.. code-block:: terminal + + # adjust the path to the 'compress' binary based on your application installation + $ php ./vendor/symfony/emoji/Resources/bin/compress + + +.. _`Unicode CLDR dataset`: https://github.com/unicode-org/cldr diff --git a/components/intl.rst b/components/intl.rst index bbd088c830e..768ea30903c 100644 --- a/components/intl.rst +++ b/components/intl.rst @@ -28,7 +28,6 @@ This component provides the following ICU data: * `Locales`_ * `Currencies`_ * `Timezones`_ -* `Emoji Transliteration`_ Language and Script Names ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -386,56 +385,19 @@ to catching the exception, you can also check if a given timezone ID is valid:: Emoji Transliteration ~~~~~~~~~~~~~~~~~~~~~ -The ``EmojiTransliterator`` class provides a utility to translate emojis into -their textual representation in all languages based on the `Unicode CLDR dataset`_:: +.. note:: - use Symfony\Component\Intl\Transliterator\EmojiTransliterator; + The ``EmojiTransliterator`` class provides a utility to translate emojis into + their textual representation in all languages based on the Unicode CLDR dataset. - // describe emojis in English - $transliterator = EmojiTransliterator::create('en'); - $transliterator->transliterate('Menus with 🍕 or 🍝'); - // => 'Menus with pizza or spaghetti' +Discover all the available Emoji manipulations in the :doc:`component documentation `. - // describe emojis in Ukrainian - $transliterator = EmojiTransliterator::create('uk'); - $transliterator->transliterate('Menus with 🍕 or 🍝'); - // => 'Menus with піца or спагеті' - -The ``EmojiTransliterator`` class also provides two extra catalogues: ``github`` -and ``slack`` that converts any emojis to the corresponding short code in those -platforms:: - - use Symfony\Component\Intl\Transliterator\EmojiTransliterator; - - // describe emojis in Slack short code - $transliterator = EmojiTransliterator::create('slack'); - $transliterator->transliterate('Menus with 🥗 or 🧆'); - // => 'Menus with :green_salad: or :falafel:' - - // describe emojis in Github short code - $transliterator = EmojiTransliterator::create('github'); - $transliterator->transliterate('Menus with 🥗 or 🧆'); - // => 'Menus with :green_salad: or :falafel:' - -Furthermore the ``EmojiTransliterator`` provides a special ``strip`` locale -that removes all the emojis from a string:: - - use Symfony\Component\Intl\Transliterator\EmojiTransliterator; - - $transliterator = EmojiTransliterator::create('strip'); - $transliterator->transliterate('🎉Hey!🥳 🎁Happy Birthday!🎁'); - // => 'Hey! Happy Birthday!' - -.. tip:: - - Combine this emoji transliterator with the :ref:`Symfony String slugger ` - to improve the slugs of contents that include emojis (e.g. for URLs). +Disk space +---------- -The data needed to store the transliteration of all emojis (~5,000) into all -languages take a considerable disk space. If you need to save disk space (e.g. -because you deploy to some service with tight size constraints), run this command -(e.g. as an automated script after ``composer install``) to compress the internal -Symfony emoji data files using the PHP ``zlib`` extension: +If you need to save disk space (e.g. because you deploy to some service with tight size +constraints), run this command (e.g. as an automated script after ``composer install``) to compress the +internal Symfony Intl data files using the PHP ``zlib`` extension: .. code-block:: terminal @@ -464,4 +426,3 @@ Learn more .. _`daylight saving time (DST)`: https://en.wikipedia.org/wiki/Daylight_saving_time .. _`ISO 639-1 alpha-2`: https://en.wikipedia.org/wiki/ISO_639-1 .. _`ISO 639-2 alpha-3 (2T)`: https://en.wikipedia.org/wiki/ISO_639-2 -.. _`Unicode CLDR dataset`: https://github.com/unicode-org/cldr From 9333df7a418202a9efb4e4cc62bc2698bf13aaa9 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Mon, 11 Mar 2024 10:51:49 +0100 Subject: [PATCH 190/477] Reorganize the Emoji component contents --- components/emoji.rst | 122 ------------------------------------------ components/string.rst | 99 +++++++++++++++++++++++++++++++++- 2 files changed, 98 insertions(+), 123 deletions(-) delete mode 100644 components/emoji.rst diff --git a/components/emoji.rst b/components/emoji.rst deleted file mode 100644 index b3f725a2585..00000000000 --- a/components/emoji.rst +++ /dev/null @@ -1,122 +0,0 @@ -The Emoji Component -=================== - - The Emoji component provides utilities to work with emoji characters and - sequences from the `Unicode CLDR dataset`_. - -Installation ------------- - -.. code-block:: terminal - - $ composer require symfony/emoji - -.. include:: /components/require_autoload.rst.inc - - -Emoji Transliteration ---------------------- - -The ``EmojiTransliterator`` class offers a way to translate emojis into their -textual representation in all languages based on the `Unicode CLDR dataset`_:: - - use Symfony\Component\Emoji\EmojiTransliterator; - - // Describe emojis in English - $transliterator = EmojiTransliterator::create('en'); - $transliterator->transliterate('Menus with 🍕 or 🍝'); - // => 'Menus with pizza or spaghetti' - - // Describe emojis in Ukrainian - $transliterator = EmojiTransliterator::create('uk'); - $transliterator->transliterate('Menus with 🍕 or 🍝'); - // => 'Menus with піца or спагеті' - - -The ``EmojiTransliterator`` also provides special locales that convert emojis to -short codes and vice versa in specific platforms, such as GitHub and Slack. - -GitHub -~~~~~~ - -Convert GitHub emojis to short codes with the ``emoji-github`` locale:: - - $transliterator = EmojiTransliterator::create('emoji-github'); - $transliterator->transliterate('Teenage 🐢 really love 🍕'); - // => 'Teenage :turtle: really love :pizza:' - -Convert GitHub short codes to emojis with the ``github-emoji`` locale:: - - $transliterator = EmojiTransliterator::create('github-emoji'); - $transliterator->transliterate('Teenage :turtle: really love :pizza:'); - // => 'Teenage 🐢 really love 🍕' - -Slack -~~~~~ - -Convert Slack emojis to short codes with the ``emoji-slack`` locale:: - - $transliterator = EmojiTransliterator::create('emoji-slack'); - $transliterator->transliterate('Menus with 🥗 or 🧆'); - // => 'Menus with :green_salad: or :falafel:' - -Convert Slack short codes to emojis with the ``slack-emoji`` locale:: - - $transliterator = EmojiTransliterator::create('slack-emoji'); - $transliterator->transliterate('Menus with :green_salad: or :falafel:'); - // => 'Menus with 🥗 or 🧆' - - -Emoji Slugger -------------- - -Combine the emoji transliterator with the :doc:`/components/string` -to improve the slugs of contents that include emojis (e.g. for URLs). - -Call the ``AsciiSlugger::withEmoji()`` method to enable the emoji transliterator in the Slugger:: - - use Symfony\Component\String\Slugger\AsciiSlugger; - - $slugger = new AsciiSlugger(); - $slugger = $slugger->withEmoji(); - - $slug = $slugger->slug('a 😺, 🐈‍⬛, and a 🦁 go to 🏞️', '-', 'en'); - // $slug = 'a-grinning-cat-black-cat-and-a-lion-go-to-national-park'; - - $slug = $slugger->slug('un 😺, 🐈‍⬛, et un 🦁 vont au 🏞️', '-', 'fr'); - // $slug = 'un-chat-qui-sourit-chat-noir-et-un-tete-de-lion-vont-au-parc-national'; - -.. tip:: - - Integrating the Emoji Component with the String component is straightforward and requires no additional - configuration.string. - -Removing Emojis ---------------- - -The ``EmojiTransliterator`` can also be used to remove all emojis from a string, via the -special ``strip`` locale:: - - use Symfony\Component\Emoji\EmojiTransliterator; - - $transliterator = EmojiTransliterator::create('strip'); - $transliterator->transliterate('🎉Hey!🥳 🎁Happy Birthday!🎁'); - // => 'Hey! Happy Birthday!' - -Disk space ----------- - -The data needed to store the transliteration of all emojis (~5,000) into all -languages take a considerable disk space. - -If you need to save disk space (e.g. because you deploy to some service with tight -size constraints), run this command (e.g. as an automated script after ``composer install``) -to compress the internal Symfony emoji data files using the PHP ``zlib`` extension: - -.. code-block:: terminal - - # adjust the path to the 'compress' binary based on your application installation - $ php ./vendor/symfony/emoji/Resources/bin/compress - - -.. _`Unicode CLDR dataset`: https://github.com/unicode-org/cldr diff --git a/components/string.rst b/components/string.rst index 68362ed8654..08870881541 100644 --- a/components/string.rst +++ b/components/string.rst @@ -507,6 +507,101 @@ requested during the program execution. You can also create lazy strings from a // hash computation only if it's needed $lazyHash = LazyString::fromStringable(new Hash()); +Working with Emojis +------------------- + +.. versionadded:: 7.1 + + The emoji component was introduced in Symfony 7.1. + +Symfony provides several utilities to work with emoji characters and sequences +from the `Unicode CLDR dataset`_. They are available via the Emoji component, +which you must first install in your application: + +.. code-block:: terminal + + $ composer require symfony/emoji + +The data needed to store the transliteration of all emojis (~5,000) into all +languages take a considerable disk space. + +If you need to save disk space (e.g. because you deploy to some service with tight +size constraints), run this command (e.g. as an automated script after ``composer install``) +to compress the internal Symfony emoji data files using the PHP ``zlib`` extension: + +.. code-block:: terminal + + # adjust the path to the 'compress' binary based on your application installation + $ php ./vendor/symfony/emoji/Resources/bin/compress + +.. _string-emoji-transliteration: + +Emoji Transliteration +~~~~~~~~~~~~~~~~~~~~~ + +The ``EmojiTransliterator`` class offers a way to translate emojis into their +textual representation in all languages based on the `Unicode CLDR dataset`_:: + + use Symfony\Component\Emoji\EmojiTransliterator; + + // Describe emojis in English + $transliterator = EmojiTransliterator::create('en'); + $transliterator->transliterate('Menus with 🍕 or 🍝'); + // => 'Menus with pizza or spaghetti' + + // Describe emojis in Ukrainian + $transliterator = EmojiTransliterator::create('uk'); + $transliterator->transliterate('Menus with 🍕 or 🍝'); + // => 'Menus with піца or спагеті' + + +The ``EmojiTransliterator`` also provides special locales that convert emojis to +short codes and vice versa in specific platforms, such as GitHub and Slack. + +GitHub Emoji Transliteration +............................ + +Convert GitHub emojis to short codes with the ``emoji-github`` locale:: + + $transliterator = EmojiTransliterator::create('emoji-github'); + $transliterator->transliterate('Teenage 🐢 really love 🍕'); + // => 'Teenage :turtle: really love :pizza:' + +Convert GitHub short codes to emojis with the ``github-emoji`` locale:: + + $transliterator = EmojiTransliterator::create('github-emoji'); + $transliterator->transliterate('Teenage :turtle: really love :pizza:'); + // => 'Teenage 🐢 really love 🍕' + +Slack Emoji Transliteration +........................... + +Convert Slack emojis to short codes with the ``emoji-slack`` locale:: + + $transliterator = EmojiTransliterator::create('emoji-slack'); + $transliterator->transliterate('Menus with 🥗 or 🧆'); + // => 'Menus with :green_salad: or :falafel:' + +Convert Slack short codes to emojis with the ``slack-emoji`` locale:: + + $transliterator = EmojiTransliterator::create('slack-emoji'); + $transliterator->transliterate('Menus with :green_salad: or :falafel:'); + // => 'Menus with 🥗 or 🧆' + +Removing Emojis +~~~~~~~~~~~~~~~ + +The ``EmojiTransliterator`` can also be used to remove all emojis from a string, +via the special ``strip`` locale:: + + use Symfony\Component\Emoji\EmojiTransliterator; + + $transliterator = EmojiTransliterator::create('strip'); + $transliterator->transliterate('🎉Hey!🥳 🎁Happy Birthday!🎁'); + // => 'Hey! Happy Birthday!' + +.. _string-slugger: + Slugger ------- @@ -579,7 +674,8 @@ the injected slugger is the same as the request locale:: Slug Emojis ~~~~~~~~~~~ -You can transform any emojis into their textual representation:: +You can also combine the :ref:`emoji transliterator ` +with the slugger to transform any emojis into their textual representation:: use Symfony\Component\String\Slugger\AsciiSlugger; @@ -648,3 +744,4 @@ possible to determine a unique singular/plural form for the given word. .. _`Code points`: https://en.wikipedia.org/wiki/Code_point .. _`Grapheme clusters`: https://en.wikipedia.org/wiki/Grapheme .. _`Unicode equivalence`: https://en.wikipedia.org/wiki/Unicode_equivalence +.. _`Unicode CLDR dataset`: https://github.com/unicode-org/cldr From 9de3da7d84231fb3eebc9aa8a2c2b3b0ebaf11a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Pillevesse?= Date: Mon, 11 Mar 2024 13:13:30 +0100 Subject: [PATCH 191/477] Update setup.rst --- setup.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/setup.rst b/setup.rst index 6ed508d771b..90a89e78e8a 100644 --- a/setup.rst +++ b/setup.rst @@ -48,10 +48,10 @@ application: .. code-block:: terminal # run this if you are building a traditional web application - $ symfony new my_project_directory --version="7.0.*" --webapp + $ symfony new my_project_directory --version="7.1.*" --webapp # run this if you are building a microservice, console application or API - $ symfony new my_project_directory --version="7.0.*" + $ symfony new my_project_directory --version="7.1.*" The only difference between these two commands is the number of packages installed by default. The ``--webapp`` option installs extra packages to give @@ -63,12 +63,12 @@ Symfony application using Composer: .. code-block:: terminal # run this if you are building a traditional web application - $ composer create-project symfony/skeleton:"7.0.*" my_project_directory + $ composer create-project symfony/skeleton:"7.1.*" my_project_directory $ cd my_project_directory $ composer require webapp # run this if you are building a microservice, console application or API - $ composer create-project symfony/skeleton:"7.0.*" my_project_directory + $ composer create-project symfony/skeleton:"7.1.*" my_project_directory No matter which command you run to create the Symfony application. All of them will create a new ``my_project_directory/`` directory, download some dependencies From 46a9a052c2455ee6290693daf2f7f6d5702fc53c Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Mon, 11 Mar 2024 13:44:36 +0100 Subject: [PATCH 192/477] fix build --- components/intl.rst | 2 +- components/string.rst | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/components/intl.rst b/components/intl.rst index 768ea30903c..0cf99591369 100644 --- a/components/intl.rst +++ b/components/intl.rst @@ -390,7 +390,7 @@ Emoji Transliteration The ``EmojiTransliterator`` class provides a utility to translate emojis into their textual representation in all languages based on the Unicode CLDR dataset. -Discover all the available Emoji manipulations in the :doc:`component documentation `. +Discover all the available Emoji manipulations in the :ref:`component documentation `. Disk space ---------- diff --git a/components/string.rst b/components/string.rst index 08870881541..56af5719170 100644 --- a/components/string.rst +++ b/components/string.rst @@ -507,6 +507,8 @@ requested during the program execution. You can also create lazy strings from a // hash computation only if it's needed $lazyHash = LazyString::fromStringable(new Hash()); +.. _working-with-emojis: + Working with Emojis ------------------- From 7040512e84182f28aa95abf3bce4ca058ddd65ec Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Tue, 12 Mar 2024 09:36:00 +0100 Subject: [PATCH 193/477] Update build.php --- _build/build.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_build/build.php b/_build/build.php index 454553d459e..6a1ac4642f0 100755 --- a/_build/build.php +++ b/_build/build.php @@ -20,7 +20,7 @@ $outputDir = __DIR__.'/output'; $buildConfig = (new BuildConfig()) - ->setSymfonyVersion('6.4') + ->setSymfonyVersion('7.0') ->setContentDir(__DIR__.'/..') ->setOutputDir($outputDir) ->setImagesDir(__DIR__.'/output/_images') From ef3b01df3ce14ac49ca90d961f300a9463c863fb Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Tue, 12 Mar 2024 09:37:21 +0100 Subject: [PATCH 194/477] Update build.php --- _build/build.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_build/build.php b/_build/build.php index 6a1ac4642f0..5298abe779a 100755 --- a/_build/build.php +++ b/_build/build.php @@ -20,7 +20,7 @@ $outputDir = __DIR__.'/output'; $buildConfig = (new BuildConfig()) - ->setSymfonyVersion('7.0') + ->setSymfonyVersion('7.1') ->setContentDir(__DIR__.'/..') ->setOutputDir($outputDir) ->setImagesDir(__DIR__.'/output/_images') From d4aed270931877b2fa5f008294c821a2593aa38b Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 13 Mar 2024 10:24:17 +0100 Subject: [PATCH 195/477] [String] Reorganize String component contents --- _build/redirection_map | 3 ++- components/intl.rst | 9 +++------ components/string.rst => string.rst | 14 ++++++++------ 3 files changed, 13 insertions(+), 13 deletions(-) rename components/string.rst => string.rst (98%) diff --git a/_build/redirection_map b/_build/redirection_map index 3b845d59ffe..34f3b7d166b 100644 --- a/_build/redirection_map +++ b/_build/redirection_map @@ -529,7 +529,7 @@ /components/serializer#component-serializer-attributes-groups-annotations /components/serializer#component-serializer-attributes-groups-attributes /logging/monolog_regex_based_excludes /logging/monolog_exclude_http_codes /security/named_encoders /security/named_hashers -/components/inflector /components/string#inflector +/components/inflector /string#inflector /security/experimental_authenticators /security /security/user_provider /security/user_providers /security/reset_password /security/passwords#reset-password @@ -566,3 +566,4 @@ /messenger/handler_results /messenger#messenger-getting-handler-results /messenger/dispatch_after_current_bus /messenger#messenger-transactional-messages /messenger/multiple_buses /messenger#messenger-multiple-buses +/components/string /string diff --git a/components/intl.rst b/components/intl.rst index 0cf99591369..d18ac21b10a 100644 --- a/components/intl.rst +++ b/components/intl.rst @@ -385,12 +385,9 @@ to catching the exception, you can also check if a given timezone ID is valid:: Emoji Transliteration ~~~~~~~~~~~~~~~~~~~~~ -.. note:: - - The ``EmojiTransliterator`` class provides a utility to translate emojis into - their textual representation in all languages based on the Unicode CLDR dataset. - -Discover all the available Emoji manipulations in the :ref:`component documentation `. +Symfony provides utilities to translate emojis into their textual representation +in all languages. Read the documentation on :ref:`working with emojis in strings ` +to learn more about this feature. Disk space ---------- diff --git a/components/string.rst b/string.rst similarity index 98% rename from components/string.rst rename to string.rst index 56af5719170..62336e461cf 100644 --- a/components/string.rst +++ b/string.rst @@ -1,11 +1,11 @@ -The String Component -==================== +Creating and Manipulating Strings +================================= - The String component provides a single object-oriented API to work with - three "unit systems" of strings: bytes, code points and grapheme clusters. +Symfony provides an object-oriented API to work with Unicode strings (as bytes, +code points and grapheme clusters). This API is available via the String component, +which you must first install in your application: -Installation ------------- +.. _installation: .. code-block:: terminal @@ -524,6 +524,8 @@ which you must first install in your application: $ composer require symfony/emoji +.. include:: /components/require_autoload.rst.inc + The data needed to store the transliteration of all emojis (~5,000) into all languages take a considerable disk space. From 670b70ee456e7154d811d92bfabbd2fa7c2bbae0 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Thu, 14 Mar 2024 16:21:05 +0100 Subject: [PATCH 196/477] Remove some versionadded directives --- components/messenger.rst | 5 ----- scheduler.rst | 5 ----- 2 files changed, 10 deletions(-) diff --git a/components/messenger.rst b/components/messenger.rst index 8ec25d2c75f..a1c1e709e00 100644 --- a/components/messenger.rst +++ b/components/messenger.rst @@ -167,11 +167,6 @@ Here are some important envelope stamps that are shipped with the Symfony Messen differentiate it from messages created "manually". You can learn more about it in the :doc:`Scheduler documentation `. -.. versionadded:: 6.4 - - The :class:`Symfony\\Component\\Messenger\\Stamp\\ScheduledStamp` was - introduced in Symfony 6.4. - .. note:: The :class:`Symfony\\Component\\Messenger\\Stamp\\ErrorDetailsStamp` stamp diff --git a/scheduler.rst b/scheduler.rst index 7a21d06ea9b..16346b4f566 100644 --- a/scheduler.rst +++ b/scheduler.rst @@ -885,11 +885,6 @@ When using the ``RedispatchMessage``, Symfony will attach a :class:`Symfony\\Component\\Messenger\\Stamp\\ScheduledStamp` to the message, helping you identify those messages when needed. -.. versionadded:: 6.4 - - Automatically attaching a :class:`Symfony\\Component\\Messenger\\Stamp\\ScheduledStamp` - to redispatched messages was introduced in Symfony 6.4. - .. _`Memoizing`: https://en.wikipedia.org/wiki/Memoization .. _`cron command-line utility`: https://en.wikipedia.org/wiki/Cron .. _`crontab.guru website`: https://crontab.guru/ From e94de7a5672dc87baa021cacdd3d05abb6d5e5b5 Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Tue, 12 Mar 2024 10:04:12 +0100 Subject: [PATCH 197/477] [Workflow] Attach workflow configuration to tags --- service_container/tags.rst | 2 ++ workflow.rst | 13 +++++++++++++ 2 files changed, 15 insertions(+) diff --git a/service_container/tags.rst b/service_container/tags.rst index ca36bde74e1..1900ce28fb2 100644 --- a/service_container/tags.rst +++ b/service_container/tags.rst @@ -458,6 +458,8 @@ or from your kernel:: :ref:`components documentation ` for more information. +.. _tags_additional-attributes: + Adding Additional Attributes on Tags ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/workflow.rst b/workflow.rst index 7e45c7693c1..4e85c10087d 100644 --- a/workflow.rst +++ b/workflow.rst @@ -366,6 +366,17 @@ name. * ``workflow.workflow``: all workflows; * ``workflow.state_machine``: all state machines. + Note that workflow metadata are attached to tags under the + ``metatdata`` key, giving you more context and information about the workflow + at disposal. You can learn more about + :ref:`tag attributes ` and + :ref:`storing workflow metadata ` + in their dedicated sections. + + .. versionadded:: 7.1 + + The attached configuration to the tag was introduced in Symfony 7.1. + .. tip:: You can find the list of available workflow services with the @@ -1032,6 +1043,8 @@ The following example shows these functions in action: {{ blocker.message }} {% endfor %} +.. _workflow_storing-metadata: + Storing Metadata ---------------- From 438031cfd908517c3ced245ff6a0e76ecc963bcc Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Mon, 18 Mar 2024 11:00:42 +0100 Subject: [PATCH 198/477] Tweaks --- workflow.rst | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/workflow.rst b/workflow.rst index 4e85c10087d..65c4f827a0f 100644 --- a/workflow.rst +++ b/workflow.rst @@ -366,12 +366,10 @@ name. * ``workflow.workflow``: all workflows; * ``workflow.state_machine``: all state machines. - Note that workflow metadata are attached to tags under the - ``metatdata`` key, giving you more context and information about the workflow - at disposal. You can learn more about - :ref:`tag attributes ` and - :ref:`storing workflow metadata ` - in their dedicated sections. + Note that workflow metadata are attached to tags under the ``metadata`` key, + giving you more context and information about the workflow at disposal. + Learn more about :ref:`tag attributes ` and + :ref:`storing workflow metadata `. .. versionadded:: 7.1 From 742b2cceaeac7d7ef8ae47a21f9c6f597237a1cf Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Mon, 18 Mar 2024 17:30:13 +0100 Subject: [PATCH 199/477] [Filesystem] Document the readFile() method --- components/filesystem.rst | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/components/filesystem.rst b/components/filesystem.rst index 8cdc2a34884..dabf3f81872 100644 --- a/components/filesystem.rst +++ b/components/filesystem.rst @@ -313,6 +313,22 @@ contents at the end of some file:: If either the file or its containing directory doesn't exist, this method creates them before appending the contents. +``readFile`` +~~~~~~~~~~~~ + +.. versionadded:: 7.1 + + The ``readFile()`` method was introduced in Symfony 7.1. + +:method:`Symfony\\Component\\Filesystem\\Filesystem::readFile` returns all the +contents of a file as a string. Unlike the :phpfunction:`file_get_contents` function +from PHP, it throws an exception when the given file path is not readable and +when passing the path to a directory instead of a file:: + + $contents = $filesystem->readFile('/some/path/to/file.txt'); + +The ``$contents`` variable now stores all the contents of the ``file.txt`` file. + Path Manipulation Utilities --------------------------- From 6f05767d02593ebf2d47cfced08fabee1e0763b3 Mon Sep 17 00:00:00 2001 From: Benjamin Zaslavsky Date: Thu, 25 Jan 2024 09:54:48 +0100 Subject: [PATCH 200/477] [DependencyInjection] Add `#[Lazy]` attribute --- reference/attributes.rst | 1 + service_container/lazy_services.rst | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/reference/attributes.rst b/reference/attributes.rst index 08667e2a06f..015b8751834 100644 --- a/reference/attributes.rst +++ b/reference/attributes.rst @@ -37,6 +37,7 @@ Dependency Injection * :ref:`AutowireLocator ` * :ref:`AutowireServiceClosure ` * :ref:`Exclude ` +* :ref:`Lazy ` * :ref:`TaggedIterator ` * :ref:`TaggedLocator ` * :ref:`Target ` diff --git a/service_container/lazy_services.rst b/service_container/lazy_services.rst index 46e939d4fac..4d21837e4ae 100644 --- a/service_container/lazy_services.rst +++ b/service_container/lazy_services.rst @@ -124,6 +124,32 @@ laziness, and supports lazy-autowiring of intersection types:: ) { } +Another possibility is to use the :class:`Symfony\\Component\\DependencyInjection\\Attribute\\Lazy` attribute:: + + namespace App\Twig; + + use Symfony\Component\DependencyInjection\Attribute\Lazy; + use Twig\Extension\ExtensionInterface; + + #[Lazy] + class AppExtension implements ExtensionInterface + { + // ... + } + +This attribute can be used on a class or on a parameter which should be lazy-loaded, and has a parameter +that also supports defining interfaces to proxy and intersection types:: + + public function __construct( + #[Lazy(FooInterface::class)] + FooInterface|BarInterface $foo, + ) { + } + +.. versionadded:: 7.1 + + The ``#[Lazy]`` attribute was introduced in Symfony 7.1. + Interface Proxifying -------------------- From 0816f2b88a0aec8ddad0df640b94a2ae3b0f427e Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Thu, 21 Mar 2024 15:42:46 +0100 Subject: [PATCH 201/477] Tweaks --- service_container/lazy_services.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/service_container/lazy_services.rst b/service_container/lazy_services.rst index ca883278453..41f27d8448f 100644 --- a/service_container/lazy_services.rst +++ b/service_container/lazy_services.rst @@ -137,8 +137,8 @@ Another possibility is to use the :class:`Symfony\\Component\\DependencyInjectio // ... } -This attribute can be used on a class or on a parameter which should be lazy-loaded, and has a parameter -that also supports defining interfaces to proxy and intersection types:: +This attribute can be applied to both class and parameters that should be lazy-loaded. +It defines an optional parameter used to define interfaces for proxy and intersection types:: public function __construct( #[Lazy(FooInterface::class)] From 7afdaa339959baaa3e55a8ec2fe33f1d93fb2d84 Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Tue, 26 Mar 2024 16:53:56 +0100 Subject: [PATCH 202/477] [Console] Mention `ArgvInput::getRawTokens` --- console/input.rst | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/console/input.rst b/console/input.rst index 4d709c18825..f889926be59 100644 --- a/console/input.rst +++ b/console/input.rst @@ -311,6 +311,37 @@ The above code can be simplified as follows because ``false !== null``:: $yell = ($optionValue !== false); $yellLouder = ($optionValue === 'louder'); +Fetching The Raw Command Input +------------------------------ + +Sometimes, you may need to fetch the raw input that was passed to the command. +This is useful when you need to parse the input yourself or when you need to +pass the input to another command without having to worry about the number +of arguments or options defined in your own command. This can be achieved +thanks to the +:method:`Symfony\\Component\\Console\\Input\\ArgvInput::getRawTokens` method:: + + // ... + use Symfony\Component\Process\Process; + + protected function execute(InputInterface $input, OutputInterface $output): int + { + // pass the raw input of your command to the "ls" command + $process = new Process(['ls', ...$input->getRawTokens(true)]); + $process->setTty(true); + $process->mustRun(); + + // ... + } + +You can include the current command name in the raw tokens by passing ``true`` +to the ``getRawTokens`` method only parameter. + +.. versionadded:: 7.1 + + The :method:`Symfony\\Component\\Console\\Input\\ArgvInput::getRawTokens` + method was introduced in Symfony 7.1. + Adding Argument/Option Value Completion --------------------------------------- From 08a12ec0616af510e0325a2b21acea467d5ec7fe Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Mon, 25 Mar 2024 09:32:21 +0100 Subject: [PATCH 203/477] [Workflow] Document the EventNameTrait --- workflow.rst | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/workflow.rst b/workflow.rst index 65c4f827a0f..f0c276a86f1 100644 --- a/workflow.rst +++ b/workflow.rst @@ -496,6 +496,7 @@ workflow leaves a place:: use Psr\Log\LoggerInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\Workflow\Event\Event; + use Symfony\Component\Workflow\Event\LeaveEvent; class WorkflowLoggerSubscriber implements EventSubscriberInterface { @@ -518,11 +519,24 @@ workflow leaves a place:: public static function getSubscribedEvents(): array { return [ - 'workflow.blog_publishing.leave' => 'onLeave', + LeaveEvent::getName('blog_publishing') => 'onLeave', + // if you prefer, you can write the event name manually like this: + // 'workflow.blog_publishing.leave' => 'onLeave', ]; } } +.. tip:: + + All built-in workflow events define the ``getName(?string $workflowName, ?string $transitionOrPlaceName)`` + method to build the full event name without having to deal with strings. + You can also use this method in your custom events via the + :class:`Symfony\\Component\\Workflow\\Event\\EventNameTrait`. + + .. versionadded:: 7.1 + + The ``getName()`` method was introduced in Symfony 7.1. + If some listeners update the context during a transition, you can retrieve it via the marking:: From 1aab03d5113790f068f54ba224ac429fda9891d2 Mon Sep 17 00:00:00 2001 From: Vincent Langlet Date: Fri, 22 Mar 2024 09:58:55 +0100 Subject: [PATCH 204/477] [Console] Add doc about lockableTrait --- console/lockable_trait.rst | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/console/lockable_trait.rst b/console/lockable_trait.rst index 02f635f5788..19f30e86d96 100644 --- a/console/lockable_trait.rst +++ b/console/lockable_trait.rst @@ -43,4 +43,24 @@ that adds two convenient methods to lock and release commands:: } } +The LockableTrait will use the ``SemaphoreStore`` if available and will default +to ``FlockStore`` otherwise. You can override this behavior by setting +a ``$lockFactory`` property with your own lock factory:: + + // ... + use Symfony\Component\Console\Command\Command; + use Symfony\Component\Console\Command\LockableTrait; + use Symfony\Component\Lock\LockFactory; + + class UpdateContentsCommand extends Command + { + use LockableTrait; + + public function __construct(private LockFactory $lockFactory) + { + } + + // ... + } + .. _`locks`: https://en.wikipedia.org/wiki/Lock_(computer_science) From b9b06084b6d809269e615ae295683c7a7575e72f Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Tue, 2 Apr 2024 08:26:03 +0200 Subject: [PATCH 205/477] Add the missing versionadded directive --- console/lockable_trait.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/console/lockable_trait.rst b/console/lockable_trait.rst index 19f30e86d96..0f4a4900e17 100644 --- a/console/lockable_trait.rst +++ b/console/lockable_trait.rst @@ -63,4 +63,8 @@ a ``$lockFactory`` property with your own lock factory:: // ... } +.. versionadded:: 7.1 + + The ``$lockFactory`` property was introduced in Symfony 7.1. + .. _`locks`: https://en.wikipedia.org/wiki/Lock_(computer_science) From dc57552a4f14eb3d87806b23140f1a10ea1e3f3d Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Thu, 28 Mar 2024 10:43:54 +0100 Subject: [PATCH 206/477] [Serializer] Mention `AbstractNormalizer::FILTER_BOOL` --- components/serializer.rst | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/components/serializer.rst b/components/serializer.rst index 3bda0b0cf4f..a28464ffc04 100644 --- a/components/serializer.rst +++ b/components/serializer.rst @@ -700,8 +700,13 @@ deserializing objects:: $serialized = $serializer->serialize(new Person('Kévin'), 'json'); // {"customer_name": "Kévin"} -Serializing Boolean Attributes ------------------------------- +.. _serializing-boolean-attributes: + +Handling Boolean Attributes And Values +-------------------------------------- + +During Serialization +~~~~~~~~~~~~~~~~~~~~ If you are using isser methods (methods prefixed by ``is``, like ``App\Model\Person::isSportsperson()``), the Serializer component will @@ -710,6 +715,34 @@ automatically detect and use it to serialize related attributes. The ``ObjectNormalizer`` also takes care of methods starting with ``has``, ``get``, and ``can``. +During Deserialization +~~~~~~~~~~~~~~~~~~~~~~ + +PHP considers many different values as true or false. For example, the +strings ``true``, ``1``, and ``yes`` are considered true, while +``false``, ``0``, and ``no`` are considered false. + +When deserializing, the Serializer component can take care of this +automatically. This can be done by using the ``AbstractNormalizer::FILTER_BOOL`` +context option:: + + use Acme\Person; + use Symfony\Component\Serializer\Normalizer\AbstractNormalizer; + use Symfony\Component\Serializer\Normalizer\ObjectNormalizer; + use Symfony\Component\Serializer\Serializer; + + $normalizer = new ObjectNormalizer(); + $serializer = new Serializer([$normalizer]); + + $data = $serializer->denormalize(['sportsperson' => 'yes'], Person::class, context: [AbstractNormalizer::FILTER_BOOL => true]); + +This context makes the deserialization process behave like the +:phpfunction:`filter_var` function with the ``FILTER_VALIDATE_BOOL`` flag. + +.. versionadded:: 7.1 + + The ``AbstractNormalizer::FILTER_BOOL`` context option was introduced in Symfony 7.1. + Using Callbacks to Serialize Properties with Object Instances ------------------------------------------------------------- From 5abfb8e3641ecf2f4965fdd12213d1a5efa5dbf9 Mon Sep 17 00:00:00 2001 From: Bram de Smidt Date: Wed, 3 Apr 2024 14:36:54 +0200 Subject: [PATCH 207/477] fix: typo in proxy docs --- deployment/proxies.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deployment/proxies.rst b/deployment/proxies.rst index 82ea4dcffab..dcef631648f 100644 --- a/deployment/proxies.rst +++ b/deployment/proxies.rst @@ -156,7 +156,7 @@ subpath/subfolder of the reverse proxy. To fix this, you need to pass the subpath/subfolder route prefix of the reverse proxy to Symfony by setting the ``X-Forwarded-Prefix`` header. The header can normally be configured in your reverse proxy configuration. Configure -``X-Forwared-Prefix`` as trusted header to be able to use this feature. +``X-Forwarded-Prefix`` as trusted header to be able to use this feature. The ``X-Forwarded-Prefix`` is used by Symfony to prefix the base URL of request objects, which is used to generate absolute paths and URLs in Symfony applications. From f68defc1f4307b61fca1e756983c6a4a06e2543e Mon Sep 17 00:00:00 2001 From: Quentin Devos <4972091+Okhoshi@users.noreply.github.com> Date: Wed, 3 Apr 2024 22:43:01 +0200 Subject: [PATCH 208/477] [FrameworkBundle] Remove mention of inexistant `ignore_cache` option Signed-off-by: Quentin Devos <4972091+Okhoshi@users.noreply.github.com> --- reference/configuration/framework.rst | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/reference/configuration/framework.rst b/reference/configuration/framework.rst index 5a7a5684fbc..57693ff0b1d 100644 --- a/reference/configuration/framework.rst +++ b/reference/configuration/framework.rst @@ -1514,15 +1514,7 @@ The directory where routing information will be cached. Can be set to .. deprecated:: 7.1 Setting the ``cache_dir`` option is deprecated since Symfony 7.1. The routes - are now always cached in the ``%kernel.build_dir%`` directory. If you want - to disable route caching, set the ``ignore_cache`` option to ``true``. - -ignore_cache -............ - -**type**: ``boolean`` **default**: ``false`` - -When this option is set to ``true``, routing information will not be cached. + are now always cached in the ``%kernel.build_dir%`` directory. secrets ~~~~~~~ From 265a69ccae8e8250255cf596bc42c357f77b4cfc Mon Sep 17 00:00:00 2001 From: Antoine Lamirault Date: Tue, 2 Apr 2024 20:52:04 +0200 Subject: [PATCH 209/477] [FrameworkBundle][HttpClient] Add ThrottlingHttpClient --- http_client.rst | 34 +++++++++++++++++++++++++++ reference/configuration/framework.rst | 14 +++++++++++ 2 files changed, 48 insertions(+) diff --git a/http_client.rst b/http_client.rst index 1966dfba064..3a649f452fd 100644 --- a/http_client.rst +++ b/http_client.rst @@ -1474,6 +1474,40 @@ installed in your application:: :class:`Symfony\\Component\\HttpClient\\CachingHttpClient` accepts a third argument to set the options of the :class:`Symfony\\Component\\HttpKernel\\HttpCache\\HttpCache`. +Limit the Number of Requests +---------------------------- + +This component provides a :class:`Symfony\\Component\\HttpClient\\ThrottlingHttpClient` +decorator that allows to limit the number of requests within a certain period. + +The implementation leverages the +:class:`Symfony\\Component\\RateLimiter\\LimiterInterface` class under the hood +so that the :doc:`Rate Limiter component ` needs to be +installed in your application:: + + use Symfony\Component\HttpClient\HttpClient; + use Symfony\Component\HttpClient\ThrottlingHttpClient; + use Symfony\Component\RateLimiter\LimiterInterface; + + $rateLimiter = ...; // $rateLimiter is an instance of Symfony\Component\RateLimiter\LimiterInterface + $client = HttpClient::create(); + $client = new ThrottlingHttpClient($client, $rateLimiter); + + $requests = []; + for ($i = 0; $i < 100; $i++) { + $requests[] = $client->request('GET', 'https://example.com'); + } + + foreach ($requests as $request) { + // Depending on rate limiting policy, calls will be delayed + $output->writeln($request->getContent()); + } + +.. versionadded:: 7.1 + + The :class:`Symfony\\Component\\HttpClient\\ThrottlingHttpClient` was + introduced in Symfony 7.1. + Consuming Server-Sent Events ---------------------------- diff --git a/reference/configuration/framework.rst b/reference/configuration/framework.rst index 5a7a5684fbc..d61f94007a8 100644 --- a/reference/configuration/framework.rst +++ b/reference/configuration/framework.rst @@ -1174,6 +1174,20 @@ query An associative array of the query string values added to the URL before making the request. This value must use the format ``['parameter-name' => parameter-value, ...]``. +rate_limiter +............ + +**type**: ``string`` + +This option limit the number of requests within a certain period thanks +to the :doc:`Rate Limiter component `. + +The rate limiter service ID you want to use. + +.. versionadded:: 7.1 + + The ``rate_limiter`` option was introduced in Symfony 7.1. + resolve ....... From d49c1d71b885817d240828b22c55d1ab6c19a106 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Thu, 4 Apr 2024 10:04:30 +0200 Subject: [PATCH 210/477] Minor reword --- reference/configuration/framework.rst | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/reference/configuration/framework.rst b/reference/configuration/framework.rst index d61f94007a8..e8db5e27eb6 100644 --- a/reference/configuration/framework.rst +++ b/reference/configuration/framework.rst @@ -1179,10 +1179,9 @@ rate_limiter **type**: ``string`` -This option limit the number of requests within a certain period thanks -to the :doc:`Rate Limiter component `. - -The rate limiter service ID you want to use. +The service ID of the rate limiter used to limit the number of HTTP requests +within a certain period. The service must implement the +:class:`Symfony\\Component\\RateLimiter\\LimiterInterface`. .. versionadded:: 7.1 From c41f6c6e74925a895a016246aa3148cd51d64ad4 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Thu, 4 Apr 2024 10:06:22 +0200 Subject: [PATCH 211/477] Minor grammar fix --- http_client.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/http_client.rst b/http_client.rst index 3a649f452fd..c7c80ca57f3 100644 --- a/http_client.rst +++ b/http_client.rst @@ -1482,7 +1482,7 @@ decorator that allows to limit the number of requests within a certain period. The implementation leverages the :class:`Symfony\\Component\\RateLimiter\\LimiterInterface` class under the hood -so that the :doc:`Rate Limiter component ` needs to be +so the :doc:`Rate Limiter component ` needs to be installed in your application:: use Symfony\Component\HttpClient\HttpClient; From 0163c71fb5e24a299153035b67e37a36fdcd8e89 Mon Sep 17 00:00:00 2001 From: Antoine Lamirault Date: Wed, 3 Apr 2024 22:33:49 +0200 Subject: [PATCH 212/477] [Emoji] Add the gitlab locale --- string.rst | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/string.rst b/string.rst index 62336e461cf..b4f6d2d1be7 100644 --- a/string.rst +++ b/string.rst @@ -560,7 +560,7 @@ textual representation in all languages based on the `Unicode CLDR dataset`_:: The ``EmojiTransliterator`` also provides special locales that convert emojis to -short codes and vice versa in specific platforms, such as GitHub and Slack. +short codes and vice versa in specific platforms, such as GitHub, Gitlab and Slack. GitHub Emoji Transliteration ............................ @@ -577,6 +577,21 @@ Convert GitHub short codes to emojis with the ``github-emoji`` locale:: $transliterator->transliterate('Teenage :turtle: really love :pizza:'); // => 'Teenage 🐢 really love 🍕' +Gitlab Emoji Transliteration +............................ + +Convert Gitlab emojis to short codes with the ``emoji-gitlab`` locale:: + + $transliterator = EmojiTransliterator::create('emoji-gitlab'); + $transliterator->transliterate('Breakfast with 🥝 or 🥛'); + // => 'Breakfast with :kiwi: or :milk:' + +Convert Gitlab short codes to emojis with the ``gitlab-emoji`` locale:: + + $transliterator = EmojiTransliterator::create('gitlab-emoji'); + $transliterator->transliterate('Breakfast with :kiwi: or :milk:'); + // => 'Breakfast with 🥝 or 🥛' + Slack Emoji Transliteration ........................... @@ -693,7 +708,7 @@ with the slugger to transform any emojis into their textual representation:: // $slug = 'un-chat-qui-sourit-chat-noir-et-un-tete-de-lion-vont-au-parc-national'; If you want to use a specific locale for the emoji, or to use the short codes -from GitHub or Slack, use the first argument of ``withEmoji()`` method:: +from GitHub, Gitlab or Slack, use the first argument of ``withEmoji()`` method:: use Symfony\Component\String\Slugger\AsciiSlugger; From 549de499fc334287e95c6227a07be92102c0ba4c Mon Sep 17 00:00:00 2001 From: Baptiste CONTRERAS <38988658+BaptisteContreras@users.noreply.github.com> Date: Sat, 6 Apr 2024 20:45:27 +0200 Subject: [PATCH 213/477] [HttpFoundation] add documention for signed URI expiration --- routing.rst | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/routing.rst b/routing.rst index 53ebe003e0a..0852883b9ee 100644 --- a/routing.rst +++ b/routing.rst @@ -2694,6 +2694,71 @@ service, which you can inject in your services or controllers:: } } +You can make the signed URI expire. To do so, you can pass a value to the `$expiration` argument +of :phpmethod:`Symfony\\Component\\HttpFoundation\\UriSigner::sign`. This optional argument is `null` by default. You can +specify an expiration date by several ways:: + + // src/Service/SomeService.php + namespace App\Service; + + use Symfony\Component\HttpFoundation\UriSigner; + + class SomeService + { + public function __construct( + private UriSigner $uriSigner, + ) { + } + + public function someMethod(): void + { + // ... + + // generate a URL yourself or get it somehow... + $url = 'https://example.com/foo/bar?sort=desc'; + + // sign the URL with an explicit expiration date + $signedUrl = $this->uriSigner->sign($url, new \DateTime('2050-01-01')); + // $signedUrl = 'https://example.com/foo/bar?sort=desc&_expiration=2524608000&_hash=e4a21b9' + + // check the URL signature + $uriSignatureIsValid = $this->uriSigner->check($signedUrl); + // $uriSignatureIsValid = true + + // if given a \DateInterval, it will be added from now to get the expiration date + $signedUrl = $this->uriSigner->sign($url, new \DateInterval('PT10S')); // valid for 10 seconds from now + // $signedUrl = 'https://example.com/foo/bar?sort=desc&_expiration=1712414278&_hash=e4a21b9' + + // check the URL signature + $uriSignatureIsValid = $this->uriSigner->check($signedUrl); + // $uriSignatureIsValid = true + + sleep(30); // wait 30 seconds... + + // the URL signature has expired + $uriSignatureIsValid = $this->uriSigner->check($signedUrl); + // $uriSignatureIsValid = false + + // you can also use a timestamp in seconds + $signedUrl = $this->uriSigner->sign($url, 4070908800); // timestamp for the date 2099-01-01 + // $signedUrl = 'https://example.com/foo/bar?sort=desc&_expiration=4070908800&_hash=e4a21b9' + + } + } + +.. caution:: + + `null` means no expiration for the signed URI. + +.. note:: + + When making the URI expire, an `_expiration` query parameter is added to the URL and the expiration date is + converted into a timestamp + +.. versionadded:: 7.1 + + The possibility to add an expiration date for a signed URI was introduced in Symfony 7.1. + Troubleshooting --------------- From fa1934c08d505df970dafd840cb7604c9f4b9e46 Mon Sep 17 00:00:00 2001 From: Yonel Ceruto Date: Sun, 7 Apr 2024 12:02:21 -0400 Subject: [PATCH 214/477] Documenting items type in the MapRequestPayload attribute --- controller.rst | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/controller.rst b/controller.rst index c44f0dafdac..2edf6affb2f 100644 --- a/controller.rst +++ b/controller.rst @@ -555,6 +555,32 @@ if you want to map a nested array of specific DTOs:: ) {} } +Nevertheless, if you want to send the array of payloads directly like this: + +.. code-block:: json + + [ + { + "firstName": "John", + "lastName": "Smith", + "age": 28 + }, + { + "firstName": "Jane", + "lastName": "Doe", + "age": 30 + } + ] + +Map the parameter as an array and configure the type of each element in the attribute:: + + public function dashboard( + #[MapRequestPayload(type: UserDTO::class)] array $users + ): Response + { + // ... + } + Managing the Session -------------------- From bb68008b4bb3877e058b485958acb9f22a77c48f Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Fri, 5 Apr 2024 09:58:09 +0200 Subject: [PATCH 215/477] [Validator] Add a requireTld option to Url constraint --- reference/constraints/Url.rst | 111 ++++++++++++++++++++++++++++++++++ 1 file changed, 111 insertions(+) diff --git a/reference/constraints/Url.rst b/reference/constraints/Url.rst index 2c3420df7c6..b3a46d5aec4 100644 --- a/reference/constraints/Url.rst +++ b/reference/constraints/Url.rst @@ -307,3 +307,114 @@ also relative URLs that contain no protocol (e.g. ``//example.com``). ])); } } + +``requireTld`` +~~~~~~~~~~~~~~ + +**type**: ``boolean`` **default**: ``false`` + +.. versionadded:: 7.1 + + The ``requiredTld`` option was introduced in Symfony 7.1. + +By default, URLs like ``https://aaa`` or ``https://foobar`` are considered valid +because they are tecnically correct according to the `URL spec`_. If you set this option +to ``true``, the host part of the URL will have to include a TLD (top-level domain +name): e.g. ``https://example.com`` will be valid but ``https://example`` won't. + +.. note:: + + This constraint does not validate that the given TLD value is included in + the `list of official top-level domains`_ (because that list is growing + continuously and it's hard to keep track of it). + +``tldMessage`` +~~~~~~~~~~~~~~ + +**type**: ``string`` **default**: ``This URL does not contain a TLD.`` + +.. versionadded:: 7.1 + + The ``tldMessage`` option was introduced in Symfony 7.1. + +This message is shown if the ``requireTld`` option is set to ``true`` and the URL +does not contain at least one TLD. + +You can use the following parameters in this message: + +=============== ============================================================== +Parameter Description +=============== ============================================================== +``{{ value }}`` The current (invalid) value +``{{ label }}`` Corresponding form field label +=============== ============================================================== + +.. configuration-block:: + + .. code-block:: php-attributes + + // src/Entity/Website.php + namespace App\Entity; + + use Symfony\Component\Validator\Constraints as Assert; + + class Website + { + #[Assert\Url( + requireTld: true, + tldMessage: 'Add at least one TLD to the {{ value }} URL.', + )] + protected string $homepageUrl; + } + + .. code-block:: yaml + + # config/validator/validation.yaml + App\Entity\Website: + properties: + homepageUrl: + - Url: + requireTld: true + tldMessage: Add at least one TLD to the {{ value }} URL. + + .. code-block:: xml + + + + + + + + + + + + + + + + .. code-block:: php + + // src/Entity/Website.php + namespace App\Entity; + + use Symfony\Component\Validator\Constraints as Assert; + use Symfony\Component\Validator\Mapping\ClassMetadata; + + class Website + { + // ... + + public static function loadValidatorMetadata(ClassMetadata $metadata): void + { + $metadata->addPropertyConstraint('homepageUrl', new Assert\Url([ + 'requireTld' => true, + 'tldMessage' => 'Add at least one TLD to the {{ value }} URL.', + ])); + } + } + +.. _`URL spec`: https://datatracker.ietf.org/doc/html/rfc1738 +.. _`list of official top-level domains`: https://en.wikipedia.org/wiki/List_of_Internet_top-level_domains From f17331c882ab9cf9a870003929f58106bd0d14b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Tamarelle?= Date: Tue, 9 Apr 2024 14:57:27 +0200 Subject: [PATCH 216/477] ServiceSubscriberTrait is deprecated and replaced by ServiceMethodsSubscriberTrait --- service_container/service_subscribers_locators.rst | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/service_container/service_subscribers_locators.rst b/service_container/service_subscribers_locators.rst index 21a7ab295d2..d60b438694c 100644 --- a/service_container/service_subscribers_locators.rst +++ b/service_container/service_subscribers_locators.rst @@ -859,7 +859,7 @@ the following order: Service Subscriber Trait ------------------------ -The :class:`Symfony\\Contracts\\Service\\ServiceSubscriberTrait` provides an +The :class:`Symfony\\Contracts\\Service\\ServiceMethodsSubscriberTrait` provides an implementation for :class:`Symfony\\Contracts\\Service\\ServiceSubscriberInterface` that looks through all methods in your class that are marked with the :class:`Symfony\\Contracts\\Service\\Attribute\\SubscribedService` attribute. It @@ -873,12 +873,12 @@ services based on type-hinted helper methods:: use Psr\Log\LoggerInterface; use Symfony\Component\Routing\RouterInterface; use Symfony\Contracts\Service\Attribute\SubscribedService; + use Symfony\Contracts\Service\ServiceMethodsSubscriberTrait; use Symfony\Contracts\Service\ServiceSubscriberInterface; - use Symfony\Contracts\Service\ServiceSubscriberTrait; class MyService implements ServiceSubscriberInterface { - use ServiceSubscriberTrait; + use ServiceMethodsSubscriberTrait; public function doSomething(): void { @@ -935,12 +935,12 @@ and compose your services with them:: // src/Service/MyService.php namespace App\Service; + use Symfony\Contracts\Service\ServiceMethodsSubscriberTrait; use Symfony\Contracts\Service\ServiceSubscriberInterface; - use Symfony\Contracts\Service\ServiceSubscriberTrait; class MyService implements ServiceSubscriberInterface { - use ServiceSubscriberTrait, LoggerAware, RouterAware; + use ServiceMethodsSubscriberTrait, LoggerAware, RouterAware; public function doSomething(): void { @@ -977,12 +977,12 @@ Here's an example:: use Symfony\Component\DependencyInjection\Attribute\Target; use Symfony\Component\Routing\RouterInterface; use Symfony\Contracts\Service\Attribute\SubscribedService; + use Symfony\Contracts\Service\ServiceMethodsSubscriberTrait; use Symfony\Contracts\Service\ServiceSubscriberInterface; - use Symfony\Contracts\Service\ServiceSubscriberTrait; class MyService implements ServiceSubscriberInterface { - use ServiceSubscriberTrait; + use ServiceMethodsSubscriberTrait; public function doSomething(): void { From 078d6f909bfc3e45ca119b4ed5e6d0b50079db78 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 10 Apr 2024 12:46:19 +0200 Subject: [PATCH 217/477] Added the versionadded directive --- service_container/service_subscribers_locators.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/service_container/service_subscribers_locators.rst b/service_container/service_subscribers_locators.rst index d60b438694c..25ebe97e7e7 100644 --- a/service_container/service_subscribers_locators.rst +++ b/service_container/service_subscribers_locators.rst @@ -899,6 +899,11 @@ services based on type-hinted helper methods:: } } +.. versionadded:: 7.1 + + The ``ServiceMethodsSubscriberTrait`` was introduced in Symfony 7.1. + In previous Symfony versions it was called ``ServiceSubscriberTrait``. + This allows you to create helper traits like RouterAware, LoggerAware, etc... and compose your services with them:: From 9bd321de567074972ce6f21cb3a92b98739e30e1 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Tue, 9 Apr 2024 17:59:15 +0200 Subject: [PATCH 218/477] [Clock] Document createFromTimestamp() method --- components/clock.rst | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/components/clock.rst b/components/clock.rst index 45ec484eef5..933f7310d75 100644 --- a/components/clock.rst +++ b/components/clock.rst @@ -229,6 +229,21 @@ The constructor also allows setting a timezone or custom referenced date:: $referenceDate = new \DateTimeImmutable(); $relativeDate = new DatePoint('+1month', reference: $referenceDate); +The ``DatePoint`` class also provides a named constructor to create dates from +timestamps:: + + $dateOfFirstCommitOfSymfonyProject = DatePoint::createFromTimestamp(1129645656); + // equivalent to: + // $dateOfFirstCommitOfSymfonyProject = (new \DateTimeImmutable())->setTimestamp(1129645656); + + // negative timestamps (for dates before January 1, 1970) and fractional timestamps + // (for high precision sub-second datetimes) are also supported + $dateOfFirstMoonLanding = DatePoint::createFromTimestamp(-14182940); + +.. versionadded:: 7.1 + + The ``createFromTimestamp()`` method was introduced in Symfony 7.1. + .. note:: In addition ``DatePoint`` offers stricter return types and provides consistent From e801d38f755a6073bedcb1e64d8aafcd21de9abf Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 10 Apr 2024 15:30:58 +0200 Subject: [PATCH 219/477] Minor tweak --- components/clock.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/clock.rst b/components/clock.rst index 933f7310d75..cdbbdd56e6b 100644 --- a/components/clock.rst +++ b/components/clock.rst @@ -232,11 +232,11 @@ The constructor also allows setting a timezone or custom referenced date:: The ``DatePoint`` class also provides a named constructor to create dates from timestamps:: - $dateOfFirstCommitOfSymfonyProject = DatePoint::createFromTimestamp(1129645656); + $dateOfFirstCommitToSymfonyProject = DatePoint::createFromTimestamp(1129645656); // equivalent to: - // $dateOfFirstCommitOfSymfonyProject = (new \DateTimeImmutable())->setTimestamp(1129645656); + // $dateOfFirstCommitToSymfonyProject = (new \DateTimeImmutable())->setTimestamp(1129645656); - // negative timestamps (for dates before January 1, 1970) and fractional timestamps + // negative timestamps (for dates before January 1, 1970) and float timestamps // (for high precision sub-second datetimes) are also supported $dateOfFirstMoonLanding = DatePoint::createFromTimestamp(-14182940); From f9c53b97e032e7c78c6f02d5e333d1b2702bbb35 Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Thu, 11 Apr 2024 11:18:33 +0200 Subject: [PATCH 220/477] [Mailer] Add the `allowed_recipients` option --- mailer.rst | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) diff --git a/mailer.rst b/mailer.rst index f32f0ff0cfc..2ce97859b11 100644 --- a/mailer.rst +++ b/mailer.rst @@ -1852,6 +1852,75 @@ a specific address, instead of the *real* address: ; }; +You may also go even further by restricting the recipient to a specific +address, except for some specific ones. This can be done by using the +``allowed_recipients`` option: + +.. configuration-block:: + + .. code-block:: yaml + + # config/packages/mailer.yaml + when@dev: + framework: + mailer: + envelope: + recipients: ['youremail@example.com'] + allowed_recipients: + - 'interal@example.com' + # 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 + use Symfony\Config\FrameworkConfig; + + return static function (FrameworkConfig $framework): void { + // ... + $framework->mailer() + ->envelope() + ->recipients(['youremail@example.com']) + ->allowedRecipients([ + 'internal@example.com', + // you can also use regular expression to define allowed recipients + 'internal-.*@example.(com|fr)', + ]) + ; + }; + +With this configuration, all emails will be sent to ``youremail@example.com``, +except for those sent to ``internal@example.com``, which will receive emails as +usual. + +.. versionadded:: 7.1 + + The ``allowed_recipients`` option was introduced in Symfony 7.1. + Write a Functional Test ~~~~~~~~~~~~~~~~~~~~~~~ From f79518512854c71097b15784caf4fd674a6419c7 Mon Sep 17 00:00:00 2001 From: Florent Morselli Date: Thu, 11 Apr 2024 19:28:08 +0200 Subject: [PATCH 221/477] Update OidcTokenHandler dependencies and configuration This commit replaces the individual jwt packages previously needed by 'OidcTokenHandler' with the `web-token/jwt-library`. Configuration changes have been made to support multiple signing algorithms and a keyset instead of a single key. These changes provide more flexibility and reliability for token handling and verification. --- security/access_token.rst | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/security/access_token.rst b/security/access_token.rst index 5057e243c25..593c6404c7a 100644 --- a/security/access_token.rst +++ b/security/access_token.rst @@ -537,15 +537,12 @@ claims. To create your own user object from the claims, you must 2) Configure the OidcTokenHandler ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -The ``OidcTokenHandler`` requires ``web-token/jwt-signature``, -``web-token/jwt-checker`` and ``web-token/jwt-signature-algorithm-ecdsa`` -packages. If you haven't installed them yet, run these commands: +The ``OidcTokenHandler`` requires the package ``web-token/jwt-library``. +If you haven't installed it yet, run this command: .. code-block:: terminal - $ composer require web-token/jwt-signature - $ composer require web-token/jwt-checker - $ composer require web-token/jwt-signature-algorithm-ecdsa + $ composer require web-token/jwt-library Symfony provides a generic ``OidcTokenHandler`` to decode your token, validate it and retrieve the user info from it: @@ -561,10 +558,10 @@ it and retrieve the user info from it: access_token: token_handler: oidc: - # Algorithm used to sign the JWS - algorithm: 'ES256' + # Algorithms used to sign the JWS + algorithms: ['ES256', 'RS256'] # A JSON-encoded JWK - key: '{"kty":"...","k":"..."}' + keyset: '{"keys":[{"kty":"...","k":"..."}]}' # Audience (`aud` claim): required for validation purpose audience: 'api-example' # Issuers (`iss` claim): required for validation purpose @@ -589,8 +586,10 @@ it and retrieve the user info from it: - + + ES256 + RS256 https://oidc.example.com @@ -610,9 +609,9 @@ it and retrieve the user info from it: ->tokenHandler() ->oidc() // Algorithm used to sign the JWS - ->algorithm('ES256') + ->algorithms(['ES256', 'RS256']) // A JSON-encoded JWK - ->key('{"kty":"...","k":"..."}') + ->keyset('{"keys":[{"kty":"...","k":"..."}]}') // Audience (`aud` claim): required for validation purpose ->audience('api-example') // Issuers (`iss` claim): required for validation purpose @@ -636,8 +635,8 @@ configuration: token_handler: oidc: claim: email - algorithm: 'ES256' - key: '{"kty":"...","k":"..."}' + algorithms: ['ES256', 'RS256'] + keyset: '{"keys":[{"kty":"...","k":"..."}]}' audience: 'api-example' issuers: ['https://oidc.example.com'] @@ -657,7 +656,9 @@ configuration: - + + ES256 + RS256 https://oidc.example.com @@ -677,8 +678,8 @@ configuration: ->tokenHandler() ->oidc() ->claim('email') - ->algorithm('ES256') - ->key('{"kty":"...","k":"..."}') + ->algorithms(['ES256', 'RS256']) + ->keyset('{"keys":[{"kty":"...","k":"..."}]}') ->audience('api-example') ->issuers(['https://oidc.example.com']) ; From 7de0684b22c26bd4494eba8daa64eb4f097cfeef Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Fri, 12 Apr 2024 08:57:34 +0200 Subject: [PATCH 222/477] Minor reword --- mailer.rst | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/mailer.rst b/mailer.rst index 2ce97859b11..643702bdee1 100644 --- a/mailer.rst +++ b/mailer.rst @@ -1852,9 +1852,9 @@ a specific address, instead of the *real* address: ; }; -You may also go even further by restricting the recipient to a specific -address, except for some specific ones. This can be done by using the -``allowed_recipients`` option: +Use the ``allowed_recipients`` option to specify exceptions to the behavior defined +in the ``recipients`` option; allowing emails directed to these specific recipients +to maintain their original destination: .. configuration-block:: @@ -1867,7 +1867,7 @@ address, except for some specific ones. This can be done by using the envelope: recipients: ['youremail@example.com'] allowed_recipients: - - 'interal@example.com' + - 'internal@example.com' # you can also use regular expression to define allowed recipients - 'internal-.*@example.(com|fr)' @@ -1914,8 +1914,8 @@ address, except for some specific ones. This can be done by using the }; With this configuration, all emails will be sent to ``youremail@example.com``, -except for those sent to ``internal@example.com``, which will receive emails as -usual. +except for those sent to ``internal@example.com``, ``internal-monitoring@example.fr``, +etc., which will receive emails as usual. .. versionadded:: 7.1 From 75ab793bcc1ad27b0c47f57c5f7d4f1b0cd30ec1 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Fri, 12 Apr 2024 11:50:48 +0200 Subject: [PATCH 223/477] Minor rewords --- routing.rst | 36 +++++++++--------------------------- 1 file changed, 9 insertions(+), 27 deletions(-) diff --git a/routing.rst b/routing.rst index 0852883b9ee..790ae314516 100644 --- a/routing.rst +++ b/routing.rst @@ -2694,9 +2694,10 @@ service, which you can inject in your services or controllers:: } } -You can make the signed URI expire. To do so, you can pass a value to the `$expiration` argument -of :phpmethod:`Symfony\\Component\\HttpFoundation\\UriSigner::sign`. This optional argument is `null` by default. You can -specify an expiration date by several ways:: +For security reasons, it's common to make signed URIs expire after some time +(e.g. when using them to reset user credentials). By default, signed URIs don't +expire, but you can define an expiration date/time using the ``$expiration`` +argument of :phpmethod:`Symfony\\Component\\HttpFoundation\\UriSigner::sign`:: // src/Service/SomeService.php namespace App\Service; @@ -2718,46 +2719,27 @@ specify an expiration date by several ways:: $url = 'https://example.com/foo/bar?sort=desc'; // sign the URL with an explicit expiration date - $signedUrl = $this->uriSigner->sign($url, new \DateTime('2050-01-01')); + $signedUrl = $this->uriSigner->sign($url, new \DateTimeImmutable('2050-01-01')); // $signedUrl = 'https://example.com/foo/bar?sort=desc&_expiration=2524608000&_hash=e4a21b9' - // check the URL signature - $uriSignatureIsValid = $this->uriSigner->check($signedUrl); - // $uriSignatureIsValid = true - - // if given a \DateInterval, it will be added from now to get the expiration date + // if you pass a \DateInterval, it will be added from now to get the expiration date $signedUrl = $this->uriSigner->sign($url, new \DateInterval('PT10S')); // valid for 10 seconds from now // $signedUrl = 'https://example.com/foo/bar?sort=desc&_expiration=1712414278&_hash=e4a21b9' - // check the URL signature - $uriSignatureIsValid = $this->uriSigner->check($signedUrl); - // $uriSignatureIsValid = true - - sleep(30); // wait 30 seconds... - - // the URL signature has expired - $uriSignatureIsValid = $this->uriSigner->check($signedUrl); - // $uriSignatureIsValid = false - // you can also use a timestamp in seconds $signedUrl = $this->uriSigner->sign($url, 4070908800); // timestamp for the date 2099-01-01 // $signedUrl = 'https://example.com/foo/bar?sort=desc&_expiration=4070908800&_hash=e4a21b9' - } } -.. caution:: - - `null` means no expiration for the signed URI. - .. note:: - When making the URI expire, an `_expiration` query parameter is added to the URL and the expiration date is - converted into a timestamp + The expiration date/time is included in the signed URIs as a timestamp via + the ``_expiration`` query parameter. .. versionadded:: 7.1 - The possibility to add an expiration date for a signed URI was introduced in Symfony 7.1. + The feature to add an expiration date for a signed URI was introduced in Symfony 7.1. Troubleshooting --------------- From d0fd14b4c4ad1bebad99d6d4594d5ef0d2af7729 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Fri, 12 Apr 2024 17:25:03 +0200 Subject: [PATCH 224/477] Add a versionadded directive --- translation.rst | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/translation.rst b/translation.rst index 3320ce9ee37..eb16fbee1bb 100644 --- a/translation.rst +++ b/translation.rst @@ -979,8 +979,14 @@ preferences. This is achieved with the ``getPreferredLanguage()`` method of the Symfony finds the best possible language based on the locales passed as argument and the value of the ``Accept-Language`` HTTP header. If it can't find a perfect -match between them, this method returns the first locale passed as argument -(that's why the order of the passed locales is important). +match between them, Symfony will try to find a partial match based on the language +(e.g. ``fr_CA`` would match ``fr_Latn_CH`` because their language is the same). +If there's no perfect or partial match, this method returns the first locale passed +as argument (that's why the order of the passed locales is important). + +.. versionadded:: 7.1 + + The feature to match lcoales partially was introduced in Symfony 7.1. .. _translation-fallback: From 6ac1b818e7697eff318fd95ad16409dd22e78994 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Fri, 12 Apr 2024 17:45:42 +0200 Subject: [PATCH 225/477] Fix typo --- translation.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/translation.rst b/translation.rst index eb16fbee1bb..891f00845cb 100644 --- a/translation.rst +++ b/translation.rst @@ -986,7 +986,7 @@ as argument (that's why the order of the passed locales is important). .. versionadded:: 7.1 - The feature to match lcoales partially was introduced in Symfony 7.1. + The feature to match locales partially was introduced in Symfony 7.1. .. _translation-fallback: From 0ed185ac3443c8718127e4dbd0ac4588112abd20 Mon Sep 17 00:00:00 2001 From: Ninos Ego Date: Fri, 12 Apr 2024 18:05:28 +0200 Subject: [PATCH 226/477] [Validator] Add support for types (`ALL*`, `LOCAL_*`, `UNIVERSAL_*`, `UNICAST_*`, `MULTICAST_*`, `BROADCAST`) in `MacAddress` constraint --- reference/constraints/MacAddress.rst | 29 ++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/reference/constraints/MacAddress.rst b/reference/constraints/MacAddress.rst index 8055b53ff4a..93fe8142fc4 100644 --- a/reference/constraints/MacAddress.rst +++ b/reference/constraints/MacAddress.rst @@ -103,4 +103,33 @@ Parameter Description .. include:: /reference/constraints/_payload-option.rst.inc +.. _reference-constraint-mac-address-type: + +``type`` +~~~~~~~~ + +**type**: ``string`` **default**: ``all`` + +This determines exactly *how* the MAC address is validated. This option defines a +lot of different possible values based on the type of MAC address that you want to allow/deny: + +================================ ============================================================== +Parameter Description +================================ ============================================================== +``all`` All +``all_no_broadcast`` All except broadcast +``local_all`` Only local +``local_no_broadcast`` Only local except broadcast +``local_unicast`` Only local and unicast +``local_multicast`` Only local and multicast +``local_multicast_no_broadcast`` Only local and multicast except broadcast +``universal_all`` Only universal +``universal_unicast`` Only universal and unicast +``universal_multicast`` Only universal and multicast +``unicast_all`` Only unicast +``multicast_all`` Only multicast +``multicast_no_broadcast`` Only multicast except broadcast +``broadcast`` Only broadcast +=============== ============================================================== + .. _`MAC address`: https://en.wikipedia.org/wiki/MAC_address From babae18a11a2c3e84de9d0448cbdb9def239b438 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Mon, 15 Apr 2024 09:17:57 +0200 Subject: [PATCH 227/477] Tweaks --- reference/constraints/MacAddress.rst | 29 +++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/reference/constraints/MacAddress.rst b/reference/constraints/MacAddress.rst index 93fe8142fc4..2958af49874 100644 --- a/reference/constraints/MacAddress.rst +++ b/reference/constraints/MacAddress.rst @@ -110,26 +110,29 @@ Parameter Description **type**: ``string`` **default**: ``all`` -This determines exactly *how* the MAC address is validated. This option defines a -lot of different possible values based on the type of MAC address that you want to allow/deny: +.. versionadded:: 7.1 + + The ``type`` option was introduced in Symfony 7.1. -================================ ============================================================== -Parameter Description -================================ ============================================================== +This option defines the kind of MAC addresses that are allowed. There are a lot +of different possible values based on your needs: + +================================ ========================================= +Parameter Allowed MAC addresses +================================ ========================================= ``all`` All ``all_no_broadcast`` All except broadcast +``broadcast`` Only broadcast ``local_all`` Only local +``local_multicast_no_broadcast`` Only local and multicast except broadcast +``local_multicast`` Only local and multicast ``local_no_broadcast`` Only local except broadcast ``local_unicast`` Only local and unicast -``local_multicast`` Only local and multicast -``local_multicast_no_broadcast`` Only local and multicast except broadcast -``universal_all`` Only universal -``universal_unicast`` Only universal and unicast -``universal_multicast`` Only universal and multicast -``unicast_all`` Only unicast ``multicast_all`` Only multicast ``multicast_no_broadcast`` Only multicast except broadcast -``broadcast`` Only broadcast -=============== ============================================================== +``unicast_all`` Only unicast +``universal_all`` Only universal +``universal_multicast`` Only universal and multicast +================================ ========================================= .. _`MAC address`: https://en.wikipedia.org/wiki/MAC_address From 25c5adfcbb2c68ebe8261643afcebf53464206ea Mon Sep 17 00:00:00 2001 From: Yonel Ceruto Date: Wed, 3 Apr 2024 19:12:01 -0400 Subject: [PATCH 228/477] Updating prepend extension capabilities --- bundles/prepend_extension.rst | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/bundles/prepend_extension.rst b/bundles/prepend_extension.rst index 2a5736c440e..807c7f18caf 100644 --- a/bundles/prepend_extension.rst +++ b/bundles/prepend_extension.rst @@ -171,6 +171,9 @@ method:: $containerBuilder->prependExtensionConfig('framework', [ 'cache' => ['prefix_seed' => 'foo/bar'], ]); + + // prepend config from a file + $containerConfigurator->import('../config/packages/cache.php'); } } @@ -178,6 +181,12 @@ method:: The ``prependExtension()`` method, like ``prepend()``, is called only at compile time. +.. deprecated:: 7.1 + + The :method:`Symfony\\Component\\DependencyInjection\\Loader\\Configurator\\ContainerConfigurator::import` + method behavior was modified in Symfony 7.1 to prepend config instead of appending. This behavior change only + affects to the ``prependExtension()`` method. + Alternatively, you can use the ``prepend`` parameter of the :method:`Symfony\\Component\\DependencyInjection\\Loader\\Configurator\\ContainerConfigurator::extension` method:: From a58dccf088719da4dceedc49dab3d5c18b2701b3 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Mon, 15 Apr 2024 17:01:53 +0200 Subject: [PATCH 229/477] Reword --- console/input.rst | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/console/input.rst b/console/input.rst index f889926be59..6e7fc85a055 100644 --- a/console/input.rst +++ b/console/input.rst @@ -314,29 +314,34 @@ The above code can be simplified as follows because ``false !== null``:: Fetching The Raw Command Input ------------------------------ -Sometimes, you may need to fetch the raw input that was passed to the command. -This is useful when you need to parse the input yourself or when you need to -pass the input to another command without having to worry about the number -of arguments or options defined in your own command. This can be achieved -thanks to the -:method:`Symfony\\Component\\Console\\Input\\ArgvInput::getRawTokens` method:: +Symfony provides a :method:`Symfony\\Component\\Console\\Input\\ArgvInput::getRawTokens` +method to fetch the raw input that was passed to the command. This is useful if +you want to parse the input yourself or when you need to pass the input to another +command without having to worry about the number of arguments or options:: // ... use Symfony\Component\Process\Process; protected function execute(InputInterface $input, OutputInterface $output): int { - // pass the raw input of your command to the "ls" command - $process = new Process(['ls', ...$input->getRawTokens(true)]); + // if this command was run as: + // php bin/console app:my-command foo --bar --baz=3 --qux=value1 --qux=value2 + + $tokens = $input->getRawTokens(); + // $tokens = ['app:my-command', 'foo', '--bar', '--baz=3', '--qux=value1', '--qux=value2']; + + // pass true as argument to not include the original command name + $tokens = $input->getRawTokens(true); + // $tokens = ['foo', '--bar', '--baz=3', '--qux=value1', '--qux=value2']; + + // pass the raw input to any other command (from Symfony or the operating system) + $process = new Process(['app:other-command', ...$input->getRawTokens(true)]); $process->setTty(true); $process->mustRun(); // ... } -You can include the current command name in the raw tokens by passing ``true`` -to the ``getRawTokens`` method only parameter. - .. versionadded:: 7.1 The :method:`Symfony\\Component\\Console\\Input\\ArgvInput::getRawTokens` From 4937afbab404e8fdeaa51d9cba2d7eaff2edc67d Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Mon, 15 Apr 2024 17:57:32 +0200 Subject: [PATCH 230/477] Minor reword --- bundles/prepend_extension.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bundles/prepend_extension.rst b/bundles/prepend_extension.rst index 807c7f18caf..e4099d9f81a 100644 --- a/bundles/prepend_extension.rst +++ b/bundles/prepend_extension.rst @@ -181,11 +181,11 @@ method:: The ``prependExtension()`` method, like ``prepend()``, is called only at compile time. -.. deprecated:: 7.1 +.. versionadded:: 7.1 - The :method:`Symfony\\Component\\DependencyInjection\\Loader\\Configurator\\ContainerConfigurator::import` - method behavior was modified in Symfony 7.1 to prepend config instead of appending. This behavior change only - affects to the ``prependExtension()`` method. + Starting from Symfony 7.1, calling the :method:`Symfony\\Component\\DependencyInjection\\Loader\\Configurator\\ContainerConfigurator::import` + method inside ``prependExtension()`` will prepend the given configuration. + In previous Symfony versions, this method appended the configuration. Alternatively, you can use the ``prepend`` parameter of the :method:`Symfony\\Component\\DependencyInjection\\Loader\\Configurator\\ContainerConfigurator::extension` From f1793555e2e68d4b7754f5022487753a3621a8fa Mon Sep 17 00:00:00 2001 From: Andrey Lebedev Date: Wed, 20 Mar 2024 21:37:29 +0400 Subject: [PATCH 231/477] [Notifier] LOX24 SMS Gateway Notifier --- notifier.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/notifier.rst b/notifier.rst index 6bf3ab71c48..c9cf3068d1c 100644 --- a/notifier.rst +++ b/notifier.rst @@ -74,6 +74,7 @@ Service Package DSN `Iqsms`_ ``symfony/iqsms-notifier`` ``iqsms://LOGIN:PASSWORD@default?from=FROM`` `KazInfoTeh`_ ``symfony/kaz-info-teh-notifier`` ``kaz-info-teh://USERNAME:PASSWORD@default?sender=FROM`` `LightSms`_ ``symfony/light-sms-notifier`` ``lightsms://LOGIN:TOKEN@default?from=PHONE`` +`LOX24`_ ``symfony/lox24-notifier`` ``lox24://USER:TOKEN@default?from=FROM`` `Mailjet`_ ``symfony/mailjet-notifier`` ``mailjet://TOKEN@default?from=FROM`` `MessageBird`_ ``symfony/message-bird-notifier`` ``messagebird://TOKEN@default?from=FROM`` `MessageMedia`_ ``symfony/message-media-notifier`` ``messagemedia://API_KEY:API_SECRET@default?from=FROM`` @@ -115,7 +116,7 @@ Service Package DSN .. versionadded:: 7.1 - The `SmsSluzba`_ and `SMSense`_ integrations were introduced in Symfony 7.1. + The `SmsSluzba`_, `SMSense`_ and `LOX24`_ integrations were introduced in Symfony 7.1. .. deprecated:: 7.1 @@ -1005,6 +1006,7 @@ is dispatched. Listeners receive a .. _`LINE Notify`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/LineNotify/README.md .. _`LightSms`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/LightSms/README.md .. _`LinkedIn`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/LinkedIn/README.md +.. _`LOX24`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Lox24/README.md .. _`Mailjet`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Mailjet/README.md .. _`Mastodon`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Mastodon/README.md .. _`Mattermost`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Mattermost/README.md From 885d65db770ec0f72b77d5f6f2169d8f43774314 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Tue, 16 Apr 2024 16:06:54 +0200 Subject: [PATCH 232/477] Minor tweak --- controller.rst | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/controller.rst b/controller.rst index 2edf6affb2f..90277e07b76 100644 --- a/controller.rst +++ b/controller.rst @@ -555,7 +555,8 @@ if you want to map a nested array of specific DTOs:: ) {} } -Nevertheless, if you want to send the array of payloads directly like this: +Instead of returning an array of DTO objects, you can tell Symfony to transform +each DTO object into an array and return something like this: .. code-block:: json @@ -572,7 +573,8 @@ Nevertheless, if you want to send the array of payloads directly like this: } ] -Map the parameter as an array and configure the type of each element in the attribute:: +To do so, map the parameter as an array and configure the type of each element +using the ``type`` option of the attribute:: public function dashboard( #[MapRequestPayload(type: UserDTO::class)] array $users @@ -581,6 +583,10 @@ Map the parameter as an array and configure the type of each element in the attr // ... } +.. versionadded:: 7.1 + + The ``type`` option of ``#[MapRequestPayload]`` was introduced in Symfony 7.1. + Managing the Session -------------------- From be50a3c6688a941325699568dad333e39accc669 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Andr=C3=A9?= Date: Wed, 17 Apr 2024 12:29:10 +0200 Subject: [PATCH 233/477] Fix Explicite nullable types (7.0) --- testing.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/testing.rst b/testing.rst index ee3a6c50191..0dfa5212217 100644 --- a/testing.rst +++ b/testing.rst @@ -1082,10 +1082,10 @@ Mailer Assertions Notifier Assertions ................... -``assertNotificationCount(int $count, string $transportName = null, string $message = '')`` +``assertNotificationCount(int $count, ?string $transportName = null, string $message = '')`` Asserts that the given number of notifications has been created (in total or for the given transport). -``assertQueuedNotificationCount(int $count, string $transportName = null, string $message = '')`` +``assertQueuedNotificationCount(int $count, ?string $transportName = null, string $message = '')`` Asserts that the given number of notifications are queued (in total or for the given transport). ``assertNotificationIsQueued(MessageEvent $event, string $message = '')`` @@ -1113,7 +1113,7 @@ HttpClient Assertions For all the following assertions, ``$client->enableProfiler()`` must be called before the code that will trigger HTTP request(s). -``assertHttpClientRequest(string $expectedUrl, string $expectedMethod = 'GET', string|array $expectedBody = null, array $expectedHeaders = [], string $httpClientId = 'http_client')`` +``assertHttpClientRequest(string $expectedUrl, string $expectedMethod = 'GET', string|array|null $expectedBody = null, array $expectedHeaders = [], string $httpClientId = 'http_client')`` Asserts that the given URL has been called using, if specified, the given method body and headers. By default it will check on the HttpClient, but you can also pass a specific HttpClient ID. From f7225d9ef76dcc592dd124d373e3e08eb301ed48 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Fri, 19 Apr 2024 16:09:45 +0200 Subject: [PATCH 234/477] fix typo --- components/intl.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/intl.rst b/components/intl.rst index d18ac21b10a..008d9161fd7 100644 --- a/components/intl.rst +++ b/components/intl.rst @@ -389,7 +389,7 @@ Symfony provides utilities to translate emojis into their textual representation in all languages. Read the documentation on :ref:`working with emojis in strings ` to learn more about this feature. -Disk space +Disk Space ---------- If you need to save disk space (e.g. because you deploy to some service with tight size From e98c6f14159186418ba2320450a25a2d4fbde33b Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Mon, 22 Apr 2024 11:00:22 +0200 Subject: [PATCH 235/477] [Process] Mention `Process::setIgnoredSignals` --- components/process.rst | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/components/process.rst b/components/process.rst index c4db5c18a9c..9502665dde1 100644 --- a/components/process.rst +++ b/components/process.rst @@ -511,6 +511,20 @@ When running a program asynchronously, you can send it POSIX signals with the // will send a SIGKILL to the process $process->signal(SIGKILL); +You can make the process ignore signals by using the +:method:`Symfony\\Component\\Process\\Process::setIgnoredSignals` +method. The given signals won't be propagated to the child process:: + + use Symfony\Component\Process\Process; + + $process = new Process(['find', '/', '-name', 'rabbit']); + $process->setIgnoredSignals([SIGKILL, SIGUSR1]); + +.. versionadded:: 7.1 + + The :method:`Symfony\\Component\\Process\\Process::setIgnoredSignals` + method was introduced in Symfony 7.1. + Process Pid ----------- From 6e19233cf00ff3ae35c781dfdac0726faf159e75 Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Mon, 22 Apr 2024 19:21:13 +0200 Subject: [PATCH 236/477] [DependencyInjection] Add `#[AutowireMethodOf]` attribute Co-Authored-By: Oskar Stark --- reference/attributes.rst | 1 + service_container/autowiring.rst | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/reference/attributes.rst b/reference/attributes.rst index 015b8751834..a1e8532c347 100644 --- a/reference/attributes.rst +++ b/reference/attributes.rst @@ -35,6 +35,7 @@ Dependency Injection * :doc:`AutowireDecorated ` * :doc:`AutowireIterator ` * :ref:`AutowireLocator ` +* :ref:`AutowireMethodOf ` * :ref:`AutowireServiceClosure ` * :ref:`Exclude ` * :ref:`Lazy ` diff --git a/service_container/autowiring.rst b/service_container/autowiring.rst index 3c7a2eba52b..8b2b1c4d51d 100644 --- a/service_container/autowiring.rst +++ b/service_container/autowiring.rst @@ -737,6 +737,36 @@ attribute. By doing so, the callable will automatically be lazy, which means that the encapsulated service will be instantiated **only** at the closure's first call. +:class:`Symfony\Component\DependencyInjection\Attribute\\AutowireMethodOf` +provides a simpler way of specifying the name of the service method by using +the property name as method name:: + + // src/Service/MessageGenerator.php + namespace App\Service; + + use Symfony\Component\DependencyInjection\Attribute\AutowireMethodOf; + + class MessageGenerator + { + public function __construct( + #[AutowireMethodOf('third_party.remote_message_formatter')] + private \Closure $format, + ) { + } + + public function generate(string $message): void + { + $formattedMessage = ($this->format)($message); + + // ... + } + } + +.. versionadded:: 7.1 + + :class:`Symfony\Component\DependencyInjection\Attribute\\AutowireMethodOf` + was introduced in Symfony 7.1. + .. _autowiring-calls: Autowiring other Methods (e.g. Setters and Public Typed Properties) From c7c9182ec30c39536203d1a7953b36a81bb1e7ce Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Mon, 22 Apr 2024 20:37:33 +0200 Subject: [PATCH 237/477] - --- service_container/autowiring.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/service_container/autowiring.rst b/service_container/autowiring.rst index f3a32c01ea0..594e5f584f8 100644 --- a/service_container/autowiring.rst +++ b/service_container/autowiring.rst @@ -765,8 +765,8 @@ the property name as method name:: .. versionadded:: 7.1 - :class:`Symfony\Component\DependencyInjection\Attribute\\AutowireMethodOf` - was introduced in Symfony 7.1. + The :class:`Symfony\Component\DependencyInjection\Attribute\\AutowireMethodOf` + attribute was introduced in Symfony 7.1. .. _autowiring-calls: From 20759594a59d907a06c0489f21ea300cf67ec4a8 Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Mon, 22 Apr 2024 20:40:25 +0200 Subject: [PATCH 238/477] - --- service_container/autowiring.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/service_container/autowiring.rst b/service_container/autowiring.rst index f89cfdbdc32..8ccde353fe9 100644 --- a/service_container/autowiring.rst +++ b/service_container/autowiring.rst @@ -738,9 +738,9 @@ attribute. By doing so, the callable will automatically be lazy, which means that the encapsulated service will be instantiated **only** at the closure's first call. -:class:`Symfony\Component\DependencyInjection\Attribute\\AutowireMethodOf` -provides a simpler way of specifying the name of the service method by using -the property name as method name:: +The :class:`Symfony\\Component\\DependencyInjection\\Attribute\\AutowireMethodOf` +attribute provides a simpler way of specifying the name of the service method +by using the property name as method name:: // src/Service/MessageGenerator.php namespace App\Service; From 43355162a8cce5c794299e6d359a8a436929c067 Mon Sep 17 00:00:00 2001 From: Rene Lima Date: Fri, 19 Apr 2024 20:28:09 +0200 Subject: [PATCH 239/477] Add documentation for #[MapUploadedFile] attribute --- controller.rst | 93 ++++++++++++++++++++++++++++++++++++++++ reference/attributes.rst | 1 + 2 files changed, 94 insertions(+) diff --git a/controller.rst b/controller.rst index 90277e07b76..f0cac7b2350 100644 --- a/controller.rst +++ b/controller.rst @@ -587,6 +587,99 @@ using the ``type`` option of the attribute:: The ``type`` option of ``#[MapRequestPayload]`` was introduced in Symfony 7.1. +.. _controller_map-uploaded-file: + +Mapping Uploaded File +~~~~~~~~~~~~~~~~~~~~~ + +You can map ``UploadedFile``s to the controller arguments and optionally bind ``Constraints`` to them. +The argument resolver fetches the ``UploadedFile`` based on the argument name. + +:: + + namespace App\Controller; + + use Symfony\Component\HttpFoundation\File\UploadedFile; + use Symfony\Component\HttpFoundation\Response; + use Symfony\Component\HttpKernel\Attribute\MapUploadedFile; + use Symfony\Component\Routing\Attribute\Route; + use Symfony\Component\Validator\Constraints as Assert; + + #[Route('/user/picture', methods: ['PUT'])] + class ChangeUserPictureController + { + public function _invoke( + #[MapUploadedFile([ + new Assert\File(mimeTypes: ['image/png', 'image/jpeg']), + new Assert\Image(maxWidth: 3840, maxHeight: 2160) + ])] + UploadedFile $picture + ): Response { + // ... + } + } + +.. tip:: + + The bound ``Constraints`` are performed before injecting the ``UploadedFile`` into the controller argument. + When a constraint violation is detected an ``HTTPException`` is thrown and the controller's + action is not executed. + +Mapping ``UploadedFile``s with no custom settings. + +.. code-block:: php-attributes + + #[MapUploadedFile] + UploadedFile $document + +An ``HTTPException`` is thrown when the file is not submitted. +You can skip this check by making the controller argument nullable. + +.. code-block:: php-attributes + + #[MapUploadedFile] + ?UploadedFile $document + +.. code-block:: php-attributes + + #[MapUploadedFile] + UploadedFile|null $document + +``UploadedFile`` collections must be mapped to array or variadic arguments. +The bound ``Constraints`` will be applied to each file in the collection. +If a constraint violation is detected to one of them an ``HTTPException`` is thrown. + +.. code-block:: php-attributes + + #[MapUploadedFile(new Assert\File(mimeTypes: ['application/pdf']))] + array $documents + +.. code-block:: php-attributes + + #[MapUploadedFile(new Assert\File(mimeTypes: ['application/pdf']))] + UploadedFile ...$documents + +Handling custom names. + +.. code-block:: php-attributes + + #[MapUploadedFile(name: 'something-else')] + UploadedFile $document + +Changing the ``HTTP Status`` thrown when constraint violations are detected. + +.. code-block:: php-attributes + + #[MapUploadedFile( + constraints: new Assert\File(maxSize: '2M'), + validationFailedStatusCode: Response::HTTP_REQUEST_ENTITY_TOO_LARGE + )] + UploadedFile $document + +.. versionadded:: 7.1 + + The ``#[MapUploadedFile]`` attribute was introduced in Symfony 7.1. + Managing the Session -------------------- diff --git a/reference/attributes.rst b/reference/attributes.rst index a1e8532c347..4428dc4c587 100644 --- a/reference/attributes.rst +++ b/reference/attributes.rst @@ -64,6 +64,7 @@ HttpKernel * :ref:`MapQueryParameter ` * :ref:`MapQueryString ` * :ref:`MapRequestPayload ` +* :ref:`MapUploadedFile ` * :ref:`ValueResolver ` * :ref:`WithHttpStatus ` * :ref:`WithLogLevel ` From 044be1e65529b555f35688fc84998e3dd18b374b Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Fri, 26 Apr 2024 16:11:47 +0200 Subject: [PATCH 240/477] Tweaks --- security/access_token.rst | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/security/access_token.rst b/security/access_token.rst index 593c6404c7a..2aca75118a3 100644 --- a/security/access_token.rst +++ b/security/access_token.rst @@ -537,7 +537,7 @@ claims. To create your own user object from the claims, you must 2) Configure the OidcTokenHandler ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -The ``OidcTokenHandler`` requires the package ``web-token/jwt-library``. +The ``OidcTokenHandler`` requires the ``web-token/jwt-library`` package. If you haven't installed it yet, run this command: .. code-block:: terminal @@ -619,6 +619,11 @@ it and retrieve the user info from it: ; }; +.. versionadded:: 7.1 + + The support of multiple algorithms to sign the JWS was introduced in Symfony 7.1. + In previous versions, only the ``ES256`` algorithm was supported. + Following the `OpenID Connect Specification`_, the ``sub`` claim is used by default as user identifier. To use another claim, specify it on the configuration: From 9fafa5fa863bed33d56113f904f6dca279e06f4c Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Mon, 29 Apr 2024 12:19:06 +0200 Subject: [PATCH 241/477] Use PHP 8.2 for build --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 778d3fd5a2b..09158fd099a 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -26,7 +26,7 @@ jobs: - name: "Set-up PHP" uses: shivammathur/setup-php@v2 with: - php-version: 8.1 + php-version: 8.2 coverage: none tools: "composer:v2" From 11cd34d903362e897626a0d80110dd50da3ba7d4 Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Mon, 29 Apr 2024 12:21:09 +0200 Subject: [PATCH 242/477] - --- bundles/configuration.rst | 4 ---- bundles/extension.rst | 4 ---- 2 files changed, 8 deletions(-) diff --git a/bundles/configuration.rst b/bundles/configuration.rst index 48b91c1713a..882e828aeb6 100644 --- a/bundles/configuration.rst +++ b/bundles/configuration.rst @@ -61,10 +61,6 @@ There are two different ways of creating friendly configuration for a bundle: Using the AbstractBundle Class ------------------------------ -.. versionadded:: 6.1 - - The ``AbstractBundle`` class was introduced in Symfony 6.1. - In bundles extending the :class:`Symfony\\Component\\HttpKernel\\Bundle\\AbstractBundle` class, you can add all the logic related to processing the configuration in that class:: diff --git a/bundles/extension.rst b/bundles/extension.rst index d2e3cd05b9d..e1e2dba3e6b 100644 --- a/bundles/extension.rst +++ b/bundles/extension.rst @@ -20,10 +20,6 @@ There are two different ways of doing it: Loading Services Directly in your Bundle Class ---------------------------------------------- -.. versionadded:: 6.1 - - The ``AbstractBundle`` class was introduced in Symfony 6.1. - In bundles extending the :class:`Symfony\\Component\\HttpKernel\\Bundle\\AbstractBundle` class, you can define the :method:`Symfony\\Component\\HttpKernel\\Bundle\\AbstractBundle::loadExtension` method to load service definitions from configuration files:: From d7b56cd00b50d69db80c294e0ec8a6b0c87268f3 Mon Sep 17 00:00:00 2001 From: Damien Fernandes Date: Mon, 29 Apr 2024 13:03:46 +0200 Subject: [PATCH 243/477] [Scheduler] Fix code sample --- scheduler.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scheduler.rst b/scheduler.rst index 6a50a8e34ae..dd723c326c3 100644 --- a/scheduler.rst +++ b/scheduler.rst @@ -901,7 +901,7 @@ same task more than once:: ->with( // ... ) - ->lock($this->lockFactory->createLock('my-lock') + ->lock($this->lockFactory->createLock('my-lock')); } } From a209c5709324cea384f54097333c289d77153571 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Thu, 2 May 2024 08:50:08 +0200 Subject: [PATCH 244/477] rename the model_type option to input --- reference/forms/types/money.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/reference/forms/types/money.rst b/reference/forms/types/money.rst index 8e2130a5909..5793097fe2f 100644 --- a/reference/forms/types/money.rst +++ b/reference/forms/types/money.rst @@ -76,8 +76,8 @@ If set to ``true``, the HTML input will be rendered as a native HTML5 As HTML5 number format is normalized, it is incompatible with ``grouping`` option. -model_type -~~~~~~~~~~ +input +~~~~~ **type**: ``string`` **default**: ``float`` @@ -87,7 +87,7 @@ values stored in cents as integers) set this option to ``integer``. .. versionadded:: 7.1 - The ``model_type`` option was introduced in Symfony 7.1. + The ``input`` option was introduced in Symfony 7.1. scale ~~~~~ From 90c5f4f9fabfa2fdca9a79e6c79fa70983e3922f Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Thu, 2 May 2024 11:43:31 +0200 Subject: [PATCH 245/477] deprecate the base_template_class option --- reference/configuration/twig.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/reference/configuration/twig.rst b/reference/configuration/twig.rst index 1b9c1ef3bd9..596d70d8a2b 100644 --- a/reference/configuration/twig.rst +++ b/reference/configuration/twig.rst @@ -62,6 +62,10 @@ base_template_class **type**: ``string`` **default**: ``Twig\Template`` +.. deprecated:: 7.1 + + The ``base_template_class`` option is deprecated since Symfony 7.1. + Twig templates are compiled into PHP classes before using them to render contents. This option defines the base class from which all the template classes extend. Using a custom base template is discouraged because it will make your From dabb2d9f6976a2e475279d6caf24a3330649fc8e Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Tue, 7 May 2024 11:15:03 +0200 Subject: [PATCH 246/477] [Validator] Misc tweaks in MacAddress and Charset constraints --- reference/constraints/Charset.rst | 4 ++-- reference/constraints/MacAddress.rst | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/reference/constraints/Charset.rst b/reference/constraints/Charset.rst index 4f1a260356f..084f24cdf76 100644 --- a/reference/constraints/Charset.rst +++ b/reference/constraints/Charset.rst @@ -88,8 +88,8 @@ Options An encoding or a set of encodings to check against. If you pass an array of encodings, the validator will check if the value is encoded in *any* of the -encodings. This option accepts any value that can be passed to -:phpfunction:`mb_detect_encoding`. +encodings. This option accepts any value that can be passed to the +:phpfunction:`mb_detect_encoding` PHP function. .. include:: /reference/constraints/_groups-option.rst.inc diff --git a/reference/constraints/MacAddress.rst b/reference/constraints/MacAddress.rst index 2958af49874..59adffe7c11 100644 --- a/reference/constraints/MacAddress.rst +++ b/reference/constraints/MacAddress.rst @@ -19,18 +19,18 @@ Basic Usage ----------- To use the MacAddress validator, apply it to a property on an object that -will contain a host name. +can contain a MAC address: .. configuration-block:: .. code-block:: php-attributes - // src/Entity/Author.php + // src/Entity/Device.php namespace App\Entity; use Symfony\Component\Validator\Constraints as Assert; - class Author + class Device { #[Assert\MacAddress] protected string $mac; @@ -39,7 +39,7 @@ will contain a host name. .. code-block:: yaml # config/validator/validation.yaml - App\Entity\Author: + App\Entity\Device: properties: mac: - MacAddress: ~ @@ -52,7 +52,7 @@ will contain a host name. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/dic/constraint-mapping https://symfony.com/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd"> - + @@ -61,13 +61,13 @@ will contain a host name. .. code-block:: php - // src/Entity/Author.php + // src/Entity/Device.php namespace App\Entity; use Symfony\Component\Validator\Constraints as Assert; use Symfony\Component\Validator\Mapping\ClassMetadata; - class Author + class Device { // ... From 979891b65830f123e846534119aab8e559b48d74 Mon Sep 17 00:00:00 2001 From: rahul Date: Tue, 7 May 2024 14:46:30 +0530 Subject: [PATCH 247/477] Removed unnecessary Request parameter --- security/csrf.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security/csrf.rst b/security/csrf.rst index 76aaf9ea4bf..a758c856f16 100644 --- a/security/csrf.rst +++ b/security/csrf.rst @@ -176,7 +176,7 @@ attribute on the controller action:: // ... #[IsCsrfTokenValid('delete-item', tokenKey: 'token')] - public function delete(Request $request): Response + public function delete(): Response { // ... do something, like deleting an object } From 846cbae795919e74ec57ee9d1010cb3ff16d4041 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 8 May 2024 12:52:24 +0200 Subject: [PATCH 248/477] Tweaks and rewords --- controller.rst | 83 +++++++++++++++++++++++++++----------------------- 1 file changed, 45 insertions(+), 38 deletions(-) diff --git a/controller.rst b/controller.rst index ee6c2ecd194..cec5ce4b904 100644 --- a/controller.rst +++ b/controller.rst @@ -589,84 +589,91 @@ using the ``type`` option of the attribute:: .. _controller_map-uploaded-file: -Mapping Uploaded File -~~~~~~~~~~~~~~~~~~~~~ +Mapping Uploaded Files +~~~~~~~~~~~~~~~~~~~~~~ -You can map ``UploadedFile``s to the controller arguments and optionally bind ``Constraints`` to them. -The argument resolver fetches the ``UploadedFile`` based on the argument name. - -:: +Symfony provides an attribute called ``#[MapUploadedFile]`` to map one or more +``UploadedFile`` objects to controller arguments:: namespace App\Controller; + use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\File\UploadedFile; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Attribute\MapUploadedFile; use Symfony\Component\Routing\Attribute\Route; - use Symfony\Component\Validator\Constraints as Assert; - #[Route('/user/picture', methods: ['PUT'])] - class ChangeUserPictureController + class UserController extends AbstractController { - public function _invoke( - #[MapUploadedFile([ - new Assert\File(mimeTypes: ['image/png', 'image/jpeg']), - new Assert\Image(maxWidth: 3840, maxHeight: 2160) - ])] - UploadedFile $picture + #[Route('/user/picture', methods: ['PUT'])] + public function changePicture( + #[MapUploadedFile] UploadedFile $picture, ): Response { // ... } } -.. tip:: - - The bound ``Constraints`` are performed before injecting the ``UploadedFile`` into the controller argument. - When a constraint violation is detected an ``HTTPException`` is thrown and the controller's - action is not executed. - -Mapping ``UploadedFile``s with no custom settings. +In this example, the associated :doc:`argument resolver ` +fetches the ``UploadedFile`` based on the argument name (``$picture``). If no file +is submitted, an ``HttpException`` is thrown. You can change this by making the +controller argument nullable: .. code-block:: php-attributes #[MapUploadedFile] - UploadedFile $document + ?UploadedFile $document -An ``HTTPException`` is thrown when the file is not submitted. -You can skip this check by making the controller argument nullable. +The ``#[MapUploadedFile]`` attribute also allows to pass a list of constraints +to apply to the uploaded file:: -.. code-block:: php-attributes + namespace App\Controller; - #[MapUploadedFile] - ?UploadedFile $document + use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; + use Symfony\Component\HttpFoundation\File\UploadedFile; + use Symfony\Component\HttpFoundation\Response; + use Symfony\Component\HttpKernel\Attribute\MapUploadedFile; + use Symfony\Component\Routing\Attribute\Route; + use Symfony\Component\Validator\Constraints as Assert; -.. code-block:: php-attributes + class UserController extends AbstractController + { + #[Route('/user/picture', methods: ['PUT'])] + public function changePicture( + #[MapUploadedFile([ + new Assert\File(mimeTypes: ['image/png', 'image/jpeg']), + new Assert\Image(maxWidth: 3840, maxHeight: 2160), + ])] + UploadedFile $picture, + ): Response { + // ... + } + } - #[MapUploadedFile] - UploadedFile|null $document +The validation constraints are checked before injecting the ``UploadedFile`` into +the controller argument. If there's a constraint violation, an ``HttpException`` +is thrown and the controller's action is not executed. -``UploadedFile`` collections must be mapped to array or variadic arguments. -The bound ``Constraints`` will be applied to each file in the collection. -If a constraint violation is detected to one of them an ``HTTPException`` is thrown. +If you need to upload a collection of files, map them to an array or a variadic +argument. The given constraint will be applied to all files and if any of them +fails, an ``HttpException`` is thrown: .. code-block:: php-attributes #[MapUploadedFile(new Assert\File(mimeTypes: ['application/pdf']))] array $documents -.. code-block:: php-attributes - #[MapUploadedFile(new Assert\File(mimeTypes: ['application/pdf']))] UploadedFile ...$documents -Handling custom names. +Use the ``name`` option to rename the uploaded file to a custom value: .. code-block:: php-attributes #[MapUploadedFile(name: 'something-else')] UploadedFile $document -Changing the ``HTTP Status`` thrown when constraint violations are detected. +In addition, you can change the status code of the HTTP exception thrown when +there are constraint violations: .. code-block:: php-attributes From e0a49ba49a8c6b1ca770cc8cfc659975212f2b7f Mon Sep 17 00:00:00 2001 From: Antoine Lamirault Date: Tue, 7 May 2024 16:13:00 +0200 Subject: [PATCH 249/477] [Security] Add support for dynamic CSRF id with Expression in `#[IsCsrfTokenValid]` --- security/csrf.rst | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/security/csrf.rst b/security/csrf.rst index 76aaf9ea4bf..715ed8a5283 100644 --- a/security/csrf.rst +++ b/security/csrf.rst @@ -181,6 +181,32 @@ attribute on the controller action:: // ... do something, like deleting an object } +Suppose you want a CSRF token per item, so in the template you have something like the following: + +.. code-block:: html+twig + +
+ {# the argument of csrf_token() is a dynamic id string used to generate the token #} + + + +
+ +The :class:`Symfony\\Component\\Security\\Http\\Attribute\\IsCsrfTokenValid` +attribute also accepts an :class:`Symfony\\Component\\ExpressionLanguage\\Expression` +object evaluated to the id:: + + use Symfony\Component\HttpFoundation\Request; + use Symfony\Component\HttpFoundation\Response; + use Symfony\Component\Security\Http\Attribute\IsCsrfTokenValid; + // ... + + #[IsCsrfTokenValid(new Expression('"delete-item-" ~ args["post"].id'), tokenKey: 'token')] + public function delete(Post $post): Response + { + // ... do something, like deleting an object + } + .. versionadded:: 7.1 The :class:`Symfony\\Component\\Security\\Http\\Attribute\\IsCsrfTokenValid` From a40bf7c2d12b049a1190e0727c1096b95fe2908a Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Thu, 16 May 2024 13:20:12 +0200 Subject: [PATCH 250/477] - --- components/serializer.rst | 4 ---- 1 file changed, 4 deletions(-) diff --git a/components/serializer.rst b/components/serializer.rst index 03583918304..9fc4c8d5417 100644 --- a/components/serializer.rst +++ b/components/serializer.rst @@ -1166,10 +1166,6 @@ Option Description following: ```` ============================== ================================================= ========================== -.. versionadded:: 6.4 - - The `cdata_wrapping` option was introduced in Symfony 6.4. - Example with custom ``context``:: use Symfony\Component\Serializer\Encoder\XmlEncoder; From c6d35123b955de9a0a7080f4b78fee3ec7b32ef1 Mon Sep 17 00:00:00 2001 From: alexpozzi Date: Mon, 13 May 2024 17:49:41 +0200 Subject: [PATCH 251/477] Add missing XML serializer's CDATA options --- components/serializer.rst | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/components/serializer.rst b/components/serializer.rst index 2d1ea2c7637..1c86a111084 100644 --- a/components/serializer.rst +++ b/components/serializer.rst @@ -1200,11 +1200,17 @@ Option Description ``remove_empty_tags`` If set to true, removes all empty tags in the ``false`` generated XML ``cdata_wrapping`` If set to false, will not wrap any value ``true`` - containing one of the following characters ( - ``<``, ``>``, ``&``) in `a CDATA section`_ like - following: ```` + matching the ``cdata_wrapping_pattern`` regex in + `a CDATA section`_ like following: + ```` +``cdata_wrapping_pattern`` A regular expression pattern to determine if a ``/[<>&]/`` + value should be wrapped in a CDATA section ============================== ================================================= ========================== +.. versionadded:: 7.1 + + The `cdata_wrapping_pattern` option was introduced in Symfony 7.1. + Example with custom ``context``:: use Symfony\Component\Serializer\Encoder\XmlEncoder; From 18f36ef332bae77634877b1bea756ae3230d82b6 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 22 May 2024 15:46:43 +0200 Subject: [PATCH 252/477] Fix some merging issues --- notifier.rst | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/notifier.rst b/notifier.rst index 3e2c3eca6d9..b34757f22bf 100644 --- a/notifier.rst +++ b/notifier.rst @@ -165,6 +165,9 @@ Service `Smsapi`_ **Install**: ``composer require symfony/smsapi-notifier`` \ **DSN**: ``smsapi://TOKEN@default?from=FROM`` \ **Webhook support**: No +`Smsbox`_ **Install**: ``composer require symfony/smsbox-notifier`` \ + **DSN**: ``smsbox://APIKEY@default?mode=MODE&strategy=STRATEGY&sender=SENDER`` \ + **Webhook support**: No `SmsBiuras`_ **Install**: ``composer require symfony/sms-biuras-notifier`` \ **DSN**: ``smsbiuras://UID:API_KEY@default?from=FROM&test_mode=0`` \ **Webhook support**: No @@ -189,6 +192,9 @@ Service `Twilio`_ **Install**: ``composer require symfony/twilio-notifier`` \ **DSN**: ``twilio://SID:TOKEN@default?from=FROM`` \ **Webhook support**: Yes +`Unifonic`_ **Install**: ``composer require symfony/unifonic-notifier`` \ + **DSN**: ``unifonic://APP_SID@default?from=FROM`` \ + **Webhook support**: No `Vonage`_ **Install**: ``composer require symfony/vonage-notifier`` \ **DSN**: ``vonage://KEY:SECRET@default?from=FROM`` \ **Webhook support**: Yes @@ -205,7 +211,8 @@ Service .. versionadded:: 7.1 - The `SmsSluzba`_, `SMSense`_ and `LOX24`_ integrations were introduced in Symfony 7.1. + The ``Smsbox``, ``SmsSluzba``, ``SMSense``, ``LOX24`` and ``Unifonic`` + integrations were introduced in Symfony 7.1. .. deprecated:: 7.1 @@ -348,8 +355,7 @@ Service Package D .. versionadded:: 7.1 - The ``Bluesky``, ``Unifonic`` and ``Smsbox`` integrations - were introduced in Symfony 7.1. + The ``Bluesky`` integration was introduced in Symfony 7.1. .. caution:: From 01ca38dac8964f2e06eb18428854e9f3561a5a17 Mon Sep 17 00:00:00 2001 From: Antoine Lamirault Date: Wed, 22 May 2024 21:44:11 +0200 Subject: [PATCH 253/477] [Stopwatch] Add ROOT constant to make it easier to reference --- performance.rst | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/performance.rst b/performance.rst index ca34e95ee37..ffeff6608c1 100644 --- a/performance.rst +++ b/performance.rst @@ -382,10 +382,16 @@ All events that don't belong to any named section are added to the special secti called ``__root__``. This way you can get all stopwatch events, even if you don't know their names, as follows:: - foreach($this->stopwatch->getSectionEvents('__root__') as $event) { + use Symfony\Component\Stopwatch\Stopwatch; + + foreach($this->stopwatch->getSectionEvents(Stopwatch::ROOT) as $event) { echo (string) $event; } +.. versionadded:: 7.2 + + The ``Stopwatch::ROOT`` constant as a shortcut for ``__root__`` was introduced in Symfony 7.2. + Learn more ---------- From 6331dc5d6b6b52425220e5dec44f75be657ea2d7 Mon Sep 17 00:00:00 2001 From: Antoine Lamirault Date: Wed, 22 May 2024 21:49:28 +0200 Subject: [PATCH 254/477] [Stopwatch] Add getLastPeriod method to StopwatchEvent --- performance.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/performance.rst b/performance.rst index ca34e95ee37..634ad8572ea 100644 --- a/performance.rst +++ b/performance.rst @@ -362,6 +362,13 @@ method does, which stops an event and then restarts it immediately:: // Lap information is stored as "periods" within the event: // $event->getPeriods(); + // Gets the last event period: + // $event->getLastPeriod(); + +.. versionadded:: 7.2 + + The ``getLastPeriod`` method was introduced in Symfony 7.2. + Profiling Sections .................. From 5bcaf58a7608ad467dffc3be35721d9e3286b4c1 Mon Sep 17 00:00:00 2001 From: Tim <5579551+Timherlaud@users.noreply.github.com> Date: Wed, 22 May 2024 16:31:48 +0200 Subject: [PATCH 255/477] 19909 [FrameworkBundle] Add support for setting headers --- templates.rst | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/templates.rst b/templates.rst index b6ae333cee1..d1c714d4225 100644 --- a/templates.rst +++ b/templates.rst @@ -705,6 +705,11 @@ provided by Symfony: site_name: 'ACME' theme: 'dark' + # optionally you can define HTTP headers to add to the response + headers: + Content-Type: 'text/html' + foo: 'bar' + .. code-block:: xml @@ -734,6 +739,11 @@ provided by Symfony: ACME dark + + + + text/html + @@ -764,11 +774,20 @@ provided by Symfony: 'context' => [ 'site_name' => 'ACME', 'theme' => 'dark', + ], + + // optionally you can define HTTP headers to add to the response + 'headers' => [ + 'Content-Type' => 'text/html', ] ]) ; }; +.. versionadded:: 7.2 + + The ``headers`` option was introduced in Symfony 7.2. + Checking if a Template Exists ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ From a9a6f77c095d34d3bb2c6b7e65fd26fb7f2e371d Mon Sep 17 00:00:00 2001 From: Antoine Lamirault Date: Fri, 24 May 2024 15:50:07 +0200 Subject: [PATCH 256/477] Update examples to symfony 7.2 --- contributing/code/pull_requests.rst | 2 +- contributing/code/tests.rst | 2 +- setup.rst | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/contributing/code/pull_requests.rst b/contributing/code/pull_requests.rst index 7c9ab2579a5..28a6dbc8169 100644 --- a/contributing/code/pull_requests.rst +++ b/contributing/code/pull_requests.rst @@ -132,7 +132,7 @@ work: branch (you can find them on the `Symfony releases page`_). E.g. if you found a bug introduced in ``v5.1.10``, you need to work on ``5.4``. -* ``7.1``, if you are adding a new feature. +* ``7.2``, if you are adding a new feature. The only exception is when a new :doc:`major Symfony version ` (5.0, 6.0, etc.) comes out every two years. Because of the diff --git a/contributing/code/tests.rst b/contributing/code/tests.rst index 08f6bc5df12..060e3eda02b 100644 --- a/contributing/code/tests.rst +++ b/contributing/code/tests.rst @@ -32,7 +32,7 @@ tests, such as Doctrine, Twig and Monolog. To do so, .. code-block:: terminal - $ COMPOSER_ROOT_VERSION=7.1.x-dev composer update + $ COMPOSER_ROOT_VERSION=7.2.x-dev composer update .. _running: diff --git a/setup.rst b/setup.rst index 90a89e78e8a..5cf3d2f90ab 100644 --- a/setup.rst +++ b/setup.rst @@ -48,10 +48,10 @@ application: .. code-block:: terminal # run this if you are building a traditional web application - $ symfony new my_project_directory --version="7.1.*" --webapp + $ symfony new my_project_directory --version="7.2.*" --webapp # run this if you are building a microservice, console application or API - $ symfony new my_project_directory --version="7.1.*" + $ symfony new my_project_directory --version="7.2.*" The only difference between these two commands is the number of packages installed by default. The ``--webapp`` option installs extra packages to give @@ -63,12 +63,12 @@ Symfony application using Composer: .. code-block:: terminal # run this if you are building a traditional web application - $ composer create-project symfony/skeleton:"7.1.*" my_project_directory + $ composer create-project symfony/skeleton:"7.2.*" my_project_directory $ cd my_project_directory $ composer require webapp # run this if you are building a microservice, console application or API - $ composer create-project symfony/skeleton:"7.1.*" my_project_directory + $ composer create-project symfony/skeleton:"7.2.*" my_project_directory No matter which command you run to create the Symfony application. All of them will create a new ``my_project_directory/`` directory, download some dependencies From 92d1b5a8728b7c83930e497a7c86e1f0b6abcb1f Mon Sep 17 00:00:00 2001 From: Yannick Date: Tue, 21 May 2024 23:52:53 +0200 Subject: [PATCH 257/477] [Validator] feat : add password strength estimator related documentation --- reference/constraints/PasswordStrength.rst | 9 ++++ .../get_or_override_estimate_strength.rst | 48 +++++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 validation/passwordStrength/get_or_override_estimate_strength.rst diff --git a/reference/constraints/PasswordStrength.rst b/reference/constraints/PasswordStrength.rst index 989ffddd100..a44fd70fd4e 100644 --- a/reference/constraints/PasswordStrength.rst +++ b/reference/constraints/PasswordStrength.rst @@ -128,3 +128,12 @@ The default message supplied when the password does not reach the minimum requir ])] protected $rawPassword; } + +Learn more +---------- + +.. toctree:: + :maxdepth: 1 + :glob: + + /validation/passwordStrength/* diff --git a/validation/passwordStrength/get_or_override_estimate_strength.rst b/validation/passwordStrength/get_or_override_estimate_strength.rst new file mode 100644 index 00000000000..9cd24c1b818 --- /dev/null +++ b/validation/passwordStrength/get_or_override_estimate_strength.rst @@ -0,0 +1,48 @@ +How to Get or Override the Default Password Strength Estimation Algorithm +========================================================================= + +Within the :class:`Symfony\\Component\\Validator\\Constraints\\PasswordStrengthValidator` a `dedicated function`_ is used to estimate the strength of the given password. This function can be retrieved directly from the :class:`Symfony\\Component\\Validator\\Constraints\\PasswordStrengthValidator` class and can also be overridden. + +Get the default Password strength +--------------------------------- + +In case of need to retrieve the actual strength of a password (e.g. compute the score and display it when the user has defined a password), the ``estimateStrength`` `dedicated function`_ of the :class:`Symfony\\Component\\Validator\\Constraints\\PasswordStrengthValidator` is a public static function, therefore this function can be retrieved directly from the `PasswordStrengthValidator` class.:: + + use Symfony\Component\Validator\Constraints\PasswordStrengthValidator; + + $passwordEstimatedStrength = PasswordStrengthValidator::estimateStrength($password); + + +Override the default Password strength estimation algorithm +----------------------------------------------------------- + +If you need to override the default password strength estimation algorithm, you can pass a ``Closure`` to the :class:`Symfony\\Component\\Validator\\Constraints\\PasswordStrengthValidator` constructor. This can be done using the :doc:`/service_container/service_closures`. + +First, create a custom password strength estimation algorithm within a dedicated callable class.:: + + namespace App\Validator; + + class CustomPasswordStrengthEstimator + { + /** + * @param string $password + * + * @return PasswordStrength::STRENGTH_* + */ + public function __invoke(string $password): int + { + // Your custom password strength estimation algorithm + } + } + +Then, configure the :class:`Symfony\\Component\\Validator\\Constraints\\PasswordStrengthValidator` service to use the custom password strength estimation algorithm.:: + + # config/services.yaml + services: + custom_password_strength_estimator: + class: App\Validator\CustomPasswordStrengthEstimator + + Symfony\Component\Validator\Constraints\PasswordStrengthValidator: + arguments: [!service_closure '@custom_password_strength_estimator'] + +.. _`dedicated function`: https://github.com/symfony/symfony/blob/85db734e06e8cb32365810958326d48084bf48ba/src/Symfony/Component/Validator/Constraints/PasswordStrengthValidator.php#L53-L90 From f6b69918adf973068635a9f39e1e4be5c1f4dc40 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Tue, 28 May 2024 10:43:26 +0200 Subject: [PATCH 258/477] Move the docs to the constraint doc --- reference/constraints/PasswordStrength.rst | 87 +++++++++++++++++-- .../get_or_override_estimate_strength.rst | 48 ---------- 2 files changed, 81 insertions(+), 54 deletions(-) delete mode 100644 validation/passwordStrength/get_or_override_estimate_strength.rst diff --git a/reference/constraints/PasswordStrength.rst b/reference/constraints/PasswordStrength.rst index a44fd70fd4e..671b5f495ef 100644 --- a/reference/constraints/PasswordStrength.rst +++ b/reference/constraints/PasswordStrength.rst @@ -129,11 +129,86 @@ The default message supplied when the password does not reach the minimum requir protected $rawPassword; } -Learn more ----------- +Customizing the Password Strength Estimation +-------------------------------------------- -.. toctree:: - :maxdepth: 1 - :glob: +.. versionadded:: 7.2 - /validation/passwordStrength/* + The feature to customize the password strength estimation was introduced in Symfony 7.2. + +By default, this constraint calculates the strength of a password based on its +length and the number of unique characters used. You can get the calculated +password strength (e.g. to display it in the user interface) using the following +static function:: + + use Symfony\Component\Validator\Constraints\PasswordStrengthValidator; + + $passwordEstimatedStrength = PasswordStrengthValidator::estimateStrength($password); + +If you need to override the default password strength estimation algorithm, you +can pass a ``Closure`` to the :class:`Symfony\\Component\\Validator\\Constraints\\PasswordStrengthValidator` +constructor (e.g. using the :doc:`service closures `). + +First, create a custom password strength estimation algorithm within a dedicated +callable class:: + + namespace App\Validator; + + class CustomPasswordStrengthEstimator + { + /** + * @return PasswordStrength::STRENGTH_* + */ + public function __invoke(string $password): int + { + // Your custom password strength estimation algorithm + } + } + +Then, configure the :class:`Symfony\\Component\\Validator\\Constraints\\PasswordStrengthValidator` +service to use your own estimator: + +.. configuration-block:: + + .. code-block:: yaml + + # config/services.yaml + services: + custom_password_strength_estimator: + class: App\Validator\CustomPasswordStrengthEstimator + + Symfony\Component\Validator\Constraints\PasswordStrengthValidator: + arguments: [!service_closure '@custom_password_strength_estimator'] + + .. code-block:: xml + + + + + + + + + + + + + + + .. code-block:: php + + // config/services.php + namespace Symfony\Component\DependencyInjection\Loader\Configurator; + + use Symfony\Component\Validator\Constraints\PasswordStrengthValidator; + + return function (ContainerConfigurator $container): void { + $services = $container->services(); + + $services->set('custom_password_strength_estimator', CustomPasswordStrengthEstimator::class); + + $services->set(PasswordStrengthValidator::class) + ->args([service_closure('custom_password_strength_estimator')]); + }; diff --git a/validation/passwordStrength/get_or_override_estimate_strength.rst b/validation/passwordStrength/get_or_override_estimate_strength.rst deleted file mode 100644 index 9cd24c1b818..00000000000 --- a/validation/passwordStrength/get_or_override_estimate_strength.rst +++ /dev/null @@ -1,48 +0,0 @@ -How to Get or Override the Default Password Strength Estimation Algorithm -========================================================================= - -Within the :class:`Symfony\\Component\\Validator\\Constraints\\PasswordStrengthValidator` a `dedicated function`_ is used to estimate the strength of the given password. This function can be retrieved directly from the :class:`Symfony\\Component\\Validator\\Constraints\\PasswordStrengthValidator` class and can also be overridden. - -Get the default Password strength ---------------------------------- - -In case of need to retrieve the actual strength of a password (e.g. compute the score and display it when the user has defined a password), the ``estimateStrength`` `dedicated function`_ of the :class:`Symfony\\Component\\Validator\\Constraints\\PasswordStrengthValidator` is a public static function, therefore this function can be retrieved directly from the `PasswordStrengthValidator` class.:: - - use Symfony\Component\Validator\Constraints\PasswordStrengthValidator; - - $passwordEstimatedStrength = PasswordStrengthValidator::estimateStrength($password); - - -Override the default Password strength estimation algorithm ------------------------------------------------------------ - -If you need to override the default password strength estimation algorithm, you can pass a ``Closure`` to the :class:`Symfony\\Component\\Validator\\Constraints\\PasswordStrengthValidator` constructor. This can be done using the :doc:`/service_container/service_closures`. - -First, create a custom password strength estimation algorithm within a dedicated callable class.:: - - namespace App\Validator; - - class CustomPasswordStrengthEstimator - { - /** - * @param string $password - * - * @return PasswordStrength::STRENGTH_* - */ - public function __invoke(string $password): int - { - // Your custom password strength estimation algorithm - } - } - -Then, configure the :class:`Symfony\\Component\\Validator\\Constraints\\PasswordStrengthValidator` service to use the custom password strength estimation algorithm.:: - - # config/services.yaml - services: - custom_password_strength_estimator: - class: App\Validator\CustomPasswordStrengthEstimator - - Symfony\Component\Validator\Constraints\PasswordStrengthValidator: - arguments: [!service_closure '@custom_password_strength_estimator'] - -.. _`dedicated function`: https://github.com/symfony/symfony/blob/85db734e06e8cb32365810958326d48084bf48ba/src/Symfony/Component/Validator/Constraints/PasswordStrengthValidator.php#L53-L90 From 710d306fba10953ab91b9b1994295564b8afebb2 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 29 May 2024 12:16:03 +0200 Subject: [PATCH 259/477] [Notifier] Add a missing reference link --- notifier.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/notifier.rst b/notifier.rst index 202689005a3..5346fbf7719 100644 --- a/notifier.rst +++ b/notifier.rst @@ -1089,6 +1089,7 @@ is dispatched. Listeners receive a .. _`RocketChat`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/RocketChat/README.md .. _`SMSFactor`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/SmsFactor/README.md .. _`Sendberry`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Sendberry/README.md +.. _`Sendinblue`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Sendinblue/README.md .. _`SimpleTextin`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/SimpleTextin/README.md .. _`Sinch`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Sinch/README.md .. _`Slack`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Slack/README.md From f6a398b498d77c19627f93c3328a75017b78d16c Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 29 May 2024 12:04:38 +0200 Subject: [PATCH 260/477] Move some docs from the Choice constraint to the ChoiceType --- reference/constraints/Choice.rst | 26 -------------------------- reference/forms/types/choice.rst | 26 ++++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/reference/constraints/Choice.rst b/reference/constraints/Choice.rst index 8bafaaede7b..5a9c365be37 100644 --- a/reference/constraints/Choice.rst +++ b/reference/constraints/Choice.rst @@ -389,29 +389,3 @@ Parameter Description =============== ============================================================== .. include:: /reference/constraints/_payload-option.rst.inc - -``separator`` -~~~~~~~~~~~~~ - -**type**: ``string`` **default**: ``-------------------`` - -This option allows you to customize the visual separator shown after the preferred -choices. You can use HTML elements like ``
`` to display a more modern separator, -but you'll also need to set the `separator_html`_ option to ``true``. - -.. versionadded:: 7.1 - - The ``separator`` option was introduced in Symfony 7.1. - -``separator_html`` -~~~~~~~~~~~~~~~~~~ - -**type**: ``boolean`` **default**: ``false`` - -If this option is true, the `separator`_ option will be displayed as HTML instead -of text. This is useful when using HTML elements (e.g. ``
``) as a more modern -visual separator. - -.. versionadded:: 7.1 - - The ``separator_html`` option was introduced in Symfony 7.1. diff --git a/reference/forms/types/choice.rst b/reference/forms/types/choice.rst index 3637da8bdca..0b250b799da 100644 --- a/reference/forms/types/choice.rst +++ b/reference/forms/types/choice.rst @@ -202,6 +202,32 @@ correct types will be assigned to the model. .. include:: /reference/forms/types/options/preferred_choices.rst.inc +``separator`` +~~~~~~~~~~~~~ + +**type**: ``string`` **default**: ``-------------------`` + +This option allows you to customize the visual separator shown after the preferred +choices. You can use HTML elements like ``
`` to display a more modern separator, +but you'll also need to set the `separator_html`_ option to ``true``. + +.. versionadded:: 7.1 + + The ``separator`` option was introduced in Symfony 7.1. + +``separator_html`` +~~~~~~~~~~~~~~~~~~ + +**type**: ``boolean`` **default**: ``false`` + +If this option is true, the `separator`_ option will be displayed as HTML instead +of text. This is useful when using HTML elements (e.g. ``
``) as a more modern +visual separator. + +.. versionadded:: 7.1 + + The ``separator_html`` option was introduced in Symfony 7.1. + Overridden Options ------------------ From 41c4ce5f15986ad8dfb95d3267f875cff63e9377 Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Thu, 30 May 2024 11:41:26 +0200 Subject: [PATCH 261/477] [Dotenv] Fix `SYMFONY_DOTENV_PATH` purpose --- configuration.rst | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/configuration.rst b/configuration.rst index 728f0e4e8b5..36dceae1b71 100644 --- a/configuration.rst +++ b/configuration.rst @@ -954,15 +954,7 @@ path is part of the options you can set in your ``composer.json`` file: } } -You can also set the ``SYMFONY_DOTENV_PATH`` environment variable at system -level (e.g. in your web server configuration or in your Dockerfile): - -.. code-block:: bash - - # .env (or .env.local) - SYMFONY_DOTENV_PATH=my/custom/path/to/.env - -Finally, you can directly invoke the ``Dotenv`` class in your +As an alternate option, you can directly invoke the ``Dotenv`` class in your ``bootstrap.php`` file or any other file of your application:: use Symfony\Component\Dotenv\Dotenv; @@ -975,9 +967,13 @@ the local and environment-specific files (e.g. ``.*.local`` and :ref:`how to override environment variables ` to learn more about this. +If you need to know the path to the ``.env`` file that Symfony is using, you can +read the ``SYMFONY_DOTENV_PATH`` environment variable in your application. + .. versionadded:: 7.1 - The ``SYMFONY_DOTENV_PATH`` environment variable was introduced in Symfony 7.1. + The ``SYMFONY_DOTENV_PATH`` environment variable was introduced in Symfony + 7.1. .. _configuration-secrets: From 0074962a87b9598d337469566266f9d78a8f742a Mon Sep 17 00:00:00 2001 From: Antoine Lamirault Date: Mon, 27 May 2024 16:19:49 +0200 Subject: [PATCH 262/477] [Emoji] Add the text locale --- string.rst | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/string.rst b/string.rst index c58a736da89..9253b89478e 100644 --- a/string.rst +++ b/string.rst @@ -561,6 +561,7 @@ textual representation in all languages based on the `Unicode CLDR dataset`_:: The ``EmojiTransliterator`` also provides special locales that convert emojis to short codes and vice versa in specific platforms, such as GitHub, Gitlab and Slack. +All theses platform are also combined in special locale ``text``. GitHub Emoji Transliteration ............................ @@ -607,6 +608,27 @@ Convert Slack short codes to emojis with the ``slack-emoji`` locale:: $transliterator->transliterate('Menus with :green_salad: or :falafel:'); // => 'Menus with 🥗 or 🧆' +Text Emoji Transliteration +.......................... + +If you don't know where short codes come from, you can use the ``text-emoji`` locale. +This locale will convert Github, Gitlab and Slack short codes to emojis:: + + $transliterator = EmojiTransliterator::create('text-emoji'); + // Github short codes + $transliterator->transliterate('Breakfast with :kiwi-fruit: or :milk-glass:'); + // Gitlab short codes + $transliterator->transliterate('Breakfast with :kiwi: or :milk:'); + // Slack short codes + $transliterator->transliterate('Breakfast with :kiwifruit: or :glass-of-milk:'); + // => 'Breakfast with 🥝 or 🥛' + +You can convert emojis to short codes with the ``emoji-text`` locale:: + + $transliterator = EmojiTransliterator::create('emoji-text'); + $transliterator->transliterate('Breakfast with 🥝 or 🥛'); + // => 'Breakfast with :kiwifruit: or :milk-glass: + Removing Emojis ~~~~~~~~~~~~~~~ From cd3690d3738ff210cd2144f97186c2acce20e38f Mon Sep 17 00:00:00 2001 From: A goazil Date: Tue, 30 Apr 2024 09:52:48 +0200 Subject: [PATCH 263/477] [Notifier] add Primotexto bridge chore: add versionadded directive --- notifier.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/notifier.rst b/notifier.rst index 04ca5a2d4a4..01dfaf17cc6 100644 --- a/notifier.rst +++ b/notifier.rst @@ -138,6 +138,9 @@ Service `Plivo`_ **Install**: ``composer require symfony/plivo-notifier`` \ **DSN**: ``plivo://AUTH_ID:AUTH_TOKEN@default?from=FROM`` \ **Webhook support**: No +`Primotexto`_ **Install**: ``composer require symfony/primotexto-notifier`` \ + **DSN**: ``primotexto://API_KEY@default?from=FROM`` \ + **Webhook support**: No `Redlink`_ **Install**: ``composer require symfony/redlink-notifier`` \ **DSN**: ``redlink://API_KEY:APP_KEY@default?from=SENDER_NAME&version=API_VERSION`` \ **Webhook support**: No @@ -203,6 +206,10 @@ Service **Webhook support**: No ================== ==================================================================================================================================== +.. versionadded:: 7.2 + + The ``Primotexto`` integration was introduced in Symfony 7.2. + .. tip:: Some third party transports, when using the API, support status callbacks @@ -1119,6 +1126,7 @@ is dispatched. Listeners receive a .. _`OvhCloud`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/OvhCloud/README.md .. _`PagerDuty`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/PagerDuty/README.md .. _`Plivo`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Plivo/README.md +.. _`Primotexto`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Primotexto/README.md .. _`Pushover`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Pushover/README.md .. _`Pushy`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Pushy/README.md .. _`Redlink`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Redlink/README.md From 69c39f5f7e54a7ba2b9d7b449ef4269baed4b761 Mon Sep 17 00:00:00 2001 From: Jean-David Daviet Date: Fri, 31 May 2024 15:00:17 +0200 Subject: [PATCH 264/477] Fix broken link for UriSigner::sign method --- routing.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routing.rst b/routing.rst index 790ae314516..153c3690824 100644 --- a/routing.rst +++ b/routing.rst @@ -2697,7 +2697,7 @@ service, which you can inject in your services or controllers:: For security reasons, it's common to make signed URIs expire after some time (e.g. when using them to reset user credentials). By default, signed URIs don't expire, but you can define an expiration date/time using the ``$expiration`` -argument of :phpmethod:`Symfony\\Component\\HttpFoundation\\UriSigner::sign`:: +argument of :method:`Symfony\\Component\\HttpFoundation\\UriSigner::sign`:: // src/Service/SomeService.php namespace App\Service; From dc23e2e0399768c26c495ed8e2cf481843801d57 Mon Sep 17 00:00:00 2001 From: Maximilian Beckers Date: Tue, 4 Jun 2024 12:01:10 +0200 Subject: [PATCH 265/477] [Validator] BicValidator add strict mode to validate bics in strict mode --- reference/constraints/Bic.rst | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/reference/constraints/Bic.rst b/reference/constraints/Bic.rst index 69ce35248f3..a6a745e3a76 100644 --- a/reference/constraints/Bic.rst +++ b/reference/constraints/Bic.rst @@ -121,4 +121,24 @@ Parameter Description .. include:: /reference/constraints/_payload-option.rst.inc +``mode`` +~~~~~~~~ + +**type**: ``string`` **default**: ``strict`` + +The mode in which the BIC is validated can be defined with this option. Valid values are: + +* ``strict`` uses the input BIC and validates it without modification. +* ``case-insensitive`` converts the input value to uppercase before validating the BIC. + +.. tip:: + + The possible values of this option are also defined as PHP constants of + :class:`Symfony\\Component\\Validator\\Constraints\\BIC` + (e.g. ``BIC::VALIDATION_MODE_CASE_INSENSITIVE``). + +.. versionadded:: 7.2 + + The ``mode`` option was introduced in Symfony 7.2. + .. _`Business Identifier Code (BIC)`: https://en.wikipedia.org/wiki/Business_Identifier_Code From 8be7bb3f34064492907af7d1de2eb5b3f27d75de Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Thu, 30 May 2024 15:29:28 +0200 Subject: [PATCH 266/477] [String] Update the emoji transliteration docs --- string.rst | 40 ++++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/string.rst b/string.rst index 9253b89478e..01752fff9c9 100644 --- a/string.rst +++ b/string.rst @@ -558,15 +558,20 @@ textual representation in all languages based on the `Unicode CLDR dataset`_:: $transliterator->transliterate('Menus with 🍕 or 🍝'); // => 'Menus with піца or спагеті' +Transliterating Emoji Text Short Codes +...................................... -The ``EmojiTransliterator`` also provides special locales that convert emojis to -short codes and vice versa in specific platforms, such as GitHub, Gitlab and Slack. -All theses platform are also combined in special locale ``text``. +Services like GitHub and Slack allows to include emojis in your messages using +text short codes (e.g. you can add the ``:+1:`` code to render the 👍 emoji). -GitHub Emoji Transliteration -............................ +Symfony also provides a feature to transliterate emojis into short codes and vice +versa. The short codes are slightly different on each service, so you must pass +the name of the service as an argument when creating the transliterator: -Convert GitHub emojis to short codes with the ``emoji-github`` locale:: +GitHub Emoji Short Codes Transliteration +######################################## + +Convert emojis to GitHub short codes with the ``emoji-github`` locale:: $transliterator = EmojiTransliterator::create('emoji-github'); $transliterator->transliterate('Teenage 🐢 really love 🍕'); @@ -578,10 +583,10 @@ Convert GitHub short codes to emojis with the ``github-emoji`` locale:: $transliterator->transliterate('Teenage :turtle: really love :pizza:'); // => 'Teenage 🐢 really love 🍕' -Gitlab Emoji Transliteration -............................ +Gitlab Emoji Short Codes Transliteration +######################################## -Convert Gitlab emojis to short codes with the ``emoji-gitlab`` locale:: +Convert emojis to Gitlab short codes with the ``emoji-gitlab`` locale:: $transliterator = EmojiTransliterator::create('emoji-gitlab'); $transliterator->transliterate('Breakfast with 🥝 or 🥛'); @@ -593,10 +598,10 @@ Convert Gitlab short codes to emojis with the ``gitlab-emoji`` locale:: $transliterator->transliterate('Breakfast with :kiwi: or :milk:'); // => 'Breakfast with 🥝 or 🥛' -Slack Emoji Transliteration -........................... +Slack Emoji Short Codes Transliteration +####################################### -Convert Slack emojis to short codes with the ``emoji-slack`` locale:: +Convert emojis to Slack short codes with the ``emoji-slack`` locale:: $transliterator = EmojiTransliterator::create('emoji-slack'); $transliterator->transliterate('Menus with 🥗 or 🧆'); @@ -608,19 +613,22 @@ Convert Slack short codes to emojis with the ``slack-emoji`` locale:: $transliterator->transliterate('Menus with :green_salad: or :falafel:'); // => 'Menus with 🥗 or 🧆' -Text Emoji Transliteration -.......................... +Universal Emoji Short Codes Transliteration +########################################### -If you don't know where short codes come from, you can use the ``text-emoji`` locale. -This locale will convert Github, Gitlab and Slack short codes to emojis:: +If you don't know which service was used to generate the short codes, you can use +the ``text-emoji`` locale, which combines all codes from all services:: $transliterator = EmojiTransliterator::create('text-emoji'); + // Github short codes $transliterator->transliterate('Breakfast with :kiwi-fruit: or :milk-glass:'); // Gitlab short codes $transliterator->transliterate('Breakfast with :kiwi: or :milk:'); // Slack short codes $transliterator->transliterate('Breakfast with :kiwifruit: or :glass-of-milk:'); + + // all the above examples produce the same result: // => 'Breakfast with 🥝 or 🥛' You can convert emojis to short codes with the ``emoji-text`` locale:: From 1484f9dc53b784ac79b1b5cb3f7fd000f07ac92c Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 5 Jun 2024 11:40:33 +0200 Subject: [PATCH 267/477] Minor tweaks --- reference/constraints/Bic.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/reference/constraints/Bic.rst b/reference/constraints/Bic.rst index a6a745e3a76..3f05e5eac25 100644 --- a/reference/constraints/Bic.rst +++ b/reference/constraints/Bic.rst @@ -126,10 +126,10 @@ Parameter Description **type**: ``string`` **default**: ``strict`` -The mode in which the BIC is validated can be defined with this option. Valid values are: +This option defines how the BIC is validated: -* ``strict`` uses the input BIC and validates it without modification. -* ``case-insensitive`` converts the input value to uppercase before validating the BIC. +* ``strict`` validates the given value without any modification; +* ``case-insensitive`` converts the given value to uppercase before validating it. .. tip:: From fd6262225b0e14b3b35690e24b94f14f56a47e83 Mon Sep 17 00:00:00 2001 From: seb-jean Date: Thu, 6 Jun 2024 16:36:12 +0200 Subject: [PATCH 268/477] Update csrf.rst --- security/csrf.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security/csrf.rst b/security/csrf.rst index 77aad6bf090..11c7b2fc267 100644 --- a/security/csrf.rst +++ b/security/csrf.rst @@ -233,7 +233,7 @@ object evaluated to the id:: use Symfony\Component\Security\Http\Attribute\IsCsrfTokenValid; // ... - #[IsCsrfTokenValid(new Expression('"delete-item-" ~ args["post"].id'), tokenKey: 'token')] + #[IsCsrfTokenValid(new Expression('"delete-item-" ~ args["post"].getId()'), tokenKey: 'token')] public function delete(Post $post): Response { // ... do something, like deleting an object From 1f4115ea993cf1e31f11dc96de64b0ec3da85c47 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Fri, 7 Jun 2024 08:53:11 +0200 Subject: [PATCH 269/477] fix markup --- components/serializer.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/serializer.rst b/components/serializer.rst index 1c86a111084..6a5790fd48f 100644 --- a/components/serializer.rst +++ b/components/serializer.rst @@ -1209,7 +1209,7 @@ Option Description .. versionadded:: 7.1 - The `cdata_wrapping_pattern` option was introduced in Symfony 7.1. + The ``cdata_wrapping_pattern`` option was introduced in Symfony 7.1. Example with custom ``context``:: From 0624d24867ba378c160c0c56fa3127490ca2b065 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Thu, 13 Jun 2024 16:48:16 +0200 Subject: [PATCH 270/477] [ExpressionLanguage] Document the null-coalesce operator changes --- reference/formats/expression_language.rst | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/reference/formats/expression_language.rst b/reference/formats/expression_language.rst index c7ce82fb751..818870452a5 100644 --- a/reference/formats/expression_language.rst +++ b/reference/formats/expression_language.rst @@ -124,11 +124,10 @@ returns the right-hand side. Expressions can chain multiple coalescing operators * ``foo[3] ?? 'no'`` * ``foo.baz ?? foo['baz'] ?? 'no'`` -.. note:: +.. versionadded:: 7.2 - The main difference with the `null-coalescing operator in PHP`_ is that - ExpressionLanguage will throw an exception when trying to access a - non-existent variable. + Starting from Symfony 7.2, no exception is thrown when trying to access a + non-existent variable. This is the same behavior as the `null-coalescing operator in PHP`_. .. _component-expression-functions: From 00854911226a5f2ec7299e0e0345fcaacba110ac Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Thu, 13 Jun 2024 17:34:08 +0200 Subject: [PATCH 271/477] [Translation] Document `lint:translations` command --- translation.rst | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/translation.rst b/translation.rst index 891f00845cb..0fbd155cfd7 100644 --- a/translation.rst +++ b/translation.rst @@ -1343,7 +1343,7 @@ Symfony processes all the application translation files as part of the process that compiles the application code before executing it. If there's an error in any translation file, you'll see an error message explaining the problem. -If you prefer, you can also validate the contents of any YAML and XLIFF +If you prefer, you can also validate the syntax of any YAML and XLIFF translation file using the ``lint:yaml`` and ``lint:xliff`` commands: .. code-block:: terminal @@ -1384,6 +1384,22 @@ adapted to the format required by GitHub, but you can force that format too: $ php vendor/bin/yaml-lint translations/ +The ``lint:yaml`` and ``lint:xliff`` commands validate the YAML and XML syntax +of the translation files, but not their contents. Use the following command +to check that the translation contents are also correct: + + .. code-block:: terminal + + # checks the contents of all the translation catalogues in all locales + $ php bin/console lint:translations + + # checks the contents of the translation catalogues for Italian (it) and Japanese (ja) locales + $ php bin/console lint:translations --locales=it --locales=ja + +.. versionadded:: 7.2 + + The ``lint:translations`` command was introduced in Symfony 7.2. + Pseudo-localization translator ------------------------------ From 29bdb1612d2a3d7387cad50228cbe226623ea4ec Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Mon, 17 Jun 2024 10:36:30 +0200 Subject: [PATCH 272/477] Update the version constraints --- setup.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/setup.rst b/setup.rst index 5cf3d2f90ab..d8196e71b7b 100644 --- a/setup.rst +++ b/setup.rst @@ -48,10 +48,10 @@ application: .. code-block:: terminal # run this if you are building a traditional web application - $ symfony new my_project_directory --version="7.2.*" --webapp + $ symfony new my_project_directory --version="7.2.x-dev" --webapp # run this if you are building a microservice, console application or API - $ symfony new my_project_directory --version="7.2.*" + $ symfony new my_project_directory --version="7.2.x-dev" The only difference between these two commands is the number of packages installed by default. The ``--webapp`` option installs extra packages to give @@ -63,12 +63,12 @@ Symfony application using Composer: .. code-block:: terminal # run this if you are building a traditional web application - $ composer create-project symfony/skeleton:"7.2.*" my_project_directory + $ composer create-project symfony/skeleton:"7.2.x-dev" my_project_directory $ cd my_project_directory $ composer require webapp # run this if you are building a microservice, console application or API - $ composer create-project symfony/skeleton:"7.2.*" my_project_directory + $ composer create-project symfony/skeleton:"7.2.x-dev" my_project_directory No matter which command you run to create the Symfony application. All of them will create a new ``my_project_directory/`` directory, download some dependencies From fd7b8eac82104bb10eb8ecc8791d3d7dd75a2b34 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Mon, 17 Jun 2024 13:26:52 +0200 Subject: [PATCH 273/477] Add the versionadded directive --- security/access_token.rst | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/security/access_token.rst b/security/access_token.rst index d0ed785ad31..8661a226a73 100644 --- a/security/access_token.rst +++ b/security/access_token.rst @@ -709,6 +709,10 @@ create your own User from the claims, you must Using CAS 2.0 ------------- +.. versionadded:: 7.1 + + The support for CAS token handlers was introduced in Symfony 7.1. + `Central Authentication Service (CAS)`_ is an enterprise multilingual single sign-on solution and identity provider for the web and attempts to be a comprehensive platform for your authentication and authorization needs. @@ -724,7 +728,7 @@ haven't installed it yet, run this command: $ composer require symfony/http-client -You can configure a ``cas`` ``token_handler``: +You can configure a ``cas`` token handler as follows: .. configuration-block:: From 0050ebae4c477b9f1aa30e2c86526e6827820efe Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Tue, 18 Jun 2024 16:03:27 +0200 Subject: [PATCH 274/477] [FrameworkBundle] Remove some unneeded versionadded directives --- configuration/micro_kernel_trait.rst | 4 ---- reference/configuration/framework.rst | 4 ---- 2 files changed, 8 deletions(-) diff --git a/configuration/micro_kernel_trait.rst b/configuration/micro_kernel_trait.rst index 6b90a3d7ddb..b67335514a1 100644 --- a/configuration/micro_kernel_trait.rst +++ b/configuration/micro_kernel_trait.rst @@ -120,10 +120,6 @@ Next, create an ``index.php`` file that defines the kernel class and runs it: $response->send(); $kernel->terminate($request, $response); -.. versionadded:: 6.1 - - The PHP attributes notation has been introduced in Symfony 6.1. - .. note:: In addition to the ``index.php`` file, you'll need to create a directory called diff --git a/reference/configuration/framework.rst b/reference/configuration/framework.rst index 6e93c4568b9..fec52229973 100644 --- a/reference/configuration/framework.rst +++ b/reference/configuration/framework.rst @@ -972,10 +972,6 @@ crypto_method The minimum version of TLS to accept. The value must be one of the ``STREAM_CRYPTO_METHOD_TLSv*_CLIENT`` constants defined by PHP. -.. versionadded:: 6.3 - - The ``crypto_method`` option was introduced in Symfony 6.3. - .. _reference-http-client-retry-delay: delay From d25c009b180ca57b0449fad9c285ceae780110e7 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Thu, 11 Apr 2024 11:53:36 +0200 Subject: [PATCH 275/477] [Emoji][Twig] Add `emojify` filter --- reference/twig_reference.rst | 31 +++++++++++++++++++++++++++++++ string.rst | 29 +++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+) diff --git a/reference/twig_reference.rst b/reference/twig_reference.rst index fcd95ce9b6e..812b56f8637 100644 --- a/reference/twig_reference.rst +++ b/reference/twig_reference.rst @@ -645,6 +645,37 @@ serialize Accepts any data that can be serialized by the :doc:`Serializer component ` and returns a serialized string in the specified ``format``. +.. _reference-twig-filter-emojify: + +emojify +~~~~~~~ + +.. versionadded:: 7.1 + + The ``emojify`` filter was introduced in Symfony 7.1. + +.. code-block:: twig + + {{ text|emojify(catalog = null) }} + +``text`` + **type**: ``string`` + +``catalog`` *(optional)* + **type**: ``string`` | ``null`` + + The emoji set used to generate the textual representation (``slack``, + ``github``, ``gitlab``, etc.) + +It transforms the textual representation of an emoji (e.g. ``:wave:``) into the +actual emoji (👋): + +.. code-block:: twig + + {{ ':+1:'|emojify }} {# renders: 👍 #} + {{ ':+1:'|emojify('github') }} {# renders: 👍 #} + {{ ':thumbsup:'|emojify('gitlab') }} {# renders: 👍 #} + .. _reference-twig-tags: Tags diff --git a/string.rst b/string.rst index 01752fff9c9..5e18cfcaea3 100644 --- a/string.rst +++ b/string.rst @@ -613,6 +613,8 @@ Convert Slack short codes to emojis with the ``slack-emoji`` locale:: $transliterator->transliterate('Menus with :green_salad: or :falafel:'); // => 'Menus with 🥗 or 🧆' +.. _string-text-emoji: + Universal Emoji Short Codes Transliteration ########################################### @@ -637,6 +639,33 @@ You can convert emojis to short codes with the ``emoji-text`` locale:: $transliterator->transliterate('Breakfast with 🥝 or 🥛'); // => 'Breakfast with :kiwifruit: or :milk-glass: +Inverse Emoji Transliteration +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. versionadded:: 7.1 + + The inverse emoji transliteration was introduced in Symfony 7.1. + +Given the textual representation of an emoji, you can reverse it back to get the +actual emoji thanks to the :ref:`emojify filter `: + +.. code-block:: twig + + {{ 'I like :kiwi-fruit:'|emojify }} {# renders: I like 🥝 #} + {{ 'I like :kiwi:'|emojify }} {# renders: I like 🥝 #} + {{ 'I like :kiwifruit:'|emojify }} {# renders: I like 🥝 #} + +By default, ``emojify`` uses the :ref:`text catalog `, which +merges the emoji text codes of all services. If you prefer, you can select a +specific catalog to use: + +.. code-block:: twig + + {{ 'I :green-heart: this'|emojify }} {# renders: I 💚 this #} + {{ ':green_salad: is nice'|emojify('slack') }} {# renders: 🥗 is nice #} + {{ 'My :turtle: has no name yet'|emojify('github') }} {# renders: My 🐢 has no name yet #} + {{ ':kiwi: is a great fruit'|emojify('gitlab') }} {# renders: 🥝 is a great fruit #} + Removing Emojis ~~~~~~~~~~~~~~~ From 15dcd7e221ae7caca0cec61f56b2adab1cdd9b55 Mon Sep 17 00:00:00 2001 From: Patrick Landolt Date: Sun, 9 Jun 2024 18:19:11 +0200 Subject: [PATCH 276/477] [Mailer] Add mailomat mailer --- mailer.rst | 10 ++++++++++ webhook.rst | 5 +++++ 2 files changed, 15 insertions(+) diff --git a/mailer.rst b/mailer.rst index d7bccb11d86..502644a741a 100644 --- a/mailer.rst +++ b/mailer.rst @@ -106,6 +106,7 @@ Service Install with Webhook su `Infobip`_ ``composer require symfony/infobip-mailer`` `Mailgun`_ ``composer require symfony/mailgun-mailer`` yes `Mailjet`_ ``composer require symfony/mailjet-mailer`` yes +`Mailomat`_ ``composer require symfony/mailomat-mailer`` yes `MailPace`_ ``composer require symfony/mail-pace-mailer`` `MailerSend`_ ``composer require symfony/mailer-send-mailer`` `Mandrill`_ ``composer require symfony/mailchimp-mailer`` @@ -119,6 +120,10 @@ Service Install with Webhook su The Azure and Resend integrations were introduced in Symfony 7.1. +.. versionadded:: 7.2 + + The Mailomat integration was introduced in Symfony 7.2. + .. note:: As a convenience, Symfony also provides support for Gmail (``composer @@ -201,6 +206,10 @@ party provider: | | - HTTP n/a | | | - API ``mailjet+api://ACCESS_KEY:SECRET_KEY@default`` | +------------------------+---------------------------------------------------------+ +| `Mailomat`_ | - SMTP ``mailomat+smtp://USERNAME:PASSWORD@default`` | +| | - HTTP n/a | +| | - API ``mailomat+api://KEY@default`` | ++------------------------+---------------------------------------------------------+ | `MailPace`_ | - SMTP ``mailpace+api://API_TOKEN@default`` | | | - HTTP n/a | | | - API ``mailpace+api://API_TOKEN@default`` | @@ -1979,6 +1988,7 @@ the :class:`Symfony\\Bundle\\FrameworkBundle\\Test\\MailerAssertionsTrait`:: .. _`Mailgun`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Mailer/Bridge/Mailgun/README.md .. _`Mailjet`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Mailer/Bridge/Mailjet/README.md .. _`Markdown syntax`: https://commonmark.org/ +.. _`Mailomat`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Mailer/Bridge/Mailomat/README.md .. _`MailPace`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Mailer/Bridge/MailPace/README.md .. _`OpenSSL PHP extension`: https://www.php.net/manual/en/book.openssl.php .. _`PEM encoded`: https://en.wikipedia.org/wiki/Privacy-Enhanced_Mail diff --git a/webhook.rst b/webhook.rst index 38f3a4b1004..52633ae83e5 100644 --- a/webhook.rst +++ b/webhook.rst @@ -27,6 +27,7 @@ Brevo ``mailer.webhook.request_parser.brevo`` MailerSend ``mailer.webhook.request_parser.mailersend`` Mailgun ``mailer.webhook.request_parser.mailgun`` Mailjet ``mailer.webhook.request_parser.mailjet`` +Mailomat ``mailer.webhook.request_parser.mailomat`` Postmark ``mailer.webhook.request_parser.postmark`` Resend ``mailer.webhook.request_parser.resend`` Sendgrid ``mailer.webhook.request_parser.sendgrid`` @@ -36,6 +37,10 @@ Sendgrid ``mailer.webhook.request_parser.sendgrid`` The support for ``Resend`` and ``MailerSend`` were introduced in Symfony 7.1. +.. versionadded:: 7.2 + + The ``Mailomat`` integration was introduced in Symfony 7.2. + .. note:: Install the third-party mailer provider you want to use as described in the From 7cdfb52930f9097fef14ed56a3c8d6624461cb52 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 19 Jun 2024 09:20:04 +0200 Subject: [PATCH 277/477] [FrameworkBundle] Simplified the MicroKernelTrait setup --- configuration/micro_kernel_trait.rst | 107 +++++++++++++++------------ 1 file changed, 60 insertions(+), 47 deletions(-) diff --git a/configuration/micro_kernel_trait.rst b/configuration/micro_kernel_trait.rst index b67335514a1..23aa677cf20 100644 --- a/configuration/micro_kernel_trait.rst +++ b/configuration/micro_kernel_trait.rst @@ -16,9 +16,7 @@ via Composer: .. code-block:: terminal - $ composer require symfony/config symfony/http-kernel \ - symfony/http-foundation symfony/routing \ - symfony/dependency-injection symfony/framework-bundle + $ composer symfony/framework-bundle symfony/runtime Next, create an ``index.php`` file that defines the kernel class and runs it: @@ -34,19 +32,12 @@ Next, create an ``index.php`` file that defines the kernel class and runs it: use Symfony\Component\HttpKernel\Kernel as BaseKernel; use Symfony\Component\Routing\Attribute\Route; - require __DIR__.'/vendor/autoload.php'; + require_once dirname(__DIR__).'/vendor/autoload_runtime.php'; class Kernel extends BaseKernel { use MicroKernelTrait; - public function registerBundles(): array - { - return [ - new Symfony\Bundle\FrameworkBundle\FrameworkBundle(), - ]; - } - protected function configureContainer(ContainerConfigurator $container): void { // PHP equivalent of config/packages/framework.yaml @@ -64,11 +55,9 @@ Next, create an ``index.php`` file that defines the kernel class and runs it: } } - $kernel = new Kernel('dev', true); - $request = Request::createFromGlobals(); - $response = $kernel->handle($request); - $response->send(); - $kernel->terminate($request, $response); + return static function (array $context) { + return new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']); + } .. code-block:: php @@ -80,19 +69,12 @@ Next, create an ``index.php`` file that defines the kernel class and runs it: use Symfony\Component\HttpKernel\Kernel as BaseKernel; use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator; - require __DIR__.'/vendor/autoload.php'; + require_once dirname(__DIR__).'/vendor/autoload_runtime.php'; class Kernel extends BaseKernel { use MicroKernelTrait; - public function registerBundles(): array - { - return [ - new Symfony\Bundle\FrameworkBundle\FrameworkBundle(), - ]; - } - protected function configureContainer(ContainerConfigurator $container): void { // PHP equivalent of config/packages/framework.yaml @@ -114,17 +96,9 @@ Next, create an ``index.php`` file that defines the kernel class and runs it: } } - $kernel = new Kernel('dev', true); - $request = Request::createFromGlobals(); - $response = $kernel->handle($request); - $response->send(); - $kernel->terminate($request, $response); - -.. note:: - - In addition to the ``index.php`` file, you'll need to create a directory called - ``config/`` in your project (even if it's empty because you define the configuration - options inside the ``configureContainer()`` method). + return static function (array $context) { + return new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']); + } That's it! To test it, start the :doc:`Symfony Local Web Server `: @@ -135,6 +109,23 @@ That's it! To test it, start the :doc:`Symfony Local Web Server Then see the JSON response in your browser: http://localhost:8000/random/10 +.. tip:: + + If your kernel only defines a single controller, you can use an invokable method:: + + class Kernel extends BaseKernel + { + use MicroKernelTrait; + + // ... + + #[Route('/random/{limit}', name: 'random_number')] + public function __invoke(int $limit): JsonResponse + { + // ... + } + } + The Methods of a "Micro" Kernel ------------------------------- @@ -142,7 +133,26 @@ When you use the ``MicroKernelTrait``, your kernel needs to have exactly three m that define your bundles, your services and your routes: **registerBundles()** - This is the same ``registerBundles()`` that you see in a normal kernel. + This is the same ``registerBundles()`` that you see in a normal kernel. By + default, the micro kernel only registers the ``FrameworkBundle``. If you need + to register more bundles, override this method:: + + use Symfony\Bundle\FrameworkBundle\FrameworkBundle; + use Symfony\Bundle\TwigBundle\TwigBundle; + // ... + + class Kernel extends BaseKernel + { + use MicroKernelTrait; + + // ... + + public function registerBundles(): array + { + yield new FrameworkBundle(); + yield new TwigBundle(); + } + } **configureContainer(ContainerConfigurator $container)** This method builds and configures the container. In practice, you will use @@ -151,9 +161,13 @@ that define your bundles, your services and your routes: services directly in PHP or load external configuration files (shown below). **configureRoutes(RoutingConfigurator $routes)** - Your job in this method is to add routes to the application. The - ``RoutingConfigurator`` has methods that make adding routes in PHP more - fun. You can also load external routing files (shown below). + In this method, you can use the ``RoutingConfigurator`` object to define routes + in your application and associate them to the controllers defined in this very + same file. + + However, it's more convenient to define the controller routes using PHP attributes, + as shown above. That's why this method is commonly used only to load external + routing files (e.g. from bundles) as shown below. Adding Interfaces to "Micro" Kernel ----------------------------------- @@ -231,7 +245,10 @@ Now it looks like this:: namespace App; use App\DependencyInjection\AppExtension; + use Symfony\Bundle\FrameworkBundle\FrameworkBundle; use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait; + use Symfony\Bundle\TwigBundle\TwigBundle; + use Symfony\Bundle\WebProfilerBundle\WebProfilerBundle; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; use Symfony\Component\HttpKernel\Kernel as BaseKernel; @@ -241,18 +258,14 @@ Now it looks like this:: { use MicroKernelTrait; - public function registerBundles(): array + public function registerBundles(): iterable { - $bundles = [ - new \Symfony\Bundle\FrameworkBundle\FrameworkBundle(), - new \Symfony\Bundle\TwigBundle\TwigBundle(), - ]; + yield FrameworkBundle(); + yield TwigBundle(); if ('dev' === $this->getEnvironment()) { - $bundles[] = new \Symfony\Bundle\WebProfilerBundle\WebProfilerBundle(); + yield WebProfilerBundle(); } - - return $bundles; } protected function build(ContainerBuilder $containerBuilder): void From d68d6abc1120c766b42498468a6667695ee16805 Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Tue, 25 Jun 2024 09:43:08 +0200 Subject: [PATCH 278/477] [Validator] Add the format option to the Ulid constraint to allow accepting different ULID formats --- reference/constraints/Ulid.rst | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/reference/constraints/Ulid.rst b/reference/constraints/Ulid.rst index ed7dfe7ed96..4ba5ec3a3f5 100644 --- a/reference/constraints/Ulid.rst +++ b/reference/constraints/Ulid.rst @@ -73,6 +73,20 @@ Basic Usage Options ------- +``format`` +~~~~~~~~~~ + +**type**: ``string`` **default**: ``Ulid::FORMAT_BASE_32`` + +The format of the ULID to validate. The following formats are available: + +* ``Ulid::FORMAT_BASE_32``: The ULID is encoded in base32 (default) +* ``Ulid::FORMAT_BASE_58``: The ULID is encoded in base58 + +.. versionadded:: 7.2 + + The ``format`` option was introduced in Symfony 7.2. + .. include:: /reference/constraints/_groups-option.rst.inc ``message`` From ea63cd7d932c1b77ee589938dda2d3e03c0a9aca Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Tue, 25 Jun 2024 10:49:40 +0200 Subject: [PATCH 279/477] [Messenger] Document the --format option of messenger:stats command --- messenger.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/messenger.rst b/messenger.rst index 3dab2caac52..785cc022136 100644 --- a/messenger.rst +++ b/messenger.rst @@ -688,6 +688,14 @@ of some or all transports: # shows stats only for some transports $ php bin/console messenger:stats my_transport_name other_transport_name + # you can also output the stats in JSON format + $ php bin/console messenger:stats --format=json + $ php bin/console messenger:stats my_transport_name other_transport_name --format=json + +.. versionadded:: 7.2 + + The ``format`` option was introduced in Symfony 7.2. + .. note:: In order for this command to work, the configured transport's receiver must implement From 688db2816b0892982b0e2b2ab02fa9cf6a7f0573 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Fri, 14 Jun 2024 16:56:00 +0200 Subject: [PATCH 280/477] [Validator] Add the Yaml constraint --- components/yaml.rst | 2 + reference/constraints/Yaml.rst | 152 +++++++++++++++++++++++++++++++++ 2 files changed, 154 insertions(+) create mode 100644 reference/constraints/Yaml.rst diff --git a/components/yaml.rst b/components/yaml.rst index 5f724e0572c..2698aae8233 100644 --- a/components/yaml.rst +++ b/components/yaml.rst @@ -214,6 +214,8 @@ During the parsing of the YAML contents, all the ``_`` characters are removed from the numeric literal contents, so there is not a limit in the number of underscores you can include or the way you group contents. +.. _yaml-flags: + Advanced Usage: Flags --------------------- diff --git a/reference/constraints/Yaml.rst b/reference/constraints/Yaml.rst new file mode 100644 index 00000000000..49b65f251e8 --- /dev/null +++ b/reference/constraints/Yaml.rst @@ -0,0 +1,152 @@ +Yaml +==== + +Validates that a value has valid `YAML`_ syntax. + +.. versionadded:: 7.2 + + The ``Yaml`` constraint was introduced in Symfony 7.2. + +========== =================================================================== +Applies to :ref:`property or method ` +Class :class:`Symfony\\Component\\Validator\\Constraints\\Yaml` +Validator :class:`Symfony\\Component\\Validator\\Constraints\\YamlValidator` +========== =================================================================== + +Basic Usage +----------- + +The ``Yaml`` constraint can be applied to a property or a "getter" method: + +.. configuration-block:: + + .. code-block:: php-attributes + + // src/Entity/Report.php + namespace App\Entity; + + use Symfony\Component\Validator\Constraints as Assert; + + class Report + { + #[Assert\Yaml( + message: "Your configuration doesn't have valid YAML syntax." + )] + private string $customConfiguration; + } + + .. code-block:: yaml + + # config/validator/validation.yaml + App\Entity\Report: + properties: + customConfiguration: + - Yaml: + message: Your configuration doesn't have valid YAML syntax. + + .. code-block:: xml + + + + + + + + + + + + + + + .. code-block:: php + + // src/Entity/Report.php + namespace App\Entity; + + use Symfony\Component\Validator\Constraints as Assert; + use Symfony\Component\Validator\Mapping\ClassMetadata; + + class Report + { + public static function loadValidatorMetadata(ClassMetadata $metadata): void + { + $metadata->addPropertyConstraint('customConfiguration', new Assert\Yaml([ + 'message' => 'Your configuration doesn\'t have valid YAML syntax.', + ])); + } + } + +Options +------- + +``flags`` +~~~~~~~~~ + +**type**: ``integer`` **default**: ``0`` + +This option enables optional features of the YAML parser when validating contents. +Its value is a combination of one or more of the :ref:`flags defined by the Yaml component `: + +.. configuration-block:: + + .. code-block:: php-attributes + + // src/Entity/Report.php + namespace App\Entity; + + use Symfony\Component\Validator\Constraints as Assert; + use Symfony\Component\Yaml\Yaml; + + class Report + { + #[Assert\Yaml( + message: "Your configuration doesn't have valid YAML syntax.", + flags: Yaml::PARSE_CONSTANT | Yaml::PARSE_CUSTOM_TAGS | Yaml::PARSE_DATETIME, + )] + private string $customConfiguration; + } + + .. code-block:: php + + // src/Entity/Report.php + namespace App\Entity; + + use Symfony\Component\Validator\Constraints as Assert; + use Symfony\Component\Validator\Mapping\ClassMetadata; + use Symfony\Component\Yaml\Yaml; + + class Report + { + public static function loadValidatorMetadata(ClassMetadata $metadata): void + { + $metadata->addPropertyConstraint('customConfiguration', new Assert\Yaml([ + 'message' => 'Your configuration doesn\'t have valid YAML syntax.', + 'flags' => Yaml::PARSE_CONSTANT | Yaml::PARSE_CUSTOM_TAGS | Yaml::PARSE_DATETIME, + ])); + } + } + +``message`` +~~~~~~~~~~~ + +**type**: ``string`` **default**: ``This value is not valid YAML.`` + +This message shown if the underlying data is not a valid YAML value. + +You can use the following parameters in this message: + +=============== ============================================================== +Parameter Description +=============== ============================================================== +``{{ error }}`` The full error message from the YAML parser +``{{ line }}`` The line where the YAML syntax error happened +=============== ============================================================== + +.. include:: /reference/constraints/_groups-option.rst.inc + +.. include:: /reference/constraints/_payload-option.rst.inc + +.. _`YAML`: https://en.wikipedia.org/wiki/YAML From feabd16bf91dbafe52d1379b2d61a45bcfffdba0 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Tue, 25 Jun 2024 17:26:55 +0200 Subject: [PATCH 281/477] [DoctrineBridge] Allow EntityValueResolver to return a list of entities --- doctrine.rst | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/doctrine.rst b/doctrine.rst index 00418319105..770a7b32a0a 100644 --- a/doctrine.rst +++ b/doctrine.rst @@ -741,6 +741,20 @@ In the expression, the ``repository`` variable will be your entity's Repository class and any route wildcards - like ``{product_id}`` are available as variables. +The repository method called in the expression can also return a list of entities. +In that case, update the type of your controller argument:: + + #[Route('/posts_by/{author_id}')] + public function authorPosts( + #[MapEntity(class: Post::class, expr: 'repository.findBy({"author": author_id}, {}, 10)')] + iterable $posts + ): Response { + } + +.. versionadded:: 7.1 + + The mapping of the lists of entities was introduced in Symfony 7.1. + This can also be used to help resolve multiple arguments:: #[Route('/product/{id}/comments/{comment_id}')] From c3fdc75c27551e2a09bb5298b1d47e7e759ac60c Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 26 Jun 2024 09:01:07 +0200 Subject: [PATCH 282/477] [ExpressionLanguage] Add support for comments --- reference/formats/expression_language.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/reference/formats/expression_language.rst b/reference/formats/expression_language.rst index 818870452a5..e88ac7f6c24 100644 --- a/reference/formats/expression_language.rst +++ b/reference/formats/expression_language.rst @@ -20,6 +20,11 @@ The component supports: * **booleans** - ``true`` and ``false`` * **null** - ``null`` * **exponential** - also known as scientific (e.g. ``1.99E+3`` or ``1e-2``) +* **comments** - using ``/*`` and ``*/`` (e.g. ``/* this is a comment */``) + +.. versionadded:: 7.2 + + The support for comments inside expressions was introduced in Symfony 7.2. .. caution:: From 39be3e699885a57f91a2b30a4f34855465f1ec03 Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Wed, 26 Jun 2024 09:55:47 +0200 Subject: [PATCH 283/477] [DependencyInjection] Add `#[WhenNot]` attribute --- reference/attributes.rst | 1 + service_container.rst | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/reference/attributes.rst b/reference/attributes.rst index 4428dc4c587..d744cb9a9b4 100644 --- a/reference/attributes.rst +++ b/reference/attributes.rst @@ -43,6 +43,7 @@ Dependency Injection * :ref:`TaggedLocator ` * :ref:`Target ` * :ref:`When ` +* :ref:`WhenNot ` EventDispatcher ~~~~~~~~~~~~~~~ diff --git a/service_container.rst b/service_container.rst index ebc01b1fc8a..bc8e5f123b1 100644 --- a/service_container.rst +++ b/service_container.rst @@ -260,6 +260,32 @@ as a service in some environments:: // ... } +If you want to exclude a service from being registered in a specific +environment, you can use the ``#[WhenNot]`` attribute:: + + use Symfony\Component\DependencyInjection\Attribute\WhenNot; + + // SomeClass is registered in all environments except "dev" + + #[WhenNot(env: 'dev')] + class SomeClass + { + // ... + } + + // you can apply more than one WhenNot attribute to the same class + + #[WhenNot(env: 'dev')] + #[WhenNot(env: 'test')] + class AnotherClass + { + // ... + } + +.. versionadded:: 7.2 + + The ``#[WhenNot]`` attribute was introduced in Symfony 7.2. + .. _services-constructor-injection: Injecting Services/Config into a Service From 28070e85a3ea9ff4357150604d03c1582811b26c Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Fri, 28 Jun 2024 16:44:59 +0200 Subject: [PATCH 284/477] [Serializer] Remove any mention to annotations --- components/serializer.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/serializer.rst b/components/serializer.rst index c23e6300a4d..40a114b543e 100644 --- a/components/serializer.rst +++ b/components/serializer.rst @@ -264,8 +264,8 @@ Assume you have the following plain-old-PHP object:: } } -The definition of serialization can be specified using annotations, attributes, XML -or YAML. The :class:`Symfony\\Component\\Serializer\\Mapping\\Factory\\ClassMetadataFactory` +The definition of serialization can be specified using attributes, XML or YAML. +The :class:`Symfony\\Component\\Serializer\\Mapping\\Factory\\ClassMetadataFactory` that will be used by the normalizer must be aware of the format to use. The following code shows how to initialize the :class:`Symfony\\Component\\Serializer\\Mapping\\Factory\\ClassMetadataFactory` From d669eb32e6af05f5f34ce3953abf385336eeaed3 Mon Sep 17 00:00:00 2001 From: Matthieu Lempereur Date: Sun, 30 Jun 2024 16:16:58 +0200 Subject: [PATCH 285/477] deprecate TaggedIterator and TaggedLocator attributes --- reference/attributes.rst | 8 +++++++ .../service_subscribers_locators.rst | 24 ++++++++++++++----- service_container/tags.rst | 24 +++++++++---------- 3 files changed, 38 insertions(+), 18 deletions(-) diff --git a/reference/attributes.rst b/reference/attributes.rst index 4428dc4c587..ba34afd524d 100644 --- a/reference/attributes.rst +++ b/reference/attributes.rst @@ -44,6 +44,14 @@ Dependency Injection * :ref:`Target ` * :ref:`When ` +.. deprecated:: 7.1 + + The + :class:`Symfony\\Component\\DependencyInjection\\Attribute\\TaggedIterator` + and + :class:`Symfony\\Component\\DependencyInjection\\Attribute\\TaggedLocator` + were deprecated in Symfony 7.1. + EventDispatcher ~~~~~~~~~~~~~~~ diff --git a/service_container/service_subscribers_locators.rst b/service_container/service_subscribers_locators.rst index 25ebe97e7e7..9c36f8c82cd 100644 --- a/service_container/service_subscribers_locators.rst +++ b/service_container/service_subscribers_locators.rst @@ -307,6 +307,18 @@ This is done by having ``getSubscribedServices()`` return an array of ]; } +.. deprecated:: 7.1 + + The + :class:`Symfony\\Component\\DependencyInjection\\Attribute\\TaggedIterator` + and + :class:`Symfony\\Component\\DependencyInjection\\Attribute\\TaggedLocator` + were deprecated in Symfony 7.1. + :class:`Symfony\\Component\\DependencyInjection\\Attribute\\AutowireIterator` + and + :class:`Symfony\\Component\\DependencyInjection\\Attribute\\AutowireLocator` + should be used instead. + .. note:: The above example requires using ``3.2`` version or newer of ``symfony/service-contracts``. @@ -432,13 +444,13 @@ or directly via PHP attributes: namespace App; use Psr\Container\ContainerInterface; - use Symfony\Component\DependencyInjection\Attribute\TaggedLocator; + use Symfony\Component\DependencyInjection\Attribute\AutowireLocator; class CommandBus { public function __construct( // creates a service locator with all the services tagged with 'app.handler' - #[TaggedLocator('app.handler')] + #[AutowireLocator('app.handler')] private ContainerInterface $locator, ) { } @@ -674,12 +686,12 @@ to index the services: namespace App; use Psr\Container\ContainerInterface; - use Symfony\Component\DependencyInjection\Attribute\TaggedLocator; + use Symfony\Component\DependencyInjection\Attribute\AutowireLocator; class CommandBus { public function __construct( - #[TaggedLocator('app.handler', indexAttribute: 'key')] + #[AutowireLocator('app.handler', indexAttribute: 'key')] private ContainerInterface $locator, ) { } @@ -789,12 +801,12 @@ get the value used to index the services: namespace App; use Psr\Container\ContainerInterface; - use Symfony\Component\DependencyInjection\Attribute\TaggedLocator; + use Symfony\Component\DependencyInjection\Attribute\AutowireLocator; class CommandBus { public function __construct( - #[TaggedLocator('app.handler', 'defaultIndexMethod: 'getLocatorKey')] + #[AutowireLocator('app.handler', 'defaultIndexMethod: 'getLocatorKey')] private ContainerInterface $locator, ) { } diff --git a/service_container/tags.rst b/service_container/tags.rst index 1900ce28fb2..68509bc5620 100644 --- a/service_container/tags.rst +++ b/service_container/tags.rst @@ -674,13 +674,13 @@ directly via PHP attributes: // src/HandlerCollection.php namespace App; - use Symfony\Component\DependencyInjection\Attribute\TaggedIterator; + use Symfony\Component\DependencyInjection\Attribute\AutowireIterator; class HandlerCollection { public function __construct( // the attribute must be applied directly to the argument to autowire - #[TaggedIterator('app.handler')] + #[AutowireIterator('app.handler')] iterable $handlers ) { } @@ -766,12 +766,12 @@ iterator, add the ``exclude`` option: // src/HandlerCollection.php namespace App; - use Symfony\Component\DependencyInjection\Attribute\TaggedIterator; + use Symfony\Component\DependencyInjection\Attribute\AutowireIterator; class HandlerCollection { public function __construct( - #[TaggedIterator('app.handler', exclude: ['App\Handler\Three'])] + #[AutowireIterator('app.handler', exclude: ['App\Handler\Three'])] iterable $handlers ) { } @@ -849,12 +849,12 @@ disabled by setting the ``exclude_self`` option to ``false``: // src/HandlerCollection.php namespace App; - use Symfony\Component\DependencyInjection\Attribute\TaggedIterator; + use Symfony\Component\DependencyInjection\Attribute\AutowireIterator; class HandlerCollection { public function __construct( - #[TaggedIterator('app.handler', exclude: ['App\Handler\Three'], excludeSelf: false)] + #[AutowireIterator('app.handler', exclude: ['App\Handler\Three'], excludeSelf: false)] iterable $handlers ) { } @@ -999,12 +999,12 @@ you can define it in the configuration of the collecting service: // src/HandlerCollection.php namespace App; - use Symfony\Component\DependencyInjection\Attribute\TaggedIterator; + use Symfony\Component\DependencyInjection\Attribute\AutowireIterator; class HandlerCollection { public function __construct( - #[TaggedIterator('app.handler', defaultPriorityMethod: 'getPriority')] + #[AutowireIterator('app.handler', defaultPriorityMethod: 'getPriority')] iterable $handlers ) { } @@ -1073,12 +1073,12 @@ to index the services: // src/HandlerCollection.php namespace App; - use Symfony\Component\DependencyInjection\Attribute\TaggedIterator; + use Symfony\Component\DependencyInjection\Attribute\AutowireIterator; class HandlerCollection { public function __construct( - #[TaggedIterator('app.handler', indexAttribute: 'key')] + #[AutowireIterator('app.handler', indexAttribute: 'key')] iterable $handlers ) { } @@ -1187,12 +1187,12 @@ get the value used to index the services: // src/HandlerCollection.php namespace App; - use Symfony\Component\DependencyInjection\Attribute\TaggedIterator; + use Symfony\Component\DependencyInjection\Attribute\AutowireIterator; class HandlerCollection { public function __construct( - #[TaggedIterator('app.handler', defaultIndexMethod: 'getIndex')] + #[AutowireIterator('app.handler', defaultIndexMethod: 'getIndex')] iterable $handlers ) { } From 4add5c3a84584eca7fedf90addd32861fef651e7 Mon Sep 17 00:00:00 2001 From: Matthieu Lempereur Date: Sun, 30 Jun 2024 17:11:46 +0200 Subject: [PATCH 286/477] update Url constraint --- reference/constraints/Url.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/reference/constraints/Url.rst b/reference/constraints/Url.rst index b3a46d5aec4..6e93a284aa7 100644 --- a/reference/constraints/Url.rst +++ b/reference/constraints/Url.rst @@ -317,6 +317,11 @@ also relative URLs that contain no protocol (e.g. ``//example.com``). The ``requiredTld`` option was introduced in Symfony 7.1. +.. deprecated:: 7.1 + + Not setting the ``requireTld`` option is deprecated since Symfony 7.1 + and will default to ``true`` in Symfony 8.0. + By default, URLs like ``https://aaa`` or ``https://foobar`` are considered valid because they are tecnically correct according to the `URL spec`_. If you set this option to ``true``, the host part of the URL will have to include a TLD (top-level domain From 4ae71900e4ec8f6f162b8279c5059520c200cb78 Mon Sep 17 00:00:00 2001 From: Hugo Posnic Date: Sun, 30 Jun 2024 21:42:49 +0200 Subject: [PATCH 287/477] Update Url.rst --- reference/constraints/Url.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reference/constraints/Url.rst b/reference/constraints/Url.rst index b3a46d5aec4..f23bbf66a74 100644 --- a/reference/constraints/Url.rst +++ b/reference/constraints/Url.rst @@ -315,7 +315,7 @@ also relative URLs that contain no protocol (e.g. ``//example.com``). .. versionadded:: 7.1 - The ``requiredTld`` option was introduced in Symfony 7.1. + The ``requireTld`` option was introduced in Symfony 7.1. By default, URLs like ``https://aaa`` or ``https://foobar`` are considered valid because they are tecnically correct according to the `URL spec`_. If you set this option From d85d5ee561480163a5cda0d5b31083e15bc68406 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Mon, 1 Jul 2024 08:49:09 +0200 Subject: [PATCH 288/477] Minor tweaks --- reference/attributes.rst | 8 +++----- service_container/service_subscribers_locators.rst | 12 ++++-------- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/reference/attributes.rst b/reference/attributes.rst index ba34afd524d..b1f2f9c5d55 100644 --- a/reference/attributes.rst +++ b/reference/attributes.rst @@ -46,11 +46,9 @@ Dependency Injection .. deprecated:: 7.1 - The - :class:`Symfony\\Component\\DependencyInjection\\Attribute\\TaggedIterator` - and - :class:`Symfony\\Component\\DependencyInjection\\Attribute\\TaggedLocator` - were deprecated in Symfony 7.1. + The :class:`Symfony\\Component\\DependencyInjection\\Attribute\\TaggedIterator` + and :class:`Symfony\\Component\\DependencyInjection\\Attribute\\TaggedLocator` + attributes were deprecated in Symfony 7.1. EventDispatcher ~~~~~~~~~~~~~~~ diff --git a/service_container/service_subscribers_locators.rst b/service_container/service_subscribers_locators.rst index 9c36f8c82cd..e040ac2b972 100644 --- a/service_container/service_subscribers_locators.rst +++ b/service_container/service_subscribers_locators.rst @@ -309,15 +309,11 @@ This is done by having ``getSubscribedServices()`` return an array of .. deprecated:: 7.1 - The - :class:`Symfony\\Component\\DependencyInjection\\Attribute\\TaggedIterator` - and - :class:`Symfony\\Component\\DependencyInjection\\Attribute\\TaggedLocator` - were deprecated in Symfony 7.1. + The :class:`Symfony\\Component\\DependencyInjection\\Attribute\\TaggedIterator` + and :class:`Symfony\\Component\\DependencyInjection\\Attribute\\TaggedLocator` + attributes were deprecated in Symfony 7.1 in favor of :class:`Symfony\\Component\\DependencyInjection\\Attribute\\AutowireIterator` - and - :class:`Symfony\\Component\\DependencyInjection\\Attribute\\AutowireLocator` - should be used instead. + and :class:`Symfony\\Component\\DependencyInjection\\Attribute\\AutowireLocator`. .. note:: From b6ffad3ce5e5b558c420f99a5852bd88b5f8ea69 Mon Sep 17 00:00:00 2001 From: Baptiste Leduc Date: Wed, 7 Feb 2024 10:11:28 +0100 Subject: [PATCH 289/477] [TypeInfo] Add documentation --- components/type_info.rst | 71 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 components/type_info.rst diff --git a/components/type_info.rst b/components/type_info.rst new file mode 100644 index 00000000000..12960ff49d2 --- /dev/null +++ b/components/type_info.rst @@ -0,0 +1,71 @@ +The TypeInfo Component +====================== + + The TypeInfo component extracts PHP types information. It aims to: + + - Have a powerful Type definition that can handle union, intersections, and generics (and could be even more extended) + + - Being able to get types from anything, such as properties, method arguments, return types, and raw strings (and can also be extended). + +.. caution:: + + This component is :doc:`experimental ` and could be changed at any time + without prior notice. + +Installation +------------ + +.. code-block:: terminal + + $ composer require symfony/type-info + +.. include:: /components/require_autoload.rst.inc + +Usage +----- + +This component will gives you a :class:`Symfony\\Component\\TypeInfo\\Type` object that represents +the PHP type of whatever you builded or asked to resolve. + +There are two ways to use this component. First one is to create a type manually thanks +to :class:`Symfony\\Component\\TypeInfo\\Type` static methods as following:: + + use Symfony\Component\TypeInfo\Type; + + Type::int(); + Type::nullable(Type::string()); + Type::generic(Type::object(Collection::class), Type::int()); + Type::list(Type::bool()); + Type::intersection(Type::object(\Stringable::class), Type::object(\Iterator::class)); + + // Many others are available and can be + // found in Symfony\Component\TypeInfo\TypeFactoryTrait + + +Second way to use TypeInfo is to resolve a type based on reflection or a simple string:: + + use Symfony\Component\TypeInfo\Type; + use Symfony\Component\TypeInfo\TypeResolver\TypeResolver; + + // Instantiate a new resolver + $typeResolver = TypeResolver::create(); + + // Then resolve types for any subject + $typeResolver->resolve(new \ReflectionProperty(Dummy::class, 'id')); // returns an "int" Type instance + $typeResolver->resolve('bool'); // returns a "bool" Type instance + + // Types can be instantiated thanks to static factories + $type = Type::list(Type::nullable(Type::bool())); + + // Type instances have several helper methods + $type->getBaseType() // returns an "array" Type instance + $type->getCollectionKeyType(); // returns an "int" Type instance + $type->getCollectionValueType()->isNullable(); // returns true + +Each of this rows will return you a Type instance that will corresponds to whatever static method you used to build it. +We also can resolve a type from a string like we can see in this example with the `'bool'` parameter it is mostly +designed that way so we can give TypeInfo a string from whatever was extracted from existing phpDoc within PropertyInfo. + +.. note:: + + To support raw string resolving, you need to install ``phpstan/phpdoc-parser`` package. From 6bb4ae9e19d8a8a7181db4d0d9bbf5815b9553e7 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Tue, 2 Jul 2024 16:52:12 +0200 Subject: [PATCH 290/477] Minor rewords --- components/type_info.rst | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/components/type_info.rst b/components/type_info.rst index 12960ff49d2..f3d1119b1af 100644 --- a/components/type_info.rst +++ b/components/type_info.rst @@ -1,16 +1,20 @@ The TypeInfo Component ====================== - The TypeInfo component extracts PHP types information. It aims to: +The TypeInfo component extracts type information from PHP elements like properties, +arguments and return types. - - Have a powerful Type definition that can handle union, intersections, and generics (and could be even more extended) +This component provides: - - Being able to get types from anything, such as properties, method arguments, return types, and raw strings (and can also be extended). +* A powerful ``Type`` definition that can handle unions, intersections, and generics + (and can be extended to support more types in the future); +* A way to get types from PHP elements such as properties, method arguments, + return types, and raw strings. .. caution:: - This component is :doc:`experimental ` and could be changed at any time - without prior notice. + This component is :doc:`experimental ` and + could be changed at any time without prior notice. Installation ------------ @@ -24,11 +28,11 @@ Installation Usage ----- -This component will gives you a :class:`Symfony\\Component\\TypeInfo\\Type` object that represents -the PHP type of whatever you builded or asked to resolve. +This component gives you a :class:`Symfony\\Component\\TypeInfo\\Type` object that +represents the PHP type of anything you built or asked to resolve. There are two ways to use this component. First one is to create a type manually thanks -to :class:`Symfony\\Component\\TypeInfo\\Type` static methods as following:: +to the :class:`Symfony\\Component\\TypeInfo\\Type` static methods as following:: use Symfony\Component\TypeInfo\Type; @@ -41,8 +45,8 @@ to :class:`Symfony\\Component\\TypeInfo\\Type` static methods as following:: // Many others are available and can be // found in Symfony\Component\TypeInfo\TypeFactoryTrait - -Second way to use TypeInfo is to resolve a type based on reflection or a simple string:: +The second way of using the component is to use ``TypeInfo`` to resolve a type +based on reflection or a simple string:: use Symfony\Component\TypeInfo\Type; use Symfony\Component\TypeInfo\TypeResolver\TypeResolver; @@ -62,9 +66,9 @@ Second way to use TypeInfo is to resolve a type based on reflection or a simple $type->getCollectionKeyType(); // returns an "int" Type instance $type->getCollectionValueType()->isNullable(); // returns true -Each of this rows will return you a Type instance that will corresponds to whatever static method you used to build it. -We also can resolve a type from a string like we can see in this example with the `'bool'` parameter it is mostly -designed that way so we can give TypeInfo a string from whatever was extracted from existing phpDoc within PropertyInfo. +Each of this calls will return you a ``Type`` instance that corresponds to the +static method used. You can also resolve types from a string (as shown in the +``bool`` parameter of the previous example) .. note:: From 8e0643a9c8f7a5608b315245335ef89badee0f60 Mon Sep 17 00:00:00 2001 From: Jacob Dreesen Date: Tue, 2 Jul 2024 17:34:07 +0200 Subject: [PATCH 291/477] Fix typo in the new TypeInfo docs --- components/type_info.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/type_info.rst b/components/type_info.rst index f3d1119b1af..77e25451e6c 100644 --- a/components/type_info.rst +++ b/components/type_info.rst @@ -66,7 +66,7 @@ based on reflection or a simple string:: $type->getCollectionKeyType(); // returns an "int" Type instance $type->getCollectionValueType()->isNullable(); // returns true -Each of this calls will return you a ``Type`` instance that corresponds to the +Each of these calls will return you a ``Type`` instance that corresponds to the static method used. You can also resolve types from a string (as shown in the ``bool`` parameter of the previous example) From 09e7fab9107d5bd8d001598b9b7fdd7754f1d397 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 3 Jul 2024 09:27:30 +0200 Subject: [PATCH 292/477] [TypeInfo] Better explain the getBaseType() method --- components/type_info.rst | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/components/type_info.rst b/components/type_info.rst index 77e25451e6c..1c42a89b3c8 100644 --- a/components/type_info.rst +++ b/components/type_info.rst @@ -62,9 +62,20 @@ based on reflection or a simple string:: $type = Type::list(Type::nullable(Type::bool())); // Type instances have several helper methods - $type->getBaseType() // returns an "array" Type instance - $type->getCollectionKeyType(); // returns an "int" Type instance - $type->getCollectionValueType()->isNullable(); // returns true + + // returns the main type (e.g. in this example ir returns an "array" Type instance) + // for nullable types (e.g. string|null) returns the non-null type (e.g. string) + // and for compound types (e.g. int|string) it throws an exception because both types + // can be considered the main one, so there's no way to pick one + $baseType = $type->getBaseType(); + + // for collections, it returns the type of the item used as the key + // in this example, the collection is a list, so it returns and "int" Type instance + $keyType = $type->getCollectionKeyType(); + + // you can chain the utility methods e.g. to introspect the values of the collection + // the following code will return true + $isValueNullable = $type->getCollectionValueType()->isNullable(); Each of these calls will return you a ``Type`` instance that corresponds to the static method used. You can also resolve types from a string (as shown in the From c4e8ace5ce8e095c4c6a67a1db20d979a003195b Mon Sep 17 00:00:00 2001 From: sakul95 <60596924+sakul95@users.noreply.github.com> Date: Wed, 3 Jul 2024 10:10:25 +0200 Subject: [PATCH 293/477] [Notifier] Add Sipgate bridge --- notifier.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/notifier.rst b/notifier.rst index 1a19c135a7c..3ecb8878fb4 100644 --- a/notifier.rst +++ b/notifier.rst @@ -159,6 +159,9 @@ Service `Sinch`_ **Install**: ``composer require symfony/sinch-notifier`` \ **DSN**: ``sinch://ACCOUNT_ID:AUTH_TOKEN@default?from=FROM`` \ **Webhook support**: No +`Sipgate`_ **Install**: ``composer require symfony/sipgate-notifier`` \ + **DSN**: ``sipgate://TOKEN_ID:TOKEN@default?senderId=SENDER_ID`` \ + **Webhook support**: No `SmsSluzba`_ **Install**: ``composer require symfony/sms-sluzba-notifier`` \ **DSN**: ``sms-sluzba://USERNAME:PASSWORD@default`` \ **Webhook support**: No @@ -214,6 +217,10 @@ Service The ``Smsbox``, ``SmsSluzba``, ``SMSense``, ``LOX24`` and ``Unifonic`` integrations were introduced in Symfony 7.1. +.. versionadded:: 7.2 + + The ``Sipgate`` integration was introduced in Symfony 7.2. + .. deprecated:: 7.1 The `Sms77`_ integration is deprecated since @@ -1131,6 +1138,7 @@ is dispatched. Listeners receive a .. _`Seven.io`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Sevenio/README.md .. _`SimpleTextin`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/SimpleTextin/README.md .. _`Sinch`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Sinch/README.md +.. _`Sipgate`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Sipgate/README.md .. _`Slack`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Slack/README.md .. _`Sms77`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Sms77/README.md .. _`SmsBiuras`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/SmsBiuras/README.md From 9f4e5a5fb5418489978f0b30e5803e4eaec80baf Mon Sep 17 00:00:00 2001 From: Matthieu Lempereur Date: Sun, 7 Jul 2024 13:56:54 +0200 Subject: [PATCH 294/477] Remove the Gitter bridge --- notifier.rst | 2 -- 1 file changed, 2 deletions(-) diff --git a/notifier.rst b/notifier.rst index 5fe86724fe1..cbc23655124 100644 --- a/notifier.rst +++ b/notifier.rst @@ -351,7 +351,6 @@ Service Package D `Discord`_ ``symfony/discord-notifier`` ``discord://TOKEN@default?webhook_id=ID`` `FakeChat`_ ``symfony/fake-chat-notifier`` ``fakechat+email://default?to=TO&from=FROM`` or ``fakechat+logger://default`` `Firebase`_ ``symfony/firebase-notifier`` ``firebase://USERNAME:PASSWORD@default`` -`Gitter`_ ``symfony/gitter-notifier`` ``gitter://TOKEN@default?room_id=ROOM_ID`` `GoogleChat`_ ``symfony/google-chat-notifier`` ``googlechat://ACCESS_KEY:ACCESS_TOKEN@default/SPACE?thread_key=THREAD_KEY`` `LINE Notify`_ ``symfony/line-notify-notifier`` ``linenotify://TOKEN@default`` `LinkedIn`_ ``symfony/linked-in-notifier`` ``linkedin://TOKEN:USER_ID@default`` @@ -1105,7 +1104,6 @@ is dispatched. Listeners receive a .. _`Firebase`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Firebase/README.md .. _`FreeMobile`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/FreeMobile/README.md .. _`GatewayApi`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/GatewayApi/README.md -.. _`Gitter`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Gitter/README.md .. _`GoIP`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/GoIP/README.md .. _`GoogleChat`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/GoogleChat/README.md .. _`Infobip`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Infobip/README.md From 03173f88b1d74cb64a5ae1042bbdd19a3d515531 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Mon, 8 Jul 2024 09:39:04 +0200 Subject: [PATCH 295/477] Add a note explaining the removal of Gitter --- notifier.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/notifier.rst b/notifier.rst index cbc23655124..d959b4a73d0 100644 --- a/notifier.rst +++ b/notifier.rst @@ -370,6 +370,11 @@ Service Package D The ``Bluesky`` integration was introduced in Symfony 7.1. +.. deprecated:: 7.2 + + The ``Gitter`` integration was removed in Symfony 7.2 because that service + no longer provides an API. + .. caution:: By default, if you have the :doc:`Messenger component ` installed, From 15a50b58980903c362e534d21021cfc88c0d72d6 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Mon, 8 Jul 2024 10:34:38 +0200 Subject: [PATCH 296/477] Minor tweaks --- components/type_info.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/components/type_info.rst b/components/type_info.rst index 1c42a89b3c8..f6b5e84a0f5 100644 --- a/components/type_info.rst +++ b/components/type_info.rst @@ -63,17 +63,17 @@ based on reflection or a simple string:: // Type instances have several helper methods - // returns the main type (e.g. in this example ir returns an "array" Type instance) - // for nullable types (e.g. string|null) returns the non-null type (e.g. string) + // returns the main type (e.g. in this example i returns an "array" Type instance); + // for nullable types (e.g. string|null) it returns the non-null type (e.g. string) // and for compound types (e.g. int|string) it throws an exception because both types // can be considered the main one, so there's no way to pick one $baseType = $type->getBaseType(); - // for collections, it returns the type of the item used as the key + // for collections, it returns the type of the item used as the key; // in this example, the collection is a list, so it returns and "int" Type instance $keyType = $type->getCollectionKeyType(); - // you can chain the utility methods e.g. to introspect the values of the collection + // you can chain the utility methods (e.g. to introspect the values of the collection) // the following code will return true $isValueNullable = $type->getCollectionValueType()->isNullable(); From 7928e4d7b21c7e860492c7ee6e9dbcd4a1f2e1ef Mon Sep 17 00:00:00 2001 From: Tim Herlaud Date: Wed, 10 Jul 2024 09:17:34 +0200 Subject: [PATCH 297/477] [String] Add TruncateMode mode to truncate methods --- string.rst | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/string.rst b/string.rst index c58a736da89..c956d33b9af 100644 --- a/string.rst +++ b/string.rst @@ -394,11 +394,16 @@ Methods to Join, Split, Truncate and Reverse u('Lorem Ipsum')->truncate(3); // 'Lor' u('Lorem Ipsum')->truncate(80); // 'Lorem Ipsum' // the second argument is the character(s) added when a string is cut + // the third argument is TruncateMode::Char by default // (the total length includes the length of this character(s)) - u('Lorem Ipsum')->truncate(8, '…'); // 'Lorem I…' - // if the third argument is false, the last word before the cut is kept - // even if that generates a string longer than the desired length - u('Lorem Ipsum')->truncate(8, '…', cut: false); // 'Lorem Ipsum' + u('Lorem Ipsum')->truncate(8, '…'); // 'Lorem I…' + // use options to keep complete words + u('Lorem ipsum dolor sit amet')->truncate(10, '...', TruncateMode::WordBefore); // 'Lorem...' + u('Lorem ipsum dolor sit amet')->truncate(14, '...', TruncateMode::WordAfter); // 'Lorem ipsum...' + +.. versionadded:: 7.2 + + The TruncateMode argument for truncate function was introduced in Symfony 7.2. :: From b607d25adaad279a4c0b974713f3f627c00cff7c Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 10 Jul 2024 17:09:38 +0200 Subject: [PATCH 298/477] Reword --- string.rst | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/string.rst b/string.rst index 72dfb5c4ae7..cd104b1f947 100644 --- a/string.rst +++ b/string.rst @@ -394,16 +394,20 @@ Methods to Join, Split, Truncate and Reverse u('Lorem Ipsum')->truncate(3); // 'Lor' u('Lorem Ipsum')->truncate(80); // 'Lorem Ipsum' // the second argument is the character(s) added when a string is cut - // the third argument is TruncateMode::Char by default // (the total length includes the length of this character(s)) + // (note that '…' is a single character that includes three dots; it's not '...') u('Lorem Ipsum')->truncate(8, '…'); // 'Lorem I…' - // use options to keep complete words - u('Lorem ipsum dolor sit amet')->truncate(10, '...', TruncateMode::WordBefore); // 'Lorem...' - u('Lorem ipsum dolor sit amet')->truncate(14, '...', TruncateMode::WordAfter); // 'Lorem ipsum...' + // the third optional argument defines how to cut words when the length is exceeded + // the default value is TruncateMode::Char which cuts the string at the exact given length + u('Lorem ipsum dolor sit amet')->truncate(8, cut: TruncateMode::Char); // 'Lorem ip' + // returns up to the last complete word that fits in the given length without surpassing it + u('Lorem ipsum dolor sit amet')->truncate(8, cut: TruncateMode::WordBefore); // 'Lorem' + // returns up to the last complete word that fits in the given length, surpassing it if needed + u('Lorem ipsum dolor sit amet')->truncate(8, cut: TruncateMode::WordAfter); // 'Lorem ipsum' .. versionadded:: 7.2 - The TruncateMode argument for truncate function was introduced in Symfony 7.2. + The ``TruncateMode`` argument for truncate function was introduced in Symfony 7.2. :: From 3236182336c79d9d3ea5a28a2c21550067b636a0 Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Wed, 10 Jul 2024 20:06:51 +0200 Subject: [PATCH 299/477] - --- string.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/string.rst b/string.rst index cd104b1f947..f2856976986 100644 --- a/string.rst +++ b/string.rst @@ -407,7 +407,7 @@ Methods to Join, Split, Truncate and Reverse .. versionadded:: 7.2 - The ``TruncateMode`` argument for truncate function was introduced in Symfony 7.2. + The ``TruncateMode`` parameter for truncate function was introduced in Symfony 7.2. :: From e983455bc391256a77f5397efe650393e9c58c04 Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Wed, 17 Jul 2024 15:13:29 +0200 Subject: [PATCH 300/477] [Validator] Add the `WordCount` constraint --- reference/constraints/WordCount.rst | 150 ++++++++++++++++++++++++++++ reference/constraints/map.rst.inc | 1 + 2 files changed, 151 insertions(+) create mode 100644 reference/constraints/WordCount.rst diff --git a/reference/constraints/WordCount.rst b/reference/constraints/WordCount.rst new file mode 100644 index 00000000000..74c79216898 --- /dev/null +++ b/reference/constraints/WordCount.rst @@ -0,0 +1,150 @@ +WordCount +========= + +.. versionadded:: 7.2 + + The ``WordCount`` constraint was introduced in Symfony 7.2. + +Validates that a string (or an object implementing the ``Stringable`` PHP interface) +contains a given number of words. Internally, this constraint uses the +:phpclass:`IntlBreakIterator` class to count the words depending on your locale. + +========== ======================================================================= +Applies to :ref:`property or method ` +Class :class:`Symfony\\Component\\Validator\\Constraints\\WordCount` +Validator :class:`Symfony\\Component\\Validator\\Constraints\\WordCountValidator` +========== ======================================================================= + +Basic Usage +----------- + +If you wanted to ensure that the ``content`` property of a ``BlogPostDTO`` +class contains between 100 and 200 words, you could do the following: + +.. configuration-block:: + + .. code-block:: php-attributes + + // src/Entity/BlogPostDTO.php + namespace App\Entity; + + use Symfony\Component\Validator\Constraints as Assert; + + class BlogPostDTO + { + #[Assert\WordCount(min: 100, max: 200)] + protected string $content; + } + + .. code-block:: yaml + + # config/validator/validation.yaml + App\Entity\BlogPostDTO: + properties: + content: + - WordCount: + min: 100 + max: 200 + + .. code-block:: xml + + + + + + + + + + + + + + + + .. code-block:: php + + // src/Entity/BlogPostDTO.php + namespace App\Entity; + + use Symfony\Component\Validator\Constraints as Assert; + use Symfony\Component\Validator\Mapping\ClassMetadata; + + class BlogPostDTO + { + // ... + + public static function loadValidatorMetadata(ClassMetadata $metadata): void + { + $metadata->addPropertyConstraint('content', new Assert\WordCount([ + 'min' => 100, + 'max' => 200, + ])); + } + } + +Options +------- + +``min`` +~~~~~~~ + +**type**: ``integer`` **default**: ``null`` + +The minimum number of words that the value must contain. + +``max`` +~~~~~~~ + +**type**: ``integer`` **default**: ``null`` + +The maximum number of words that the value must contain. + +``locale`` +~~~~~~~~~~ + +**type**: ``string`` **default**: ``null`` + +The locale to use for counting the words by using the :phpclass:`IntlBreakIterator` +class. The default value (``null``) means that the constraint uses the current +user locale. + +.. include:: /reference/constraints/_groups-option.rst.inc + +``minMessage`` +~~~~~~~~~~~~~~ + +**type**: ``string`` **default**: ``This value is too short. It should contain at least one word.|This value is too short. It should contain at least {{ min }} words.`` + +This is the message that will be shown if the value does not contain at least +the minimum number of words. + +You can use the following parameters in this message: + +================ ================================================== +Parameter Description +================ ================================================== +``{{ min }}`` The minimum number of words +``{{ count }}`` The actual number of words +================ ================================================== + +``maxMessage`` +~~~~~~~~~~~~~~ + +**type**: ``string`` **default**: ``This value is too long. It should contain one word.|This value is too long. It should contain {{ max }} words or less.`` + +This is the message that will be shown if the value contains more than the +maximum number of words. + +You can use the following parameters in this message: + +================ ================================================== +Parameter Description +================ ================================================== +``{{ max }}`` The maximum number of words +``{{ count }}`` The actual number of words +================ ================================================== + +.. include:: /reference/constraints/_payload-option.rst.inc diff --git a/reference/constraints/map.rst.inc b/reference/constraints/map.rst.inc index 9f14f418bb1..978951c9de7 100644 --- a/reference/constraints/map.rst.inc +++ b/reference/constraints/map.rst.inc @@ -33,6 +33,7 @@ String Constraints * :doc:`NoSuspiciousCharacters ` * :doc:`Charset ` * :doc:`MacAddress ` +* :doc:`WordCount ` Comparison Constraints ~~~~~~~~~~~~~~~~~~~~~~ From 47279ab422ce618a328db6f7ba96cc2efa80ad93 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Fri, 19 Jul 2024 12:12:22 +0200 Subject: [PATCH 301/477] fix typos --- components/type_info.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/type_info.rst b/components/type_info.rst index f6b5e84a0f5..30ae11aa222 100644 --- a/components/type_info.rst +++ b/components/type_info.rst @@ -63,14 +63,14 @@ based on reflection or a simple string:: // Type instances have several helper methods - // returns the main type (e.g. in this example i returns an "array" Type instance); + // returns the main type (e.g. in this example it returns an "array" Type instance); // for nullable types (e.g. string|null) it returns the non-null type (e.g. string) // and for compound types (e.g. int|string) it throws an exception because both types // can be considered the main one, so there's no way to pick one $baseType = $type->getBaseType(); // for collections, it returns the type of the item used as the key; - // in this example, the collection is a list, so it returns and "int" Type instance + // in this example, the collection is a list, so it returns an "int" Type instance $keyType = $type->getCollectionKeyType(); // you can chain the utility methods (e.g. to introspect the values of the collection) From 16c9fdb2b0ea5b647cdb1f7904d85b67f983beef Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Fri, 19 Jul 2024 12:47:06 +0200 Subject: [PATCH 302/477] use the ref role for internal links --- reference/events.rst | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/reference/events.rst b/reference/events.rst index 411e5e327f5..57806ee8f8d 100644 --- a/reference/events.rst +++ b/reference/events.rst @@ -56,8 +56,8 @@ their priorities: This event is dispatched after the controller has been resolved but before executing it. It's useful to initialize things later needed by the -controller, such as `value resolvers`_, and even to change the controller -entirely:: +controller, such as :ref:`value resolvers `, and +even to change the controller entirely:: use Symfony\Component\HttpKernel\Event\ControllerEvent; @@ -296,5 +296,3 @@ their priorities: .. code-block:: terminal $ php bin/console debug:event-dispatcher kernel.exception - -.. _`value resolvers`: https://symfony.com/doc/current/controller/value_resolver.html#managing-value-resolvers From fa572ee1d7fd2cea6717ab3a52a93d30d536c04b Mon Sep 17 00:00:00 2001 From: Petrisor Ciprian Daniel Date: Fri, 19 Jul 2024 23:31:27 +0300 Subject: [PATCH 303/477] [Config] Secrets decrypt exit option --- configuration/secrets.rst | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/configuration/secrets.rst b/configuration/secrets.rst index f717456a22c..b16c36643aa 100644 --- a/configuration/secrets.rst +++ b/configuration/secrets.rst @@ -271,11 +271,20 @@ manually store this file somewhere and deploy it. There are 2 ways to do that: .. code-block:: terminal - $ APP_RUNTIME_ENV=prod php bin/console secrets:decrypt-to-local --force + $ APP_RUNTIME_ENV=prod php bin/console secrets:decrypt-to-local --force --exit This will write all the decrypted secrets into the ``.env.prod.local`` file. After doing this, the decryption key does *not* need to remain on the server(s). + Note the usage of the ``--exit`` option: this forces all secrets to be successfully + decrypted, otherwise a non-zero exit code is returned. + + If you wish to continue regardless of errors occurring during decryption, you may omit this option. + + .. versionadded:: 7.2 + + The ``--exit`` option was introduced in Symfony 7.2. + Rotating Secrets ---------------- From 97103298ebabb6f3fb5c015450e1d8f893149bca Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Mon, 22 Jul 2024 09:03:49 +0200 Subject: [PATCH 304/477] Tweaks --- configuration/secrets.rst | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/configuration/secrets.rst b/configuration/secrets.rst index b16c36643aa..734873b255c 100644 --- a/configuration/secrets.rst +++ b/configuration/secrets.rst @@ -276,14 +276,16 @@ manually store this file somewhere and deploy it. There are 2 ways to do that: This will write all the decrypted secrets into the ``.env.prod.local`` file. After doing this, the decryption key does *not* need to remain on the server(s). - Note the usage of the ``--exit`` option: this forces all secrets to be successfully - decrypted, otherwise a non-zero exit code is returned. + Note the usage of the ``--exit`` option: this ensures that all secrets are + successfully decrypted. If any error occurs during the decryption process, + the command will return a non-zero exit code, indicating a failure. - If you wish to continue regardless of errors occurring during decryption, you may omit this option. + If you wish to continue regardless of errors occurring during decryption, + you may omit this option. .. versionadded:: 7.2 - The ``--exit`` option was introduced in Symfony 7.2. + The ``--exit`` option was introduced in Symfony 7.2. Rotating Secrets ---------------- From 8e1d67b18758832865b51fd28066018cfc34b9ac Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Mon, 22 Jul 2024 15:16:47 +0200 Subject: [PATCH 305/477] drop the --exit option --- configuration/secrets.rst | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/configuration/secrets.rst b/configuration/secrets.rst index 734873b255c..f717456a22c 100644 --- a/configuration/secrets.rst +++ b/configuration/secrets.rst @@ -271,22 +271,11 @@ manually store this file somewhere and deploy it. There are 2 ways to do that: .. code-block:: terminal - $ APP_RUNTIME_ENV=prod php bin/console secrets:decrypt-to-local --force --exit + $ APP_RUNTIME_ENV=prod php bin/console secrets:decrypt-to-local --force This will write all the decrypted secrets into the ``.env.prod.local`` file. After doing this, the decryption key does *not* need to remain on the server(s). - Note the usage of the ``--exit`` option: this ensures that all secrets are - successfully decrypted. If any error occurs during the decryption process, - the command will return a non-zero exit code, indicating a failure. - - If you wish to continue regardless of errors occurring during decryption, - you may omit this option. - - .. versionadded:: 7.2 - - The ``--exit`` option was introduced in Symfony 7.2. - Rotating Secrets ---------------- From f5f16af36ded58edf37af2be3fe6f078d7c6b64b Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Thu, 25 Jul 2024 09:54:38 +0200 Subject: [PATCH 306/477] add the $token argument to checkPostAuth() --- security/user_checkers.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security/user_checkers.rst b/security/user_checkers.rst index d62cc0bea32..1e1dcaf3e55 100644 --- a/security/user_checkers.rst +++ b/security/user_checkers.rst @@ -40,7 +40,7 @@ displayed to the user:: } } - public function checkPostAuth(UserInterface $user): void + public function checkPostAuth(UserInterface $user, TokenInterface $token): void { if (!$user instanceof AppUser) { return; From aec2ec5ef61cca979c9d830a6fd22d6a64446ab4 Mon Sep 17 00:00:00 2001 From: Marcin Nowak Date: Fri, 26 Jul 2024 14:12:16 +0200 Subject: [PATCH 307/477] Added information about clock parameter in ArrayAdapter --- components/cache/adapters/array_cache_adapter.rst | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/components/cache/adapters/array_cache_adapter.rst b/components/cache/adapters/array_cache_adapter.rst index f903771e468..a6a72514361 100644 --- a/components/cache/adapters/array_cache_adapter.rst +++ b/components/cache/adapters/array_cache_adapter.rst @@ -24,5 +24,10 @@ method:: // the maximum number of items that can be stored in the cache. When the limit // is reached, cache follows the LRU model (least recently used items are deleted) - $maxItems = 0 + $maxItems = 0, + + // implementation of Psr\Clock\ClockInterface (e.g. Symfony\Component\Clock\Clock) + // or null. If clock is provided, cache items lifetime will be calculated + // based on time provided by this clock + $clock = null ); From 87acbbcce5954cd05f16824d8db91b42fe954318 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Fri, 26 Jul 2024 14:29:19 +0200 Subject: [PATCH 308/477] fix the syntax of PHP code blocks --- configuration/micro_kernel_trait.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configuration/micro_kernel_trait.rst b/configuration/micro_kernel_trait.rst index 23aa677cf20..c9739679f69 100644 --- a/configuration/micro_kernel_trait.rst +++ b/configuration/micro_kernel_trait.rst @@ -57,7 +57,7 @@ Next, create an ``index.php`` file that defines the kernel class and runs it: return static function (array $context) { return new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']); - } + }; .. code-block:: php @@ -98,7 +98,7 @@ Next, create an ``index.php`` file that defines the kernel class and runs it: return static function (array $context) { return new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']); - } + }; That's it! To test it, start the :doc:`Symfony Local Web Server `: From f1c8808ee481a65b1e10453e362b54b98c3ae4cc Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Fri, 26 Jul 2024 17:03:46 +0200 Subject: [PATCH 309/477] [Cache] Igbinary extension is no longer used by default when available --- components/cache.rst | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/components/cache.rst b/components/cache.rst index f5a76f2119d..939627b1807 100644 --- a/components/cache.rst +++ b/components/cache.rst @@ -208,16 +208,27 @@ Symfony uses *marshallers* (classes which implement the cache items before storing them. The :class:`Symfony\\Component\\Cache\\Marshaller\\DefaultMarshaller` uses PHP's -``serialize()`` or ``igbinary_serialize()`` if the `Igbinary extension`_ is installed. -There are other *marshallers* that can encrypt or compress the data before storing it:: +``serialize()`` function by default, but you can optionally use the ``igbinary_serialize()`` +function from the `Igbinary extension`_: use Symfony\Component\Cache\Adapter\RedisAdapter; use Symfony\Component\Cache\DefaultMarshaller; use Symfony\Component\Cache\DeflateMarshaller; $marshaller = new DeflateMarshaller(new DefaultMarshaller()); + // you can optionally use the Igbinary extension if you have it installed + // $marshaller = new DeflateMarshaller(new DefaultMarshaller(useIgbinarySerialize: true)); + $cache = new RedisAdapter(new \Redis(), 'namespace', 0, $marshaller); +There are other *marshallers* that can encrypt or compress the data before storing it. + +.. versionadded:: 7.2 + + In Symfony versions prior to 7.2, the ``igbinary_serialize()`` function was + used by default when the Igbinary extension was installed. Starting from + Symfony 7.2, you have to enable Igbinary support explicitly. + Advanced Usage -------------- From d2b384beacf7a749ffaf0e98b9f41315a95893a2 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Tue, 30 Jul 2024 16:38:51 +0200 Subject: [PATCH 310/477] fix typo --- performance.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/performance.rst b/performance.rst index 70a6602873e..828333f338b 100644 --- a/performance.rst +++ b/performance.rst @@ -367,7 +367,7 @@ method does, which stops an event and then restarts it immediately:: .. versionadded:: 7.2 - The ``getLastPeriod`` method was introduced in Symfony 7.2. + The ``getLastPeriod()`` method was introduced in Symfony 7.2. Profiling Sections .................. From e2d8f0a36494d6370e0c845a18a36a84f8329ea5 Mon Sep 17 00:00:00 2001 From: Jonas Claes Date: Thu, 1 Aug 2024 19:31:56 +0200 Subject: [PATCH 311/477] Update mailer.rst --- mailer.rst | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/mailer.rst b/mailer.rst index 502644a741a..11acd065e52 100644 --- a/mailer.rst +++ b/mailer.rst @@ -110,6 +110,7 @@ Service Install with Webhook su `MailPace`_ ``composer require symfony/mail-pace-mailer`` `MailerSend`_ ``composer require symfony/mailer-send-mailer`` `Mandrill`_ ``composer require symfony/mailchimp-mailer`` +`Postal`_ ``composer require symfony/postal-mailer`` `Postmark`_ ``composer require symfony/postmark-mailer`` yes `Resend`_ ``composer require symfony/resend-mailer`` yes `Scaleway`_ ``composer require symfony/scaleway-mailer`` @@ -122,7 +123,7 @@ Service Install with Webhook su .. versionadded:: 7.2 - The Mailomat integration was introduced in Symfony 7.2. + The Mailomat and Postal integrations were introduced in Symfony 7.2. .. note:: @@ -214,6 +215,10 @@ party provider: | | - HTTP n/a | | | - API ``mailpace+api://API_TOKEN@default`` | +------------------------+---------------------------------------------------------+ +| `Postal`_ | - SMTP n/a | +| | - HTTP n/a | +| | - API ``postal+api://API_KEY@BASE_URL`` | ++------------------------+---------------------------------------------------------+ | `Postmark`_ | - SMTP ``postmark+smtp://ID@default`` | | | - HTTP n/a | | | - API ``postmark+api://KEY@default`` | @@ -1992,6 +1997,7 @@ the :class:`Symfony\\Bundle\\FrameworkBundle\\Test\\MailerAssertionsTrait`:: .. _`MailPace`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Mailer/Bridge/MailPace/README.md .. _`OpenSSL PHP extension`: https://www.php.net/manual/en/book.openssl.php .. _`PEM encoded`: https://en.wikipedia.org/wiki/Privacy-Enhanced_Mail +.. _`Postal`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Mailer/Bridge/Postal/README.md .. _`Postmark`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Mailer/Bridge/Postmark/README.md .. _`Resend`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Mailer/Bridge/Resend/README.md .. _`RFC 3986`: https://www.ietf.org/rfc/rfc3986.txt From 4b3fad09b8894e9d61876e1fdd8752275fe57691 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Tue, 6 Aug 2024 17:44:01 +0200 Subject: [PATCH 312/477] Add the versionadded directive --- components/cache/adapters/array_cache_adapter.rst | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/components/cache/adapters/array_cache_adapter.rst b/components/cache/adapters/array_cache_adapter.rst index a6a72514361..08f8276db3d 100644 --- a/components/cache/adapters/array_cache_adapter.rst +++ b/components/cache/adapters/array_cache_adapter.rst @@ -26,8 +26,12 @@ method:: // is reached, cache follows the LRU model (least recently used items are deleted) $maxItems = 0, - // implementation of Psr\Clock\ClockInterface (e.g. Symfony\Component\Clock\Clock) - // or null. If clock is provided, cache items lifetime will be calculated - // based on time provided by this clock - $clock = null + // optional implementation of the Psr\Clock\ClockInterface that will be used + // to calculate the lifetime of cache items (for example to get predictable + // lifetimes in tests) + $clock = null, ); + +.. versionadded:: 7.2 + + The optional ``$clock`` argument was introduced in Symfony 7.2. From c7bf80275b6a65807642e860fc19af77ffd6c453 Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Wed, 7 Aug 2024 11:02:10 +0200 Subject: [PATCH 313/477] [Validator] Mention `Ulid::FORMAT_RFC4122` --- reference/constraints/Ulid.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/reference/constraints/Ulid.rst b/reference/constraints/Ulid.rst index 4ba5ec3a3f5..a5888409960 100644 --- a/reference/constraints/Ulid.rst +++ b/reference/constraints/Ulid.rst @@ -82,6 +82,7 @@ The format of the ULID to validate. The following formats are available: * ``Ulid::FORMAT_BASE_32``: The ULID is encoded in base32 (default) * ``Ulid::FORMAT_BASE_58``: The ULID is encoded in base58 +* ``Ulid::FORMAT_RFC4122``: The ULID is encoded in the RFC 4122 format .. versionadded:: 7.2 From 9381f4be9bf1149ab63d850b84d678e2e1df6869 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 7 Aug 2024 14:20:31 +0200 Subject: [PATCH 314/477] [Validator] Add links to Ulid constraint formats --- reference/constraints/Ulid.rst | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/reference/constraints/Ulid.rst b/reference/constraints/Ulid.rst index a5888409960..4094bab98f5 100644 --- a/reference/constraints/Ulid.rst +++ b/reference/constraints/Ulid.rst @@ -80,9 +80,9 @@ Options The format of the ULID to validate. The following formats are available: -* ``Ulid::FORMAT_BASE_32``: The ULID is encoded in base32 (default) -* ``Ulid::FORMAT_BASE_58``: The ULID is encoded in base58 -* ``Ulid::FORMAT_RFC4122``: The ULID is encoded in the RFC 4122 format +* ``Ulid::FORMAT_BASE_32``: The ULID is encoded in `base32`_ (default) +* ``Ulid::FORMAT_BASE_58``: The ULID is encoded in `base58`_ +* ``Ulid::FORMAT_RFC4122``: The ULID is encoded in the `RFC 4122 format`_ .. versionadded:: 7.2 @@ -111,3 +111,6 @@ Parameter Description .. include:: /reference/constraints/_payload-option.rst.inc .. _`Universally Unique Lexicographically Sortable Identifier (ULID)`: https://github.com/ulid/spec +.. _`base32`: https://en.wikipedia.org/wiki/Base32 +.. _`base58`: https://en.wikipedia.org/wiki/Binary-to-text_encoding#Base58 +.. _`RFC 4122 format`: https://datatracker.ietf.org/doc/html/rfc4122 From ce138921bd92a98340ed20ba16b6ebe0520d3ef4 Mon Sep 17 00:00:00 2001 From: Philippe Chabbert Date: Thu, 8 Aug 2024 11:42:42 +0200 Subject: [PATCH 315/477] doc: add missing use statements --- configuration/multiple_kernels.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/configuration/multiple_kernels.rst b/configuration/multiple_kernels.rst index 4cef8b0d09e..512ea57f24d 100644 --- a/configuration/multiple_kernels.rst +++ b/configuration/multiple_kernels.rst @@ -117,7 +117,9 @@ resources:: // src/Kernel.php namespace Shared; + use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait; use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; + use Symfony\Component\HttpKernel\Kernel as BaseKernel; use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator; class Kernel extends BaseKernel @@ -258,6 +260,7 @@ the application ID to run under CLI context:: // bin/console use Shared\Kernel; + use Symfony\Bundle\FrameworkBundle\Console\Application; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; From ed5124230a9e8bdacad8c9ab7459f0e2785e281a Mon Sep 17 00:00:00 2001 From: n-valverde <64469669+n-valverde@users.noreply.github.com> Date: Sat, 17 Feb 2024 10:52:22 +0100 Subject: [PATCH 316/477] Update service_container.rst --- service_container.rst | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/service_container.rst b/service_container.rst index 569f549990b..1afc59189ed 100644 --- a/service_container.rst +++ b/service_container.rst @@ -1035,20 +1035,25 @@ to them. Linting Service Definitions --------------------------- -The ``lint:container`` command checks that the arguments injected into services -match their type declarations. It's useful to run it before deploying your -application to production (e.g. in your continuous integration server): +The ``lint:container`` command performs some additional checks to make sure +the container is properly configured: +* ensures the arguments injected into services match their type declarations. +* ensures the interfaces configured as alias are resolving to a compatible +service. +It's useful to run it before deploying your application to production +(e.g. in your continuous integration server): .. code-block:: terminal $ php bin/console lint:container -Checking the types of all service arguments whenever the container is compiled -can hurt performance. That's why this type checking is implemented in a -:doc:`compiler pass ` called -``CheckTypeDeclarationsPass`` which is disabled by default and enabled only when -executing the ``lint:container`` command. If you don't mind the performance -loss, enable the compiler pass in your application. +Doing those checks whenever the container is compiled +can hurt performance. That's why this is implemented in +:doc:`compiler passes ` called +``CheckTypeDeclarationsPass`` and ``CheckAliasValidityPass`` which are disabled +by default and enabled only when executing the ``lint:container`` command. +If you don't mind the performance loss, enable these compiler passes in +your application. .. _container-public: From e2a15ae1c200ad097f9fb246c0eda5ade815304d Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Fri, 9 Aug 2024 16:39:28 +0200 Subject: [PATCH 317/477] Minor tweaks --- service_container.rst | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/service_container.rst b/service_container.rst index aa7868cfdd7..b5d3f8c5b99 100644 --- a/service_container.rst +++ b/service_container.rst @@ -1035,26 +1035,25 @@ to them. Linting Service Definitions --------------------------- -The ``lint:container`` command performs some additional checks to make sure -the container is properly configured: -* ensures the arguments injected into services match their type declarations. -* ensures the interfaces configured as alias are resolving to a compatible -service. -It's useful to run it before deploying your application to production -(e.g. in your continuous integration server): +The ``lint:container`` command performs additional checks to ensure the container +is properly configured. It is useful to run this command before deploying your +application to production (e.g. in your continuous integration server): .. code-block:: terminal $ php bin/console lint:container -Doing those checks whenever the container is compiled -can hurt performance. That's why this is implemented in -:doc:`compiler passes ` called -``CheckTypeDeclarationsPass`` and ``CheckAliasValidityPass`` which are disabled -by default and enabled only when executing the ``lint:container`` command. -If you don't mind the performance loss, enable these compiler passes in +Performing those checks whenever the container is compiled can hurt performance. +That's why they are implemented in :doc:`compiler passes ` +called ``CheckTypeDeclarationsPass`` and ``CheckAliasValidityPass``, which are +disabled by default and enabled only when executing the ``lint:container`` command. +If you don't mind the performance loss, you can enable these compiler passes in your application. +.. versionadded:: 7.1 + + The ``CheckAliasValidityPass`` compiler pass was introduced in Symfony 7.1. + .. _container-public: Public Versus Private Services From 323391d8876b561f1fa12d12c86c59cf75512c89 Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Tue, 13 Aug 2024 10:21:05 +0200 Subject: [PATCH 318/477] [Validator] Add `Week` constraint --- reference/constraints/Week.rst | 172 ++++++++++++++++++++++++++++++ reference/constraints/map.rst.inc | 1 + 2 files changed, 173 insertions(+) create mode 100644 reference/constraints/Week.rst diff --git a/reference/constraints/Week.rst b/reference/constraints/Week.rst new file mode 100644 index 00000000000..0aea71bee02 --- /dev/null +++ b/reference/constraints/Week.rst @@ -0,0 +1,172 @@ +Week +==== + +.. versionadded:: 7.2 + + The ``Week`` constraint was introduced in Symfony 7.2. + +Validates that a string (or an object implementing the ``Stringable`` PHP interface) +matches a given week number. The week number format is defined by `ISO-8601`_ +and should be composed of the year and the week number, separated by a hyphen +(e.g. ``2022-W01``). + +========== ======================================================================= +Applies to :ref:`property or method ` +Class :class:`Symfony\\Component\\Validator\\Constraints\\Week` +Validator :class:`Symfony\\Component\\Validator\\Constraints\\WeekValidator` +========== ======================================================================= + +Basic Usage +----------- + +If you wanted to ensure that the ``startWeek`` property of an ``OnlineCourse`` +class is between the first and the twentieth week of the year 2022, you could do +the following: + +.. configuration-block:: + + .. code-block:: php-attributes + + // src/Entity/OnlineCourse.php + namespace App\Entity; + + use Symfony\Component\Validator\Constraints as Assert; + + class OnlineCourse + { + #[Assert\Week(min: '2022-W01', max: '2022-W20')] + protected string $startWeek; + } + + .. code-block:: yaml + + # config/validator/validation.yaml + App\Entity\OnlineCourse: + properties: + startWeek: + - Week: + min: '2022-W01' + max: '2022-W20' + + .. code-block:: xml + + + + + + + + + + + + + + + + .. code-block:: php + + // src/Entity/OnlineCourse.php + namespace App\Entity; + + use Symfony\Component\Validator\Constraints as Assert; + use Symfony\Component\Validator\Mapping\ClassMetadata; + + class OnlineCourse + { + // ... + + public static function loadValidatorMetadata(ClassMetadata $metadata): void + { + $metadata->addPropertyConstraint('startWeek', new Assert\Week([ + 'min' => '2022-W01', + 'max' => '2022-W20', + ])); + } + } + +.. note:: + + The constraint also checks that the given week exists in the calendar. For example, + ``2022-W53`` is not a valid week number for 2022, because 2022 only had 52 weeks. + +Options +------- + +``min`` +~~~~~~~ + +**type**: ``string`` **default**: ``null`` + +The minimum week number that the value must match. + +``max`` +~~~~~~~ + +**type**: ``string`` **default**: ``null`` + +The maximum week number that the value must match. + +.. include:: /reference/constraints/_groups-option.rst.inc + +``invalidFormatMessage`` +~~~~~~~~~~~~~~~~~~~~~~~~ + +**type**: ``string`` **default**: ``This value does not represent a valid week in the ISO 8601 format.`` + +This is the message that will be shown if the value does not match the ISO 8601 +week format. + +``invalidWeekNumberMessage`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**type**: ``string`` **default**: ``The week "{{ value }}" is not a valid week.`` + +This is the message that will be shown if the value does not match a valid week +number. + +You can use the following parameters in this message: + +================ ================================================== +Parameter Description +================ ================================================== +``{{ value }}`` The value that was passed to the constraint +================ ================================================== + +``tooLowMessage`` +~~~~~~~~~~~~~~~~~ + +**type**: ``string`` **default**: ``The value should not be before week "{{ min }}".`` + +This is the message that will be shown if the value is lower than the minimum +week number. + +You can use the following parameters in this message: + +================ ================================================== +Parameter Description +================ ================================================== +``{{ min }}`` The minimum week number +================ ================================================== + +``tooHighMessage`` +~~~~~~~~~~~~~~~~~~ + +**type**: ``string`` **default**: ``The value should not be after week "{{ max }}".`` + +This is the message that will be shown if the value is higher than the maximum +week number. + +You can use the following parameters in this message: + +================ ================================================== +Parameter Description +================ ================================================== +``{{ max }}`` The maximum week number +================ ================================================== + +.. include:: /reference/constraints/_payload-option.rst.inc + +.. _ISO-8601: https://en.wikipedia.org/wiki/ISO_8601 diff --git a/reference/constraints/map.rst.inc b/reference/constraints/map.rst.inc index 978951c9de7..e0dbd6c4512 100644 --- a/reference/constraints/map.rst.inc +++ b/reference/constraints/map.rst.inc @@ -64,6 +64,7 @@ Date Constraints * :doc:`DateTime ` * :doc:`Time ` * :doc:`Timezone ` +* :doc:`Week ` Choice Constraints ~~~~~~~~~~~~~~~~~~ From 8d5b1d357df87484858a2902baf6cd0d2e8b59dd Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Mon, 19 Aug 2024 10:48:33 +0200 Subject: [PATCH 319/477] [Uid] Add support for binary, base-32 and base-58 representations in `Uuid::isValid()` --- components/uid.rst | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/components/uid.rst b/components/uid.rst index 7195d393ed3..feb58968347 100644 --- a/components/uid.rst +++ b/components/uid.rst @@ -314,6 +314,30 @@ UUID objects created with the ``Uuid`` class can use the following methods // * int < 0 if $uuid1 is less than $uuid4 $uuid1->compare($uuid4); // e.g. int(4) +If you're working with different UUIDs format and want to validate them, +you can use the ``$format`` parameter of the :method:`Symfony\\Component\\Uid\\Uuid::isValid` +method to specify the UUID format you're expecting:: + + use Symfony\Component\Uid\Uuid; + + $isValid = Uuid::isValid('90067ce4-f083-47d2-a0f4-c47359de0f97', Uuid::FORMAT_RFC_4122); // accept only RFC 4122 UUIDs + $isValid = Uuid::isValid('3aJ7CNpDMfXPZrCsn4Cgey', Uuid::FORMAT_BASE_32 | Uuid::FORMAT_BASE_58); // accept multiple formats + +The following constants are available: + +* ``Uuid::FORMAT_BINARY`` +* ``Uuid::FORMAT_BASE_32`` +* ``Uuid::FORMAT_BASE_58`` +* ``Uuid::FORMAT_RFC_4122`` + +You can also use the ``Uuid::FORMAT_ALL`` constant to accept any UUID format. +By default, only the RFC 4122 format is accepted. + +.. versionadded:: 7.2 + + The ``$format`` parameter of the :method:`Symfony\\Component\\Uid\\Uuid::isValid` + method and the related constants were introduced in Symfony 7.2. + Storing UUIDs in Databases ~~~~~~~~~~~~~~~~~~~~~~~~~~ From 3567f5b79a01bd878143a3016bc224559f5c4ec4 Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Mon, 19 Aug 2024 10:58:42 +0200 Subject: [PATCH 320/477] [Serializer] Deprecate passing a non-empty CSV escape char --- components/serializer.rst | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/components/serializer.rst b/components/serializer.rst index 09efbf44e6c..61124e3f030 100644 --- a/components/serializer.rst +++ b/components/serializer.rst @@ -1064,30 +1064,35 @@ which defines the configuration options for the CsvEncoder an associative array: These are the options available: -======================= ===================================================== ========================== -Option Description Default -======================= ===================================================== ========================== -``csv_delimiter`` Sets the field delimiter separating values (one ``,`` +======================= ============================================================= ========================== +Option Description Default +======================= ============================================================= ========================== +``csv_delimiter`` Sets the field delimiter separating values (one ``,`` character only) -``csv_enclosure`` Sets the field enclosure (one character only) ``"`` -``csv_end_of_line`` Sets the character(s) used to mark the end of each ``\n`` +``csv_enclosure`` Sets the field enclosure (one character only) ``"`` +``csv_end_of_line`` Sets the character(s) used to mark the end of each ``\n`` line in the CSV file -``csv_escape_char`` Sets the escape character (at most one character) empty string -``csv_key_separator`` Sets the separator for array's keys during its ``.`` +``csv_escape_char`` Deprecated. Sets the escape character (at most one character) empty string +``csv_key_separator`` Sets the separator for array's keys during its ``.`` flattening ``csv_headers`` Sets the order of the header and data columns E.g.: if ``$data = ['c' => 3, 'a' => 1, 'b' => 2]`` and ``$options = ['csv_headers' => ['a', 'b', 'c']]`` then ``serialize($data, 'csv', $options)`` returns - ``a,b,c\n1,2,3`` ``[]``, inferred from input data's keys -``csv_escape_formulas`` Escapes fields containing formulas by prepending them ``false`` + ``a,b,c\n1,2,3`` ``[]``, inferred from input data's keys +``csv_escape_formulas`` Escapes fields containing formulas by prepending them ``false`` with a ``\t`` character -``as_collection`` Always returns results as a collection, even if only ``true`` +``as_collection`` Always returns results as a collection, even if only ``true`` one line is decoded. -``no_headers`` Setting to ``false`` will use first row as headers. ``false`` +``no_headers`` Setting to ``false`` will use first row as headers. ``false`` ``true`` generate numeric headers. -``output_utf8_bom`` Outputs special `UTF-8 BOM`_ along with encoded data ``false`` -======================= ===================================================== ========================== +``output_utf8_bom`` Outputs special `UTF-8 BOM`_ along with encoded data ``false`` +======================= ============================================================= ========================== + +.. deprecated:: 7.2 + + The ``csv_escape_char`` option and the ``CsvEncoder::ESCAPE_CHAR_KEY`` + constant were deprecated in Symfony 7.2. The ``XmlEncoder`` ~~~~~~~~~~~~~~~~~~ @@ -1304,6 +1309,11 @@ you can use "context builders" to define the context using a fluent interface:: You can also :doc:`create custom context builders ` to deal with your context values. +.. deprecated:: 7.2 + + The ``CsvEncoderContextBuilder::withEscapeChar()`` method was deprecated + in Symfony 7.2. + Skipping ``null`` Values ------------------------ From f39be7640c72c575da3320aa01ff3e7cca466660 Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Mon, 19 Aug 2024 11:06:42 +0200 Subject: [PATCH 321/477] [FrameworkBundle][HttpFoundation] Deprecate `session.sid_length` and `session.sid_bits_per_character` config options --- reference/configuration/framework.rst | 8 ++++++++ session.rst | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/reference/configuration/framework.rst b/reference/configuration/framework.rst index 0921fe9ac2e..72c4b1b94f7 100644 --- a/reference/configuration/framework.rst +++ b/reference/configuration/framework.rst @@ -1874,6 +1874,10 @@ session IDs are harder to guess. If not set, ``php.ini``'s `session.sid_length`_ directive will be relied on. +.. deprecated:: 7.2 + + The ``sid_length`` option was deprecated in Symfony 7.2. + sid_bits_per_character ...................... @@ -1886,6 +1890,10 @@ most environments. If not set, ``php.ini``'s `session.sid_bits_per_character`_ directive will be relied on. +.. deprecated:: 7.2 + + The ``sid_bits_per_character`` option was deprecated in Symfony 7.2. + save_path ......... diff --git a/session.rst b/session.rst index 29d1ba364d1..77aea3bba00 100644 --- a/session.rst +++ b/session.rst @@ -400,6 +400,11 @@ Check out the Symfony config reference to learn more about the other available ``session.auto_start = 1`` This directive should be turned off in ``php.ini``, in the web server directives or in ``.htaccess``. +.. deprecated:: 7.2 + + The ``sid_length`` and ``sid_bits_per_character`` options were deprecated + in Symfony 7.2 and will be ignored in Symfony 8.0. + The session cookie is also available in :ref:`the Response object `. This is useful to get that cookie in the CLI context or when using PHP runners like Roadrunner or Swoole. From 51fdaa869c908061f2fc355442a219c57bfc2f0a Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Tue, 20 Aug 2024 09:19:34 +0200 Subject: [PATCH 322/477] document the requests constructor argument of the RequestStack class --- components/form.rst | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/components/form.rst b/components/form.rst index 7584d223032..f463ef5911b 100644 --- a/components/form.rst +++ b/components/form.rst @@ -123,8 +123,7 @@ The following snippet adds CSRF protection to the form factory:: use Symfony\Component\Security\Csrf\TokenStorage\SessionTokenStorage; // creates a RequestStack object using the current request - $requestStack = new RequestStack(); - $requestStack->push($request); + $requestStack = new RequestStack([$request]); $csrfGenerator = new UriSafeTokenGenerator(); $csrfStorage = new SessionTokenStorage($requestStack); @@ -135,6 +134,11 @@ The following snippet adds CSRF protection to the form factory:: ->addExtension(new CsrfExtension($csrfManager)) ->getFormFactory(); +.. versionadded:: 7.2 + + Support for passing requests to the constructor of the ``RequestStack`` + class was introduced in Symfony 7.2. + Internally, this extension will automatically add a hidden field to every form (called ``_token`` by default) whose value is automatically generated by the CSRF generator and validated when binding the form. From bad2a212bf68bdfc6479765d2ecb4123677aee4e Mon Sep 17 00:00:00 2001 From: Mathieu Santostefano Date: Tue, 20 Aug 2024 12:01:07 +0200 Subject: [PATCH 323/477] feat(mailer): Add Sweego Mailer doc --- mailer.rst | 8 +++++++- webhook.rst | 3 ++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/mailer.rst b/mailer.rst index 11acd065e52..091e6d6e5b9 100644 --- a/mailer.rst +++ b/mailer.rst @@ -115,6 +115,7 @@ Service Install with Webhook su `Resend`_ ``composer require symfony/resend-mailer`` yes `Scaleway`_ ``composer require symfony/scaleway-mailer`` `SendGrid`_ ``composer require symfony/sendgrid-mailer`` yes +`Sweego`_ ``composer require symfony/sweego-mailer`` yes ===================== =============================================== =============== .. versionadded:: 7.1 @@ -123,7 +124,7 @@ Service Install with Webhook su .. versionadded:: 7.2 - The Mailomat and Postal integrations were introduced in Symfony 7.2. + The Mailomat, Postal and Sweego integrations were introduced in Symfony 7.2. .. note:: @@ -235,6 +236,10 @@ party provider: | | - HTTP n/a | | | - API ``sendgrid+api://KEY@default`` | +------------------------+---------------------------------------------------------+ +| `Sweego`_ | - SMTP ``sweego+smtp://LOGIN:PASSWORD@HOST:PORT`` | +| | - HTTP n/a | +| | - API ``sweego+api://API_KEY@default`` | ++------------------------+---------------------------------------------------------+ .. caution:: @@ -2004,3 +2009,4 @@ the :class:`Symfony\\Bundle\\FrameworkBundle\\Test\\MailerAssertionsTrait`:: .. _`S/MIME`: https://en.wikipedia.org/wiki/S/MIME .. _`Scaleway`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Mailer/Bridge/Scaleway/README.md .. _`SendGrid`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Mailer/Bridge/Sendgrid/README.md +.. _`Sweego`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Mailer/Bridge/Sweego/README.md diff --git a/webhook.rst b/webhook.rst index 52633ae83e5..176abc49cd2 100644 --- a/webhook.rst +++ b/webhook.rst @@ -31,6 +31,7 @@ Mailomat ``mailer.webhook.request_parser.mailomat`` Postmark ``mailer.webhook.request_parser.postmark`` Resend ``mailer.webhook.request_parser.resend`` Sendgrid ``mailer.webhook.request_parser.sendgrid`` +Sweego ``mailer.webhook.request_parser.sweego`` ============== ============================================ .. versionadded:: 7.1 @@ -39,7 +40,7 @@ Sendgrid ``mailer.webhook.request_parser.sendgrid`` .. versionadded:: 7.2 - The ``Mailomat`` integration was introduced in Symfony 7.2. + The ``Mailomat`` and ``Sweego`` integrations were introduced in Symfony 7.2. .. note:: From 84da11cd0affbf26ba61eaaa02015f1b0c85854e Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Tue, 20 Aug 2024 14:46:44 +0200 Subject: [PATCH 324/477] [HttpFoundation] Add new parameters to `IpUtils::anonymize()` --- components/http_foundation.rst | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/components/http_foundation.rst b/components/http_foundation.rst index 6c9210b894f..2cdd5a02702 100644 --- a/components/http_foundation.rst +++ b/components/http_foundation.rst @@ -362,6 +362,23 @@ analysis purposes. Use the ``anonymize()`` method from the $anonymousIpv6 = IpUtils::anonymize($ipv6); // $anonymousIpv6 = '2a01:198:603:10::' +If you need even more anonymization, you can use the second and third parameters +of the ``anonymize()`` method to specify the number of bytes that should be +anonymized depending on the IP address format:: + + $ipv4 = '123.234.235.236'; + $anonymousIpv4 = IpUtils::anonymize($ipv4, v4Bytes: 3); + // $anonymousIpv4 = '123.0.0.0' + + $ipv6 = '2a01:198:603:10:396e:4789:8e99:890f'; + $anonymousIpv6 = IpUtils::anonymize($ipv6, v6Bytes: 10); + // $anonymousIpv6 = '2a01:198:603::' + +.. versionadded:: 7.2 + + The ``v4Bytes`` and ``v6Bytes`` parameters of the ``anonymize()`` method + were introduced in Symfony 7.2. + Check If an IP Belongs to a CIDR Subnet ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ From d00645a6062158478477d9df5324d90bae3b6502 Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Thu, 22 Aug 2024 09:45:19 +0200 Subject: [PATCH 325/477] [Form] Add support for the `calendar` option in `DateType` --- reference/forms/types/date.rst | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/reference/forms/types/date.rst b/reference/forms/types/date.rst index 515c12099a1..f9c6d67a70d 100644 --- a/reference/forms/types/date.rst +++ b/reference/forms/types/date.rst @@ -155,6 +155,19 @@ values for the year, month and day fields:: .. include:: /reference/forms/types/options/view_timezone.rst.inc +``calendar`` +~~~~~~~~~~~~ + +**type**: ``\IntlCalendar`` **default**: ``null`` + +The calendar to use for formatting and parsing the date. The value should be +an instance of the :phpclass:`IntlCalendar` to use. By default, the Gregorian +calendar with the application default locale is used. + +.. versionadded:: 7.2 + + The ``calendar`` option was introduced in Symfony 7.2. + .. include:: /reference/forms/types/options/date_widget.rst.inc .. include:: /reference/forms/types/options/years.rst.inc From 429e193a40e93a3e521479aa1cc404c0b84c9df1 Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Fri, 23 Aug 2024 09:30:27 +0200 Subject: [PATCH 326/477] [ExpressionLanguage] Add support for `<<`, `>>`, and `~` bitwise operators --- reference/formats/expression_language.rst | 72 +++++++++++++---------- 1 file changed, 40 insertions(+), 32 deletions(-) diff --git a/reference/formats/expression_language.rst b/reference/formats/expression_language.rst index e88ac7f6c24..ec592461a4f 100644 --- a/reference/formats/expression_language.rst +++ b/reference/formats/expression_language.rst @@ -284,6 +284,14 @@ Bitwise Operators * ``&`` (and) * ``|`` (or) * ``^`` (xor) +* ``~`` (not) +* ``<<`` (left shift) +* ``>>`` (right shift) + +.. versionadded:: 7.2 + + Support for the ``~``, ``<<`` and ``>>`` bitwise operators was introduced + in Symfony 7.2. Comparison Operators ~~~~~~~~~~~~~~~~~~~~ @@ -449,38 +457,38 @@ parentheses in your expressions (e.g. ``(1 + 2) * 4`` or ``1 + (2 * 4)``. The following table summarizes the operators and their associativity from the **highest to the lowest precedence**: -+----------------------------------------------------------+---------------+ -| Operators | Associativity | -+==========================================================+===============+ -| ``-`` , ``+`` (unary operators that add the number sign) | none | -+----------------------------------------------------------+---------------+ -| ``**`` | right | -+----------------------------------------------------------+---------------+ -| ``*``, ``/``, ``%`` | left | -+----------------------------------------------------------+---------------+ -| ``not``, ``!`` | none | -+----------------------------------------------------------+---------------+ -| ``~`` | left | -+----------------------------------------------------------+---------------+ -| ``+``, ``-`` | left | -+----------------------------------------------------------+---------------+ -| ``..`` | left | -+----------------------------------------------------------+---------------+ -| ``==``, ``===``, ``!=``, ``!==``, | left | -| ``<``, ``>``, ``>=``, ``<=``, | | -| ``not in``, ``in``, ``contains``, | | -| ``starts with``, ``ends with``, ``matches`` | | -+----------------------------------------------------------+---------------+ -| ``&`` | left | -+----------------------------------------------------------+---------------+ -| ``^`` | left | -+----------------------------------------------------------+---------------+ -| ``|`` | left | -+----------------------------------------------------------+---------------+ -| ``and``, ``&&`` | left | -+----------------------------------------------------------+---------------+ -| ``or``, ``||`` | left | -+----------------------------------------------------------+---------------+ ++-----------------------------------------------------------------+---------------+ +| Operators | Associativity | ++=================================================================+===============+ +| ``-`` , ``+``, ``~`` (unary operators that add the number sign) | none | ++-----------------------------------------------------------------+---------------+ +| ``**`` | right | ++-----------------------------------------------------------------+---------------+ +| ``*``, ``/``, ``%`` | left | ++-----------------------------------------------------------------+---------------+ +| ``not``, ``!`` | none | ++-----------------------------------------------------------------+---------------+ +| ``~`` | left | ++-----------------------------------------------------------------+---------------+ +| ``+``, ``-`` | left | ++-----------------------------------------------------------------+---------------+ +| ``..``, ``<<``, ``>>`` | left | ++-----------------------------------------------------------------+---------------+ +| ``==``, ``===``, ``!=``, ``!==``, | left | +| ``<``, ``>``, ``>=``, ``<=``, | | +| ``not in``, ``in``, ``contains``, | | +| ``starts with``, ``ends with``, ``matches`` | | ++-----------------------------------------------------------------+---------------+ +| ``&`` | left | ++-----------------------------------------------------------------+---------------+ +| ``^`` | left | ++-----------------------------------------------------------------+---------------+ +| ``|`` | left | ++-----------------------------------------------------------------+---------------+ +| ``and``, ``&&`` | left | ++-----------------------------------------------------------------+---------------+ +| ``or``, ``||`` | left | ++-----------------------------------------------------------------+---------------+ Built-in Objects and Variables ------------------------------ From d883d5659dab11da2ad39be9a380551f74682e38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Andr=C3=A9?= Date: Fri, 23 Aug 2024 00:39:01 +0200 Subject: [PATCH 327/477] [Templating] [Template] Render a block with the `#[Template]` attribute --- templates.rst | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/templates.rst b/templates.rst index 795ac3a7ac3..1af3de56c5b 100644 --- a/templates.rst +++ b/templates.rst @@ -632,6 +632,31 @@ This might come handy when dealing with blocks in :ref:`templates inheritance ` or when using `Turbo Streams`_. +Similarly, you can use the ``#[Template]`` attribute on the controller to specify a block +to render:: + + // src/Controller/ProductController.php + namespace App\Controller; + + use Symfony\Bridge\Twig\Attribute\Template; + use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; + use Symfony\Component\HttpFoundation\Response; + + class ProductController extends AbstractController + { + #[Template('product.html.twig', block: 'price_block')] + public function price(): array + { + return [ + // ... + ]; + } + } + +.. versionadded:: 7.2 + + The ``#[Template]`` attribute's ``block`` argument was introduced in Symfony 7.2. + Rendering a Template in Services ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ From d158b5544cb173ea520724e56df2a1ba1c8c84c0 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Mon, 26 Aug 2024 09:19:25 +0200 Subject: [PATCH 328/477] Minor tweak --- templates.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates.rst b/templates.rst index 1af3de56c5b..2379a3568dc 100644 --- a/templates.rst +++ b/templates.rst @@ -632,8 +632,8 @@ This might come handy when dealing with blocks in :ref:`templates inheritance ` or when using `Turbo Streams`_. -Similarly, you can use the ``#[Template]`` attribute on the controller to specify a block -to render:: +Similarly, you can use the ``#[Template]`` attribute on the controller to specify +a block to render:: // src/Controller/ProductController.php namespace App\Controller; From bec9e5faa881623aa75a03a78212315f44799a43 Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Thu, 22 Aug 2024 14:16:06 +0200 Subject: [PATCH 329/477] [Validator] Add `CompoundConstraintTestCase` to ease testing Compound Constraints --- validation/custom_constraint.rst | 74 ++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) diff --git a/validation/custom_constraint.rst b/validation/custom_constraint.rst index 9f0ca4ca07b..4504ceb4012 100644 --- a/validation/custom_constraint.rst +++ b/validation/custom_constraint.rst @@ -502,6 +502,9 @@ A class constraint validator must be applied to the class itself: Testing Custom Constraints -------------------------- +Atomic Constraints +~~~~~~~~~~~~~~~~~~ + Use the :class:`Symfony\\Component\\Validator\\Test\\ConstraintValidatorTestCase` class to simplify writing unit tests for your custom constraints:: @@ -545,3 +548,74 @@ class to simplify writing unit tests for your custom constraints:: // ... } } + +Compound Constraints +~~~~~~~~~~~~~~~~~~~~ + +Let's say you create a compound constraint that checks if a string meets +your minimum requirements for your password policy:: + + // src/Validator/PasswordRequirements.php + namespace App\Validator; + + use Symfony\Component\Validator\Constraints as Assert; + + #[\Attribute] + class PasswordRequirements extends Assert\Compound + { + protected function getConstraints(array $options): array + { + return [ + new Assert\NotBlank(allowNull: false), + new Assert\Length(min: 8, max: 255), + new Assert\NotCompromisedPassword(), + new Assert\Type('string'), + new Assert\Regex('/[A-Z]+/'), + ]; + } + } + +You can use the :class:`Symfony\\Component\\Validator\\Test\\CompoundConstraintTestCase` +class to check precisely which of the constraints failed to pass:: + + // tests/Validator/PasswordRequirementsTest.php + namespace App\Tests\Validator; + + use App\Validator\PasswordRequirements; + use Symfony\Component\Validator\Constraints as Assert; + use Symfony\Component\Validator\Test\CompoundConstraintTestCase; + + /** + * @extends CompoundConstraintTestCase + */ + class PasswordRequirementsTest extends CompoundConstraintTestCase + { + public function createCompound(): Assert\Compound + { + return new PasswordRequirements(); + } + + public function testInvalidPassword(): void + { + $this->validateValue('azerty123'); + + // check all constraints pass except for the + // password leak and the uppercase letter checks + $this->assertViolationsRaisedByCompound([ + new Assert\NotCompromisedPassword(), + new Assert\Regex('/[A-Z]+/'), + ]); + } + + public function testValid(): void + { + $this->validateValue('VERYSTR0NGP4$$WORD#%!'); + + $this->assertNoViolation(); + } + } + +.. versionadded:: 7.2 + + The :class:`Symfony\\Component\\Validator\\Test\\CompoundConstraintTestCase` + class was introduced in Symfony 7.2. From 3f0fdbad1f95f056c576e2d34f1576c4fe27c720 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Mon, 26 Aug 2024 10:21:56 +0200 Subject: [PATCH 330/477] Tweaks --- reference/constraints/Week.rst | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/reference/constraints/Week.rst b/reference/constraints/Week.rst index 0aea71bee02..26d82777636 100644 --- a/reference/constraints/Week.rst +++ b/reference/constraints/Week.rst @@ -5,10 +5,9 @@ Week The ``Week`` constraint was introduced in Symfony 7.2. -Validates that a string (or an object implementing the ``Stringable`` PHP interface) -matches a given week number. The week number format is defined by `ISO-8601`_ -and should be composed of the year and the week number, separated by a hyphen -(e.g. ``2022-W01``). +Validates that a given string (or an object implementing the ``Stringable`` PHP +interface) represents a valid week number according to the `ISO-8601`_ standard +(e.g. ``2025-W01``). ========== ======================================================================= Applies to :ref:`property or method ` @@ -87,10 +86,11 @@ the following: } } -.. note:: - - The constraint also checks that the given week exists in the calendar. For example, - ``2022-W53`` is not a valid week number for 2022, because 2022 only had 52 weeks. +This constraint not only checks that the value matches the week number pattern, +but it also verifies that the specified week actually exists in the calendar. +According to the ISO-8601 standard, years can have either 52 or 53 weeks. For example, +``2022-W53`` is not a valid because 2022 only had 52 weeks; but ``2020-W53`` is +valid because 2020 had 53 weeks. Options ------- @@ -169,4 +169,4 @@ Parameter Description .. include:: /reference/constraints/_payload-option.rst.inc -.. _ISO-8601: https://en.wikipedia.org/wiki/ISO_8601 +.. _`ISO-8601`: https://en.wikipedia.org/wiki/ISO_8601 From 34d159469bd81267e3ae9cfe8d2b65993fd148f1 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Mon, 26 Aug 2024 10:57:07 +0200 Subject: [PATCH 331/477] Minor tweak --- validation/custom_constraint.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/validation/custom_constraint.rst b/validation/custom_constraint.rst index 4504ceb4012..435b976d1d3 100644 --- a/validation/custom_constraint.rst +++ b/validation/custom_constraint.rst @@ -552,8 +552,8 @@ class to simplify writing unit tests for your custom constraints:: Compound Constraints ~~~~~~~~~~~~~~~~~~~~ -Let's say you create a compound constraint that checks if a string meets -your minimum requirements for your password policy:: +Consider the following compound constraint that checks if a string meets +the minimum requirements for your password policy:: // src/Validator/PasswordRequirements.php namespace App\Validator; From 41f17860c70df6743740b8c5a0aff21606cee7ac Mon Sep 17 00:00:00 2001 From: eltharin Date: Thu, 15 Aug 2024 15:21:16 +0200 Subject: [PATCH 332/477] [Scheduler] Add capability to skip missed periodic tasks, only the last schedule will be called --- scheduler.rst | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/scheduler.rst b/scheduler.rst index c890b1a1aec..be4f2ca138d 100644 --- a/scheduler.rst +++ b/scheduler.rst @@ -889,6 +889,27 @@ This allows the system to retain the state of the schedule, ensuring that when a } } +With ``stateful`` option, All missed messages will be handled, If you nedd handle your message only once you can use the ``processOnlyLastMissedRun`` option.:: + + // src/Scheduler/SaleTaskProvider.php + namespace App\Scheduler; + + #[AsSchedule('uptoyou')] + class SaleTaskProvider implements ScheduleProviderInterface + { + public function getSchedule(): Schedule + { + $this->removeOldReports = RecurringMessage::cron('3 8 * * 1', new CleanUpOldSalesReport()); + + return $this->schedule ??= (new Schedule()) + ->with( + // ... + ) + ->stateful($this->cache) + ->processOnlyLastMissedRun(true) + } + } + To scale your schedules more effectively, you can use multiple workers. In such cases, a good practice is to add a :doc:`lock ` to prevent the same task more than once:: From 0f91311c8572b58c69097b901c7d76cf03ac993a Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Mon, 26 Aug 2024 12:50:13 +0200 Subject: [PATCH 333/477] Minor tweaks --- scheduler.rst | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/scheduler.rst b/scheduler.rst index be4f2ca138d..081f4efd498 100644 --- a/scheduler.rst +++ b/scheduler.rst @@ -869,7 +869,8 @@ While this behavior may not necessarily pose a problem, there is a possibility t That's why the scheduler allows to remember the last execution date of a message via the ``stateful`` option (and the :doc:`Cache component `). -This allows the system to retain the state of the schedule, ensuring that when a worker is restarted, it resumes from the point it left off.:: +This allows the system to retain the state of the schedule, ensuring that when a +worker is restarted, it resumes from the point it left off:: // src/Scheduler/SaleTaskProvider.php namespace App\Scheduler; @@ -889,7 +890,8 @@ This allows the system to retain the state of the schedule, ensuring that when a } } -With ``stateful`` option, All missed messages will be handled, If you nedd handle your message only once you can use the ``processOnlyLastMissedRun`` option.:: +With the ``stateful`` option, all missed messages will be handled. If you need to +handle a message only once, you can use the ``processOnlyLastMissedRun`` option:: // src/Scheduler/SaleTaskProvider.php namespace App\Scheduler; @@ -910,6 +912,10 @@ With ``stateful`` option, All missed messages will be handled, If you nedd handl } } +.. versionadded:: 7.2 + + The ``processOnlyLastMissedRun`` option was introduced in Symfony 7.2. + To scale your schedules more effectively, you can use multiple workers. In such cases, a good practice is to add a :doc:`lock ` to prevent the same task more than once:: From 23838fd198c9a98731567284306d56b6c78f7e32 Mon Sep 17 00:00:00 2001 From: Thibaut THOUEMENT Date: Fri, 23 Aug 2024 22:10:10 +0200 Subject: [PATCH 334/477] [Validator] Add errorPath to Unique constraint --- reference/constraints/Unique.rst | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/reference/constraints/Unique.rst b/reference/constraints/Unique.rst index 8954f455086..7c4f78cfcc3 100644 --- a/reference/constraints/Unique.rst +++ b/reference/constraints/Unique.rst @@ -170,6 +170,15 @@ collection:: .. include:: /reference/constraints/_groups-option.rst.inc +``errorPath`` +~~~~~~~~~~~~~ + +**type**: ``string`` **default**: ``null`` + +This option allows you to define a custom path for your message. +``#[Assert\Unique(fields: ['latitude', 'longitude'], errorPath: 'point_of_interest')]`` +Instead of ``0: "Error message"``, it will be : ``0.point_of_interest: "Error message"`` + ``message`` ~~~~~~~~~~~ From 03713d55356555cf5933daa8bc1cbe821ccf1591 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Mon, 26 Aug 2024 16:58:22 +0200 Subject: [PATCH 335/477] Reword --- reference/constraints/Unique.rst | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/reference/constraints/Unique.rst b/reference/constraints/Unique.rst index 7c4f78cfcc3..68754738271 100644 --- a/reference/constraints/Unique.rst +++ b/reference/constraints/Unique.rst @@ -175,9 +175,16 @@ collection:: **type**: ``string`` **default**: ``null`` -This option allows you to define a custom path for your message. -``#[Assert\Unique(fields: ['latitude', 'longitude'], errorPath: 'point_of_interest')]`` -Instead of ``0: "Error message"``, it will be : ``0.point_of_interest: "Error message"`` +.. versionadded:: 7.2 + + The ``errorPath`` option was introduced in Symfony 7.2. + +If a validation error occurs, the error message is, by default, bound to the +first element in the collection. Use this option to bind the error message to a +specific field within the first item of the collection. + +The value of this option must use any :doc:`valid PropertyAccess syntax ` +(e.g. ``'point_of_interest'``, ``'user.email'``). ``message`` ~~~~~~~~~~~ From 45ba59fd12b5db3fa49a6cb6ac38683d9119442b Mon Sep 17 00:00:00 2001 From: Ahmed Ghanem <124502255+ahmedghanem00@users.noreply.github.com> Date: Mon, 29 Jul 2024 02:56:36 +0300 Subject: [PATCH 336/477] [Notifier] Create `DesktopChannel` and `JoliNotif` bridge --- notifier.rst | 84 +++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 80 insertions(+), 4 deletions(-) diff --git a/notifier.rst b/notifier.rst index 6d506910ead..4df4590235e 100644 --- a/notifier.rst +++ b/notifier.rst @@ -16,8 +16,8 @@ Get the Notifier installed using: .. _channels-chatters-texters-email-and-browser: -Channels: Chatters, Texters, Email, Browser and Push ----------------------------------------------------- +Channels: Chatters, Texters, Email, Browser, Push and Desktop +------------------------------------------------------------- The notifier component can send notifications to different channels. Each channel can integrate with different providers (e.g. Slack or Twilio SMS) @@ -32,6 +32,7 @@ The notifier component supports the following channels: * :ref:`Email channel ` integrates the :doc:`Symfony Mailer `; * Browser channel uses :ref:`flash messages `. * :ref:`Push channel ` sends notifications to phones and browsers via push notifications. +* :ref:`Desktop channel ` displays desktop notifications on the same host machine. .. tip:: @@ -623,6 +624,79 @@ configure the ``texter_transports``: ; }; +.. _notifier-desktop-channel: + +Desktop Channel +~~~~~~~~~~~~~~~ + +The desktop channel is used to display desktop notifications on the same host machine using +:class:`Symfony\\Component\\Notifier\\Texter` classes. Currently, Symfony +is integrated with the following providers: + +=============== ==================================== ============================================================================== +Provider Package DSN +=============== ==================================== ============================================================================== +`JoliNotif`_ ``symfony/joli-notif-notifier`` ``jolinotif://default`` +=============== ==================================== ============================================================================== + +.. versionadded: 7.2 + + The JoliNotif bridge was introduced in Symfony 7.2. + +To enable a texter, add the correct DSN in your ``.env`` file and +configure the ``texter_transports``: + +.. code-block:: bash + + # .env + JOLINOTIF=jolinotif://default + +.. configuration-block:: + + .. code-block:: yaml + + # config/packages/notifier.yaml + framework: + notifier: + texter_transports: + jolinotif: '%env(JOLINOTIF)%' + + .. code-block:: xml + + + + + + + + + %env(JOLINOTIF)% + + + + + + .. code-block:: php + + // config/packages/notifier.php + use Symfony\Config\FrameworkConfig; + + return static function (FrameworkConfig $framework): void { + $framework->notifier() + ->texterTransport('jolinotif', env('JOLINOTIF')) + ; + }; + +.. versionadded:: 7.2 + + The ``Desktop`` channel was introduced in Symfony 7.2. + Configure to use Failover or Round-Robin Transports ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -926,9 +1000,10 @@ and its ``asChatMessage()`` method:: The :class:`Symfony\\Component\\Notifier\\Notification\\SmsNotificationInterface`, -:class:`Symfony\\Component\\Notifier\\Notification\\EmailNotificationInterface` -and +:class:`Symfony\\Component\\Notifier\\Notification\\EmailNotificationInterface`, :class:`Symfony\\Component\\Notifier\\Notification\\PushNotificationInterface` +and +:class:`Symfony\\Component\\Notifier\\Notification\\DesktopNotificationInterface` also exists to modify messages sent to those channels. Customize Browser Notifications (Flash Messages) @@ -1114,6 +1189,7 @@ is dispatched. Listeners receive a .. _`Infobip`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Infobip/README.md .. _`Iqsms`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Iqsms/README.md .. _`iSendPro`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Isendpro/README.md +.. _`JoliNotif`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/JoliNotif/README.md .. _`KazInfoTeh`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/KazInfoTeh/README.md .. _`LINE Notify`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/LineNotify/README.md .. _`LightSms`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/LightSms/README.md From cc4de4e630189e65ca2e74f98b469d18d20aca28 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 28 Aug 2024 13:13:14 +0200 Subject: [PATCH 337/477] Keep a reference to not break existing links --- notifier.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/notifier.rst b/notifier.rst index 4df4590235e..5f38a078f4c 100644 --- a/notifier.rst +++ b/notifier.rst @@ -15,6 +15,7 @@ Get the Notifier installed using: $ composer require symfony/notifier .. _channels-chatters-texters-email-and-browser: +.. _channels-chatters-texters-email-browser-and-push: Channels: Chatters, Texters, Email, Browser, Push and Desktop ------------------------------------------------------------- From 63c749ff15aa15d93539695e7abdb5d3a2e21b73 Mon Sep 17 00:00:00 2001 From: Antoine M Date: Thu, 29 Aug 2024 13:50:09 +0200 Subject: [PATCH 338/477] chore: relocate the sqlite note block in a better place --- doctrine.rst | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/doctrine.rst b/doctrine.rst index 770a7b32a0a..f3a34757374 100644 --- a/doctrine.rst +++ b/doctrine.rst @@ -174,13 +174,6 @@ Whoa! You now have a new ``src/Entity/Product.php`` file:: Confused why the price is an integer? Don't worry: this is just an example. But, storing prices as integers (e.g. 100 = $1 USD) can avoid rounding issues. -.. note:: - - If you are using an SQLite database, you'll see the following error: - *PDOException: SQLSTATE[HY000]: General error: 1 Cannot add a NOT NULL - column with default value NULL*. Add a ``nullable=true`` option to the - ``description`` property to fix the problem. - .. caution:: There is a `limit of 767 bytes for the index key prefix`_ when using @@ -323,6 +316,13 @@ The migration system is *smart*. It compares all of your entities with the curre state of the database and generates the SQL needed to synchronize them! Like before, execute your migrations: +.. note:: + + If you are using an SQLite database, you'll see the following error: + *PDOException: SQLSTATE[HY000]: General error: 1 Cannot add a NOT NULL + column with default value NULL*. Add a ``nullable=true`` option to the + ``description`` property to fix the problem. + .. code-block:: terminal $ php bin/console doctrine:migrations:migrate From ce6e820aa394a0e6f048e4d8c647de34cc8da85a Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Fri, 30 Aug 2024 08:26:57 +0200 Subject: [PATCH 339/477] Minor tweak --- doctrine.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/doctrine.rst b/doctrine.rst index f3a34757374..aba27545211 100644 --- a/doctrine.rst +++ b/doctrine.rst @@ -316,17 +316,17 @@ The migration system is *smart*. It compares all of your entities with the curre state of the database and generates the SQL needed to synchronize them! Like before, execute your migrations: -.. note:: +.. code-block:: terminal + + $ php bin/console doctrine:migrations:migrate + +.. caution:: If you are using an SQLite database, you'll see the following error: *PDOException: SQLSTATE[HY000]: General error: 1 Cannot add a NOT NULL column with default value NULL*. Add a ``nullable=true`` option to the ``description`` property to fix the problem. -.. code-block:: terminal - - $ php bin/console doctrine:migrations:migrate - This will only execute the *one* new migration file, because DoctrineMigrationsBundle knows that the first migration was already executed earlier. Behind the scenes, it manages a ``migration_versions`` table to track this. From bc88843304a3f7d512aec8cd168e0630abec687c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maxime=20H=C3=A9lias?= Date: Wed, 28 Aug 2024 21:45:50 +0200 Subject: [PATCH 340/477] [FrameworkBundle][HttpClient] Adding an explanation of ThrottlingHttpClient integration with the Framework --- http_client.rst | 104 +++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 89 insertions(+), 15 deletions(-) diff --git a/http_client.rst b/http_client.rst index f1c150b54eb..91b91ebc4a5 100644 --- a/http_client.rst +++ b/http_client.rst @@ -1488,30 +1488,104 @@ Limit the Number of Requests ---------------------------- This component provides a :class:`Symfony\\Component\\HttpClient\\ThrottlingHttpClient` -decorator that allows to limit the number of requests within a certain period. +decorator that allows to limit the number of requests within a certain period, +potentially delaying calls based on the rate limiting policy. The implementation leverages the :class:`Symfony\\Component\\RateLimiter\\LimiterInterface` class under the hood so the :doc:`Rate Limiter component ` needs to be installed in your application:: - use Symfony\Component\HttpClient\HttpClient; - use Symfony\Component\HttpClient\ThrottlingHttpClient; - use Symfony\Component\RateLimiter\LimiterInterface; +.. configuration-block:: - $rateLimiter = ...; // $rateLimiter is an instance of Symfony\Component\RateLimiter\LimiterInterface - $client = HttpClient::create(); - $client = new ThrottlingHttpClient($client, $rateLimiter); + .. code-block:: yaml - $requests = []; - for ($i = 0; $i < 100; $i++) { - $requests[] = $client->request('GET', 'https://example.com'); - } + # config/packages/framework.yaml + framework: + http_client: + scoped_clients: + example.client: + base_uri: 'https://example.com' + rate_limiter: 'http_example_limiter' - foreach ($requests as $request) { - // Depending on rate limiting policy, calls will be delayed - $output->writeln($request->getContent()); - } + rate_limiter: + # Don't send more than 10 requests in 5 seconds + http_example_limiter: + policy: 'token_bucket' + limit: 10 + rate: { interval: '5 seconds', amount: 10 } + + .. code-block:: xml + + + + + + + + + + + + + + + + + + + + .. code-block:: php + + // config/packages/framework.php + use Symfony\Config\FrameworkConfig; + + return static function (FrameworkConfig $framework): void { + $framework->httpClient()->scopedClient('example.client') + ->baseUri('https://example.com') + ->rateLimiter('http_example_limiter'); + // ... + ; + + $framework->rateLimiter() + // Don't send more than 10 requests in 5 seconds + ->limiter('http_example_limiter') + ->policy('token_bucket') + ->limit(10) + ->rate() + ->interval('5 seconds') + ->amount(10) + ; + }; + + .. code-block:: php-standalone + + use Symfony\Component\HttpClient\HttpClient; + use Symfony\Component\HttpClient\ThrottlingHttpClient; + use Symfony\Component\RateLimiter\RateLimiterFactory; + use Symfony\Component\RateLimiter\Storage\InMemoryStorage; + + $factory = new RateLimiterFactory([ + 'id' => 'http_example_limiter', + 'policy' => 'token_bucket', + 'limit' => 10, + 'rate' => ['interval' => '5 seconds', 'amount' => 10], + ], new InMemoryStorage()); + $limiter = $factory->create(); + + $client = HttpClient::createForBaseUri('https://example.com'); + $throttlingClient = new ThrottlingHttpClient($client, $limiter); .. versionadded:: 7.1 From 0c1a63900ab6ac2aa0f3848541f11ef47b932232 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Mon, 2 Sep 2024 13:55:32 +0200 Subject: [PATCH 341/477] fix typo --- reference/constraints/Week.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reference/constraints/Week.rst b/reference/constraints/Week.rst index 26d82777636..f107d8b4192 100644 --- a/reference/constraints/Week.rst +++ b/reference/constraints/Week.rst @@ -89,7 +89,7 @@ the following: This constraint not only checks that the value matches the week number pattern, but it also verifies that the specified week actually exists in the calendar. According to the ISO-8601 standard, years can have either 52 or 53 weeks. For example, -``2022-W53`` is not a valid because 2022 only had 52 weeks; but ``2020-W53`` is +``2022-W53`` is not valid because 2022 only had 52 weeks; but ``2020-W53`` is valid because 2020 had 53 weeks. Options From dea8bf6a3a928bd4f6eceedc69e60a70b0668633 Mon Sep 17 00:00:00 2001 From: Matthieu Lempereur Date: Tue, 3 Sep 2024 09:50:17 +0200 Subject: [PATCH 342/477] Translation - fix lint for ci --- translation.rst | 4 ---- 1 file changed, 4 deletions(-) diff --git a/translation.rst b/translation.rst index 50de01cfc1e..f1704ddccb2 100644 --- a/translation.rst +++ b/translation.rst @@ -467,10 +467,6 @@ The ``translation:extract`` command looks for missing translations in: $ composer require nikic/php-parser - .. versionadded:: 6.2 - - The AST parser support was introduced in Symfony 6.2. - .. _translation-resource-locations: Translation Resource/File Names and Locations From d3e3ab7c04f6b95bf693a5a6026ed972c530e0b9 Mon Sep 17 00:00:00 2001 From: Javier Spagnoletti Date: Fri, 6 Sep 2024 13:24:28 -0300 Subject: [PATCH 343/477] [Messenger] Add missing backticks for inline snippets --- messenger.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/messenger.rst b/messenger.rst index b2ede04da43..35e82591357 100644 --- a/messenger.rst +++ b/messenger.rst @@ -1679,7 +1679,7 @@ redis_sentinel support is disabled .. versionadded:: 7.1 - The option `redis_sentinel` as an alias for `sentinel_master` was introduced + The option ``redis_sentinel`` as an alias for ``sentinel_master`` was introduced in Symfony 7.1. .. caution:: From 31a33bf2d9e5929f834d25cfad93ac21852bf9ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Geffroy?= <81738559+raphael-geffroy@users.noreply.github.com> Date: Fri, 6 Sep 2024 17:53:21 +0200 Subject: [PATCH 344/477] [FrameworkBundle] Remove default value for `gc_probability` config option --- reference/configuration/framework.rst | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/reference/configuration/framework.rst b/reference/configuration/framework.rst index 1e9e43faa0f..c3f341f578b 100644 --- a/reference/configuration/framework.rst +++ b/reference/configuration/framework.rst @@ -1845,13 +1845,19 @@ If not set, ``php.ini``'s `session.gc_divisor`_ directive will be relied on. gc_probability .............. -**type**: ``integer`` **default**: ``1`` +**type**: ``integer`` This defines the probability that the garbage collector (GC) process is started on every session initialization. The probability is calculated by using ``gc_probability`` / ``gc_divisor``, e.g. 1/100 means there is a 1% chance that the GC process will start on each request. +If not set, ``php.ini``'s `session.gc_probability`_ directive will be relied on. + +.. versionadded:: 7.2 + + Relying on ``php.ini``'s directive as default for ``gc_probability`` was introduced in symfony 7.2. + gc_maxlifetime .............. @@ -3893,6 +3899,7 @@ The attributes can also be added to interfaces directly:: .. _`session.cookie_samesite`: https://www.php.net/manual/en/session.configuration.php#ini.session.cookie-samesite .. _`session.cookie_secure`: https://www.php.net/manual/en/session.configuration.php#ini.session.cookie-secure .. _`session.gc_divisor`: https://www.php.net/manual/en/session.configuration.php#ini.session.gc-divisor +.. _`session.gc_probability`: https://www.php.net/manual/en/session.configuration.php#ini.session.gc-probability .. _`session.gc_maxlifetime`: https://www.php.net/manual/en/session.configuration.php#ini.session.gc-maxlifetime .. _`session.sid_length`: https://www.php.net/manual/en/session.configuration.php#ini.session.sid-length .. _`session.sid_bits_per_character`: https://www.php.net/manual/en/session.configuration.php#ini.session.sid-bits-per-character From 5c72f37bca564690a8af6f9797f3eed7e91d0cd8 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Mon, 9 Sep 2024 08:42:30 +0200 Subject: [PATCH 345/477] Minor tweak --- reference/configuration/framework.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/reference/configuration/framework.rst b/reference/configuration/framework.rst index c3f341f578b..bdcbc4a55af 100644 --- a/reference/configuration/framework.rst +++ b/reference/configuration/framework.rst @@ -1852,11 +1852,13 @@ started on every session initialization. The probability is calculated by using ``gc_probability`` / ``gc_divisor``, e.g. 1/100 means there is a 1% chance that the GC process will start on each request. -If not set, ``php.ini``'s `session.gc_probability`_ directive will be relied on. +If not set, Symfony will use the value of the `session.gc_probability`_ directive +in the ``php.ini`` configuration file. .. versionadded:: 7.2 - Relying on ``php.ini``'s directive as default for ``gc_probability`` was introduced in symfony 7.2. + Relying on ``php.ini``'s directive as default for ``gc_probability`` was + introduced in Symfony 7.2. gc_maxlifetime .............. From e425caf94ceb2d7336a5aff5e7832529d6ce8ebd Mon Sep 17 00:00:00 2001 From: Kevin Bond Date: Thu, 12 Sep 2024 22:39:59 -0400 Subject: [PATCH 346/477] [Mailer] add Mailtrap docs --- mailer.rst | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/mailer.rst b/mailer.rst index 21032732c4b..a8d0eda3072 100644 --- a/mailer.rst +++ b/mailer.rst @@ -109,6 +109,7 @@ Service Install with Webhook su `Mailomat`_ ``composer require symfony/mailomat-mailer`` yes `MailPace`_ ``composer require symfony/mail-pace-mailer`` `MailerSend`_ ``composer require symfony/mailer-send-mailer`` +`Mailtrap`_ ``composer require symfony/mailtrap-mailer`` `Mandrill`_ ``composer require symfony/mailchimp-mailer`` `Postal`_ ``composer require symfony/postal-mailer`` `Postmark`_ ``composer require symfony/postmark-mailer`` yes @@ -124,7 +125,7 @@ Service Install with Webhook su .. versionadded:: 7.2 - The Mailomat, Postal and Sweego integrations were introduced in Symfony 7.2. + The Mailomat, Mailtrap, Postal and Sweego integrations were introduced in Symfony 7.2. .. note:: @@ -216,6 +217,10 @@ party provider: | | - HTTP n/a | | | - API ``mailpace+api://API_TOKEN@default`` | +------------------------+---------------------------------------------------------+ +| `Mailtrap`_ | - SMTP ``mailtrap+smtp://PASSWORD@default`` | +| | - HTTP n/a | +| | - API ``mailtrap+api://API_TOKEN@default`` | ++------------------------+---------------------------------------------------------+ | `Postal`_ | - SMTP n/a | | | - HTTP n/a | | | - API ``postal+api://API_KEY@BASE_URL`` | @@ -1581,6 +1586,7 @@ The following transports currently support tags and metadata: * Brevo * Mailgun +* Mailtrap * Mandrill * Postmark * Sendgrid @@ -2000,6 +2006,7 @@ the :class:`Symfony\\Bundle\\FrameworkBundle\\Test\\MailerAssertionsTrait`:: .. _`PEM encoded`: https://en.wikipedia.org/wiki/Privacy-Enhanced_Mail .. _`Postal`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Mailer/Bridge/Postal/README.md .. _`Postmark`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Mailer/Bridge/Postmark/README.md +.. _`Mailtrap`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Mailer/Bridge/Mailtrap/README.md .. _`Resend`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Mailer/Bridge/Resend/README.md .. _`RFC 3986`: https://www.ietf.org/rfc/rfc3986.txt .. _`S/MIME`: https://en.wikipedia.org/wiki/S/MIME From 4dc4e9d75724eb3874149e7a5455f81dce17cdef Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Tue, 17 Sep 2024 10:53:05 +0200 Subject: [PATCH 347/477] Minor tweak --- reference/configuration/framework.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/reference/configuration/framework.rst b/reference/configuration/framework.rst index 80c1944eea1..19f72bb6cb3 100644 --- a/reference/configuration/framework.rst +++ b/reference/configuration/framework.rst @@ -1884,7 +1884,8 @@ If not set, ``php.ini``'s `session.sid_length`_ directive will be relied on. .. deprecated:: 7.2 - The ``sid_length`` option was deprecated in Symfony 7.2. + The ``sid_length`` option was deprecated in Symfony 7.2. No alternative is + provided as PHP 8.4 has deprecated the related option. sid_bits_per_character ...................... @@ -1900,7 +1901,8 @@ If not set, ``php.ini``'s `session.sid_bits_per_character`_ directive will be re .. deprecated:: 7.2 - The ``sid_bits_per_character`` option was deprecated in Symfony 7.2. + The ``sid_bits_per_character`` option was deprecated in Symfony 7.2. No alternative + is provided as PHP 8.4 has deprecated the related option. save_path ......... From 36a7c6dd137a8e819360be1b7e107732b0cdd04b Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Tue, 17 Sep 2024 14:31:19 +0200 Subject: [PATCH 348/477] [Uid] Add the `Uuid::FORMAT_RFC_9562` constant --- components/uid.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/components/uid.rst b/components/uid.rst index feb58968347..73974ef8732 100644 --- a/components/uid.rst +++ b/components/uid.rst @@ -329,6 +329,7 @@ The following constants are available: * ``Uuid::FORMAT_BASE_32`` * ``Uuid::FORMAT_BASE_58`` * ``Uuid::FORMAT_RFC_4122`` +* ``Uuid::FORMAT_RFC_9562`` (equivalent to ``Uuid::FORMAT_RFC_4122``) You can also use the ``Uuid::FORMAT_ALL`` constant to accept any UUID format. By default, only the RFC 4122 format is accepted. From 7a8d0c44f97540e3ef80df087828174f5c8ebec9 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Thu, 19 Sep 2024 09:12:56 +0200 Subject: [PATCH 349/477] [Translation] Mention the support of segment attributes in XLIFF --- reference/formats/xliff.rst | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/reference/formats/xliff.rst b/reference/formats/xliff.rst index acb9af36014..b5dc99b4186 100644 --- a/reference/formats/xliff.rst +++ b/reference/formats/xliff.rst @@ -29,7 +29,7 @@ loaded/dumped inside a Symfony application: true user login - + original-content translated-content @@ -37,4 +37,8 @@ loaded/dumped inside a Symfony application: +.. versionadded:: 7.2 + + The support of attributes in the ```` element was introduced in Symfony 7.2. + .. _XLIFF: https://docs.oasis-open.org/xliff/xliff-core/v2.1/xliff-core-v2.1.html From d971cea1c706ff93df2c16bedfd7c0223a5514a8 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Thu, 19 Sep 2024 13:30:17 +0200 Subject: [PATCH 350/477] =?UTF-8?q?[HttpFoundation]=C2=A0Document=20the=20?= =?UTF-8?q?PRIVATE=5FSUBNETS=20string?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- deployment/proxies.rst | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/deployment/proxies.rst b/deployment/proxies.rst index 40c2550ee2c..fc6f855451d 100644 --- a/deployment/proxies.rst +++ b/deployment/proxies.rst @@ -143,9 +143,17 @@ In this case, you'll need to - *very carefully* - trust *all* proxies. framework: # ... # trust *all* requests (the 'REMOTE_ADDR' string is replaced at - # run time by $_SERVER['REMOTE_ADDR']) + # runtime by $_SERVER['REMOTE_ADDR']) trusted_proxies: '127.0.0.1,REMOTE_ADDR' + # you can also use the 'PRIVATE_SUBNETS' string, which is replaced at + # runtime by the IpUtils::PRIVATE_SUBNETS constant + # trusted_proxies: '127.0.0.1,PRIVATE_SUBNETS' + +.. versionadded:: 7.2 + + The support for the ``'PRIVATE_SUBNETS'`` string was introduced in Symfony 7.2. + That's it! It's critical that you prevent traffic from all non-trusted sources. If you allow outside traffic, they could "spoof" their true IP address and other information. From 2e118366f2008a899da6adb7178a4db280d2548f Mon Sep 17 00:00:00 2001 From: Matthieu Lempereur Date: Wed, 11 Sep 2024 08:42:14 +0200 Subject: [PATCH 351/477] [Emoji][String] Extract Emoji from String documentation --- components/intl.rst | 2 +- emoji.rst | 143 ++++++++++++++++++++++++++++++++++++ string.rst | 174 +------------------------------------------- 3 files changed, 145 insertions(+), 174 deletions(-) create mode 100644 emoji.rst diff --git a/components/intl.rst b/components/intl.rst index 008d9161fd7..ba3cbdcb959 100644 --- a/components/intl.rst +++ b/components/intl.rst @@ -386,7 +386,7 @@ Emoji Transliteration ~~~~~~~~~~~~~~~~~~~~~ Symfony provides utilities to translate emojis into their textual representation -in all languages. Read the documentation on :ref:`working with emojis in strings ` +in all languages. Read the documentation about :ref:`emoji transliteration ` to learn more about this feature. Disk Space diff --git a/emoji.rst b/emoji.rst new file mode 100644 index 00000000000..ba6ca38ed73 --- /dev/null +++ b/emoji.rst @@ -0,0 +1,143 @@ +Working with Emojis +=================== + +.. versionadded:: 7.1 + + The emoji component was introduced in Symfony 7.1. + +Symfony provides several utilities to work with emoji characters and sequences +from the `Unicode CLDR dataset`_. They are available via the Emoji component, +which you must first install in your application: + +.. _installation: + +.. code-block:: terminal + + $ composer require symfony/emoji + +.. include:: /components/require_autoload.rst.inc + +The data needed to store the transliteration of all emojis (~5,000) into all +languages take a considerable disk space. + +If you need to save disk space (e.g. because you deploy to some service with tight +size constraints), run this command (e.g. as an automated script after ``composer install``) +to compress the internal Symfony emoji data files using the PHP ``zlib`` extension: + +.. code-block:: terminal + + # adjust the path to the 'compress' binary based on your application installation + $ php ./vendor/symfony/emoji/Resources/bin/compress + +.. _emoji-transliteration: + +Emoji Transliteration +~~~~~~~~~~~~~~~~~~~~~ + +The ``EmojiTransliterator`` class offers a way to translate emojis into their +textual representation in all languages based on the `Unicode CLDR dataset`_:: + + use Symfony\Component\Emoji\EmojiTransliterator; + + // Describe emojis in English + $transliterator = EmojiTransliterator::create('en'); + $transliterator->transliterate('Menus with 🍕 or 🍝'); + // => 'Menus with pizza or spaghetti' + + // Describe emojis in Ukrainian + $transliterator = EmojiTransliterator::create('uk'); + $transliterator->transliterate('Menus with 🍕 or 🍝'); + // => 'Menus with піца or спагеті' + +You can also combine the ``EmojiTransliterator`` with the :ref:`slugger ` +to transform any emojis into their textual representation. + +Transliterating Emoji Text Short Codes +...................................... + +Services like GitHub and Slack allows to include emojis in your messages using +text short codes (e.g. you can add the ``:+1:`` code to render the 👍 emoji). + +Symfony also provides a feature to transliterate emojis into short codes and vice +versa. The short codes are slightly different on each service, so you must pass +the name of the service as an argument when creating the transliterator. + +Convert emojis to GitHub short codes with the ``emoji-github`` locale:: + + $transliterator = EmojiTransliterator::create('emoji-github'); + $transliterator->transliterate('Teenage 🐢 really love 🍕'); + // => 'Teenage :turtle: really love :pizza:' + +Convert GitHub short codes to emojis with the ``github-emoji`` locale:: + + $transliterator = EmojiTransliterator::create('github-emoji'); + $transliterator->transliterate('Teenage :turtle: really love :pizza:'); + // => 'Teenage 🐢 really love 🍕' + +.. note:: + + Github, Gitlab and Slack are currently available services in + ``EmojiTransliterator``. + +.. _text-emoji: + +Universal Emoji Short Codes Transliteration +########################################### + +If you don't know which service was used to generate the short codes, you can use +the ``text-emoji`` locale, which combines all codes from all services:: + + $transliterator = EmojiTransliterator::create('text-emoji'); + + // Github short codes + $transliterator->transliterate('Breakfast with :kiwi-fruit: or :milk-glass:'); + // Gitlab short codes + $transliterator->transliterate('Breakfast with :kiwi: or :milk:'); + // Slack short codes + $transliterator->transliterate('Breakfast with :kiwifruit: or :glass-of-milk:'); + + // all the above examples produce the same result: + // => 'Breakfast with 🥝 or 🥛' + +You can convert emojis to short codes with the ``emoji-text`` locale:: + + $transliterator = EmojiTransliterator::create('emoji-text'); + $transliterator->transliterate('Breakfast with 🥝 or 🥛'); + // => 'Breakfast with :kiwifruit: or :milk-glass: + +Inverse Emoji Transliteration +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Given the textual representation of an emoji, you can reverse it back to get the +actual emoji thanks to the :ref:`emojify filter `: + +.. code-block:: twig + + {{ 'I like :kiwi-fruit:'|emojify }} {# renders: I like 🥝 #} + {{ 'I like :kiwi:'|emojify }} {# renders: I like 🥝 #} + {{ 'I like :kiwifruit:'|emojify }} {# renders: I like 🥝 #} + +By default, ``emojify`` uses the :ref:`text catalog `, which +merges the emoji text codes of all services. If you prefer, you can select a +specific catalog to use: + +.. code-block:: twig + + {{ 'I :green-heart: this'|emojify }} {# renders: I 💚 this #} + {{ ':green_salad: is nice'|emojify('slack') }} {# renders: 🥗 is nice #} + {{ 'My :turtle: has no name yet'|emojify('github') }} {# renders: My 🐢 has no name yet #} + {{ ':kiwi: is a great fruit'|emojify('gitlab') }} {# renders: 🥝 is a great fruit #} + +Removing Emojis +~~~~~~~~~~~~~~~ + +The ``EmojiTransliterator`` can also be used to remove all emojis from a string, +via the special ``strip`` locale:: + + use Symfony\Component\Emoji\EmojiTransliterator; + + $transliterator = EmojiTransliterator::create('strip'); + $transliterator->transliterate('🎉Hey!🥳 🎁Happy Birthday!🎁'); + // => 'Hey! Happy Birthday!' + +.. _`Unicode CLDR dataset`: https://github.com/unicode-org/cldr diff --git a/string.rst b/string.rst index 5e18cfcaea3..702e9344880 100644 --- a/string.rst +++ b/string.rst @@ -507,177 +507,6 @@ requested during the program execution. You can also create lazy strings from a // hash computation only if it's needed $lazyHash = LazyString::fromStringable(new Hash()); -.. _working-with-emojis: - -Working with Emojis -------------------- - -.. versionadded:: 7.1 - - The emoji component was introduced in Symfony 7.1. - -Symfony provides several utilities to work with emoji characters and sequences -from the `Unicode CLDR dataset`_. They are available via the Emoji component, -which you must first install in your application: - -.. code-block:: terminal - - $ composer require symfony/emoji - -.. include:: /components/require_autoload.rst.inc - -The data needed to store the transliteration of all emojis (~5,000) into all -languages take a considerable disk space. - -If you need to save disk space (e.g. because you deploy to some service with tight -size constraints), run this command (e.g. as an automated script after ``composer install``) -to compress the internal Symfony emoji data files using the PHP ``zlib`` extension: - -.. code-block:: terminal - - # adjust the path to the 'compress' binary based on your application installation - $ php ./vendor/symfony/emoji/Resources/bin/compress - -.. _string-emoji-transliteration: - -Emoji Transliteration -~~~~~~~~~~~~~~~~~~~~~ - -The ``EmojiTransliterator`` class offers a way to translate emojis into their -textual representation in all languages based on the `Unicode CLDR dataset`_:: - - use Symfony\Component\Emoji\EmojiTransliterator; - - // Describe emojis in English - $transliterator = EmojiTransliterator::create('en'); - $transliterator->transliterate('Menus with 🍕 or 🍝'); - // => 'Menus with pizza or spaghetti' - - // Describe emojis in Ukrainian - $transliterator = EmojiTransliterator::create('uk'); - $transliterator->transliterate('Menus with 🍕 or 🍝'); - // => 'Menus with піца or спагеті' - -Transliterating Emoji Text Short Codes -...................................... - -Services like GitHub and Slack allows to include emojis in your messages using -text short codes (e.g. you can add the ``:+1:`` code to render the 👍 emoji). - -Symfony also provides a feature to transliterate emojis into short codes and vice -versa. The short codes are slightly different on each service, so you must pass -the name of the service as an argument when creating the transliterator: - -GitHub Emoji Short Codes Transliteration -######################################## - -Convert emojis to GitHub short codes with the ``emoji-github`` locale:: - - $transliterator = EmojiTransliterator::create('emoji-github'); - $transliterator->transliterate('Teenage 🐢 really love 🍕'); - // => 'Teenage :turtle: really love :pizza:' - -Convert GitHub short codes to emojis with the ``github-emoji`` locale:: - - $transliterator = EmojiTransliterator::create('github-emoji'); - $transliterator->transliterate('Teenage :turtle: really love :pizza:'); - // => 'Teenage 🐢 really love 🍕' - -Gitlab Emoji Short Codes Transliteration -######################################## - -Convert emojis to Gitlab short codes with the ``emoji-gitlab`` locale:: - - $transliterator = EmojiTransliterator::create('emoji-gitlab'); - $transliterator->transliterate('Breakfast with 🥝 or 🥛'); - // => 'Breakfast with :kiwi: or :milk:' - -Convert Gitlab short codes to emojis with the ``gitlab-emoji`` locale:: - - $transliterator = EmojiTransliterator::create('gitlab-emoji'); - $transliterator->transliterate('Breakfast with :kiwi: or :milk:'); - // => 'Breakfast with 🥝 or 🥛' - -Slack Emoji Short Codes Transliteration -####################################### - -Convert emojis to Slack short codes with the ``emoji-slack`` locale:: - - $transliterator = EmojiTransliterator::create('emoji-slack'); - $transliterator->transliterate('Menus with 🥗 or 🧆'); - // => 'Menus with :green_salad: or :falafel:' - -Convert Slack short codes to emojis with the ``slack-emoji`` locale:: - - $transliterator = EmojiTransliterator::create('slack-emoji'); - $transliterator->transliterate('Menus with :green_salad: or :falafel:'); - // => 'Menus with 🥗 or 🧆' - -.. _string-text-emoji: - -Universal Emoji Short Codes Transliteration -########################################### - -If you don't know which service was used to generate the short codes, you can use -the ``text-emoji`` locale, which combines all codes from all services:: - - $transliterator = EmojiTransliterator::create('text-emoji'); - - // Github short codes - $transliterator->transliterate('Breakfast with :kiwi-fruit: or :milk-glass:'); - // Gitlab short codes - $transliterator->transliterate('Breakfast with :kiwi: or :milk:'); - // Slack short codes - $transliterator->transliterate('Breakfast with :kiwifruit: or :glass-of-milk:'); - - // all the above examples produce the same result: - // => 'Breakfast with 🥝 or 🥛' - -You can convert emojis to short codes with the ``emoji-text`` locale:: - - $transliterator = EmojiTransliterator::create('emoji-text'); - $transliterator->transliterate('Breakfast with 🥝 or 🥛'); - // => 'Breakfast with :kiwifruit: or :milk-glass: - -Inverse Emoji Transliteration -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -.. versionadded:: 7.1 - - The inverse emoji transliteration was introduced in Symfony 7.1. - -Given the textual representation of an emoji, you can reverse it back to get the -actual emoji thanks to the :ref:`emojify filter `: - -.. code-block:: twig - - {{ 'I like :kiwi-fruit:'|emojify }} {# renders: I like 🥝 #} - {{ 'I like :kiwi:'|emojify }} {# renders: I like 🥝 #} - {{ 'I like :kiwifruit:'|emojify }} {# renders: I like 🥝 #} - -By default, ``emojify`` uses the :ref:`text catalog `, which -merges the emoji text codes of all services. If you prefer, you can select a -specific catalog to use: - -.. code-block:: twig - - {{ 'I :green-heart: this'|emojify }} {# renders: I 💚 this #} - {{ ':green_salad: is nice'|emojify('slack') }} {# renders: 🥗 is nice #} - {{ 'My :turtle: has no name yet'|emojify('github') }} {# renders: My 🐢 has no name yet #} - {{ ':kiwi: is a great fruit'|emojify('gitlab') }} {# renders: 🥝 is a great fruit #} - -Removing Emojis -~~~~~~~~~~~~~~~ - -The ``EmojiTransliterator`` can also be used to remove all emojis from a string, -via the special ``strip`` locale:: - - use Symfony\Component\Emoji\EmojiTransliterator; - - $transliterator = EmojiTransliterator::create('strip'); - $transliterator->transliterate('🎉Hey!🥳 🎁Happy Birthday!🎁'); - // => 'Hey! Happy Birthday!' - .. _string-slugger: Slugger @@ -752,7 +581,7 @@ the injected slugger is the same as the request locale:: Slug Emojis ~~~~~~~~~~~ -You can also combine the :ref:`emoji transliterator ` +You can also combine the :ref:`emoji transliterator ` with the slugger to transform any emojis into their textual representation:: use Symfony\Component\String\Slugger\AsciiSlugger; @@ -822,4 +651,3 @@ possible to determine a unique singular/plural form for the given word. .. _`Code points`: https://en.wikipedia.org/wiki/Code_point .. _`Grapheme clusters`: https://en.wikipedia.org/wiki/Grapheme .. _`Unicode equivalence`: https://en.wikipedia.org/wiki/Unicode_equivalence -.. _`Unicode CLDR dataset`: https://github.com/unicode-org/cldr From add4600eab9d96b52a44eae81f35904c45e23e92 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Thu, 19 Sep 2024 17:31:06 +0200 Subject: [PATCH 352/477] Minor tweaks --- emoji.rst | 50 ++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 40 insertions(+), 10 deletions(-) diff --git a/emoji.rst b/emoji.rst index ba6ca38ed73..551497f0c76 100644 --- a/emoji.rst +++ b/emoji.rst @@ -32,7 +32,7 @@ to compress the internal Symfony emoji data files using the PHP ``zlib`` extensi .. _emoji-transliteration: Emoji Transliteration -~~~~~~~~~~~~~~~~~~~~~ +--------------------- The ``EmojiTransliterator`` class offers a way to translate emojis into their textual representation in all languages based on the `Unicode CLDR dataset`_:: @@ -49,11 +49,13 @@ textual representation in all languages based on the `Unicode CLDR dataset`_:: $transliterator->transliterate('Menus with 🍕 or 🍝'); // => 'Menus with піца or спагеті' -You can also combine the ``EmojiTransliterator`` with the :ref:`slugger ` -to transform any emojis into their textual representation. +.. tip:: + + When using the :ref:`slugger ` from the String component, + you can combine it with the ``EmojiTransliterator`` to :ref:`slugify emojis `. Transliterating Emoji Text Short Codes -...................................... +-------------------------------------- Services like GitHub and Slack allows to include emojis in your messages using text short codes (e.g. you can add the ``:+1:`` code to render the 👍 emoji). @@ -62,6 +64,9 @@ Symfony also provides a feature to transliterate emojis into short codes and vic versa. The short codes are slightly different on each service, so you must pass the name of the service as an argument when creating the transliterator. +GitHub Emoji Short Codes Transliteration +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Convert emojis to GitHub short codes with the ``emoji-github`` locale:: $transliterator = EmojiTransliterator::create('emoji-github'); @@ -74,15 +79,40 @@ Convert GitHub short codes to emojis with the ``github-emoji`` locale:: $transliterator->transliterate('Teenage :turtle: really love :pizza:'); // => 'Teenage 🐢 really love 🍕' -.. note:: +Gitlab Emoji Short Codes Transliteration +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Convert emojis to Gitlab short codes with the ``emoji-gitlab`` locale:: + + $transliterator = EmojiTransliterator::create('emoji-gitlab'); + $transliterator->transliterate('Breakfast with 🥝 or 🥛'); + // => 'Breakfast with :kiwi: or :milk:' + +Convert Gitlab short codes to emojis with the ``gitlab-emoji`` locale:: + + $transliterator = EmojiTransliterator::create('gitlab-emoji'); + $transliterator->transliterate('Breakfast with :kiwi: or :milk:'); + // => 'Breakfast with 🥝 or 🥛' + +Slack Emoji Short Codes Transliteration +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Convert emojis to Slack short codes with the ``emoji-slack`` locale:: + + $transliterator = EmojiTransliterator::create('emoji-slack'); + $transliterator->transliterate('Menus with 🥗 or 🧆'); + // => 'Menus with :green_salad: or :falafel:' + +Convert Slack short codes to emojis with the ``slack-emoji`` locale:: - Github, Gitlab and Slack are currently available services in - ``EmojiTransliterator``. + $transliterator = EmojiTransliterator::create('slack-emoji'); + $transliterator->transliterate('Menus with :green_salad: or :falafel:'); + // => 'Menus with 🥗 or 🧆' .. _text-emoji: Universal Emoji Short Codes Transliteration -########################################### +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ If you don't know which service was used to generate the short codes, you can use the ``text-emoji`` locale, which combines all codes from all services:: @@ -106,7 +136,7 @@ You can convert emojis to short codes with the ``emoji-text`` locale:: // => 'Breakfast with :kiwifruit: or :milk-glass: Inverse Emoji Transliteration -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +----------------------------- Given the textual representation of an emoji, you can reverse it back to get the actual emoji thanks to the :ref:`emojify filter `: @@ -129,7 +159,7 @@ specific catalog to use: {{ ':kiwi: is a great fruit'|emojify('gitlab') }} {# renders: 🥝 is a great fruit #} Removing Emojis -~~~~~~~~~~~~~~~ +--------------- The ``EmojiTransliterator`` can also be used to remove all emojis from a string, via the special ``strip`` locale:: From 7815198fe2e3b58229650e022cd8c89cb53c1568 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Thu, 19 Sep 2024 17:33:25 +0200 Subject: [PATCH 353/477] [String] Added a message about the moved Emoji docs --- string.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/string.rst b/string.rst index 702e9344880..667dcd06010 100644 --- a/string.rst +++ b/string.rst @@ -507,6 +507,11 @@ requested during the program execution. You can also create lazy strings from a // hash computation only if it's needed $lazyHash = LazyString::fromStringable(new Hash()); +Working with Emojis +------------------- + +These contents have been moved to the :doc:`Emoji component docs `. + .. _string-slugger: Slugger From 7573d4a1211c81ae08d2ca26df5311322c45bb0b Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Thu, 19 Sep 2024 10:11:30 +0200 Subject: [PATCH 354/477] [Security] Allow passport attributes in `Security::login()` --- security.rst | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/security.rst b/security.rst index a8aa652a222..51ee9b5c3fb 100644 --- a/security.rst +++ b/security.rst @@ -1767,9 +1767,12 @@ You can log in a user programmatically using the ``login()`` method of the // you can also log in on a different firewall... $security->login($user, 'form_login', 'other_firewall'); - // ...and add badges + // ... add badges... $security->login($user, 'form_login', 'other_firewall', [(new RememberMeBadge())->enable()]); + // ... and also add passport attributes + $security->login($user, 'form_login', 'other_firewall', [(new RememberMeBadge())->enable()], ['referer' => 'https://oauth.example.com']); + // use the redirection logic applied to regular login $redirectResponse = $security->login($user); return $redirectResponse; @@ -1779,6 +1782,12 @@ You can log in a user programmatically using the ``login()`` method of the } } +.. versionadded:: 7.2 + + The support for passport attributes in the + :method:`Symfony\\Bundle\\SecurityBundle\\Security::login` method was + introduced in Symfony 7.2. + .. _security-logging-out: Logging Out From b0a91ce7a24f40b52d6732d32fc1dad28043a964 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Thu, 19 Sep 2024 09:00:51 +0200 Subject: [PATCH 355/477] [String] Document the Spanish inflector --- string.rst | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/string.rst b/string.rst index f2856976986..cb822e1dbd1 100644 --- a/string.rst +++ b/string.rst @@ -820,11 +820,28 @@ class to convert English words from/to singular/plural with confidence:: The value returned by both methods is always an array because sometimes it's not possible to determine a unique singular/plural form for the given word. +Symfony also provides inflectors for other languages:: + + use Symfony\Component\String\Inflector\FrenchInflector; + + $inflector = new FrenchInflector(); + $result = $inflector->singularize('souris'); // ['souris'] + $result = $inflector->pluralize('hôpital'); // ['hôpitaux'] + + use Symfony\Component\String\Inflector\SpanishInflector; + + $inflector = new SpanishInflector(); + $result = $inflector->singularize('aviones'); // ['avión'] + $result = $inflector->pluralize('miércoles'); // ['miércoles'] + +.. versionadded:: 7.2 + + The ``SpanishInflector`` class was introduced in Symfony 7.2. + .. note:: - Symfony also provides a :class:`Symfony\\Component\\String\\Inflector\\FrenchInflector` - and an :class:`Symfony\\Component\\String\\Inflector\\InflectorInterface` if - you need to implement your own inflector. + Symfony provides a :class:`Symfony\\Component\\String\\Inflector\\InflectorInterface` + in case you need to implement your own inflector. .. _`ASCII`: https://en.wikipedia.org/wiki/ASCII .. _`Unicode`: https://en.wikipedia.org/wiki/Unicode From 3983e81d511ced672866601c191f4ec780492634 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Fri, 20 Sep 2024 16:59:19 +0200 Subject: [PATCH 356/477] fix typo --- string.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/string.rst b/string.rst index da82791c740..37f64bc4f3b 100644 --- a/string.rst +++ b/string.rst @@ -674,7 +674,7 @@ Symfony also provides inflectors for other languages:: .. note:: - Symfony provides a :class:`Symfony\\Component\\String\\Inflector\\InflectorInterface` + Symfony provides an :class:`Symfony\\Component\\String\\Inflector\\InflectorInterface` in case you need to implement your own inflector. .. _`ASCII`: https://en.wikipedia.org/wiki/ASCII From fdda76fe73d83158eba51bbff5798ddd38ccf1ef Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Thu, 19 Sep 2024 12:41:59 +0200 Subject: [PATCH 357/477] [FrameworkBundle] Document the `resolve-env-vars` option of `lint:container` command --- service_container.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/service_container.rst b/service_container.rst index 9e1cdff2098..f329587eb54 100644 --- a/service_container.rst +++ b/service_container.rst @@ -1069,6 +1069,14 @@ application to production (e.g. in your continuous integration server): $ php bin/console lint:container + # optionally, you can force the resolution of environment variables; + # the command will fail if any of those environment variables are missing + $ php bin/console lint:container --resolve-env-vars + +.. versionadded:: 7.2 + + The ``--resolve-env-vars`` option was introduced in Symfony 7.2. + Performing those checks whenever the container is compiled can hurt performance. That's why they are implemented in :doc:`compiler passes ` called ``CheckTypeDeclarationsPass`` and ``CheckAliasValidityPass``, which are From a78ff470d7019a3cbf550ed3a7412340e18992e7 Mon Sep 17 00:00:00 2001 From: Yonel Ceruto Date: Sun, 22 Sep 2024 11:34:16 -0400 Subject: [PATCH 358/477] documenting non-empty parameters --- configuration.rst | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/configuration.rst b/configuration.rst index 36dceae1b71..52dc9b98c95 100644 --- a/configuration.rst +++ b/configuration.rst @@ -382,6 +382,25 @@ a new ``locale`` parameter is added to the ``config/services.yaml`` file). They are useful when working with :ref:`Compiler Passes ` to declare some temporary parameters that won't be available later in the application. +Configuration parameters are usually validation-free, but you can ensure that +essential parameters for your application's functionality are not empty:: + + // ContainerBuilder + $container->parameterCannotBeEmpty('app.private_key', 'Did you forget to configure a non-empty value for "app.private_key" parameter?'); + +If a non-empty parameter is ``null``, an empty string ``''``, or an empty array ``[]``, +Symfony will throw an exception with the custom error message when attempting to +retrieve the value of this parameter. + +.. versionadded:: 7.2 + + Validating non-empty parameters was introduced in Symfony 7.2. + +.. note:: + + Please note that this validation will *only* occur if a non-empty parameter value + is retrieved; otherwise, no exception will be thrown. + .. seealso:: Later in this article you can read how to From 6516a9b4bcd72535bc566686284596b4b85a082d Mon Sep 17 00:00:00 2001 From: Matthieu Lempereur Date: Tue, 24 Sep 2024 10:49:35 +0200 Subject: [PATCH 359/477] form/remove-legacy-message --- reference/forms/types/birthday.rst | 2 -- reference/forms/types/checkbox.rst | 2 -- reference/forms/types/choice.rst | 2 -- reference/forms/types/collection.rst | 2 -- reference/forms/types/color.rst | 2 -- reference/forms/types/country.rst | 2 -- reference/forms/types/currency.rst | 2 -- reference/forms/types/date.rst | 2 -- reference/forms/types/dateinterval.rst | 2 -- reference/forms/types/datetime.rst | 2 -- reference/forms/types/email.rst | 2 -- reference/forms/types/enum.rst | 2 -- reference/forms/types/file.rst | 2 -- reference/forms/types/form.rst | 2 -- reference/forms/types/hidden.rst | 2 -- reference/forms/types/integer.rst | 2 -- reference/forms/types/language.rst | 2 -- reference/forms/types/locale.rst | 2 -- reference/forms/types/money.rst | 2 -- reference/forms/types/number.rst | 2 -- reference/forms/types/password.rst | 2 -- reference/forms/types/percent.rst | 2 -- reference/forms/types/radio.rst | 2 -- reference/forms/types/range.rst | 2 -- reference/forms/types/repeated.rst | 2 -- reference/forms/types/search.rst | 2 -- reference/forms/types/tel.rst | 2 -- reference/forms/types/time.rst | 2 -- reference/forms/types/timezone.rst | 2 -- reference/forms/types/ulid.rst | 2 -- reference/forms/types/url.rst | 2 -- reference/forms/types/uuid.rst | 2 -- reference/forms/types/week.rst | 2 -- 33 files changed, 66 deletions(-) diff --git a/reference/forms/types/birthday.rst b/reference/forms/types/birthday.rst index 2098d3cfb89..383dbf890f2 100644 --- a/reference/forms/types/birthday.rst +++ b/reference/forms/types/birthday.rst @@ -19,8 +19,6 @@ option defaults to 120 years ago to the current year. +---------------------------+-------------------------------------------------------------------------------+ | Default invalid message | Please enter a valid birthdate. | +---------------------------+-------------------------------------------------------------------------------+ -| Legacy invalid message | The value {{ value }} is not valid. | -+---------------------------+-------------------------------------------------------------------------------+ | Parent type | :doc:`DateType ` | +---------------------------+-------------------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\BirthdayType` | diff --git a/reference/forms/types/checkbox.rst b/reference/forms/types/checkbox.rst index 472d6f84024..2299220c5b6 100644 --- a/reference/forms/types/checkbox.rst +++ b/reference/forms/types/checkbox.rst @@ -13,8 +13,6 @@ if you want to handle submitted values like "0" or "false"). +---------------------------+------------------------------------------------------------------------+ | Default invalid message | The checkbox has an invalid value. | +---------------------------+------------------------------------------------------------------------+ -| Legacy invalid message | The value {{ value }} is not valid. | -+---------------------------+------------------------------------------------------------------------+ | Parent type | :doc:`FormType ` | +---------------------------+------------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\CheckboxType` | diff --git a/reference/forms/types/choice.rst b/reference/forms/types/choice.rst index 0b250b799da..55f2d016001 100644 --- a/reference/forms/types/choice.rst +++ b/reference/forms/types/choice.rst @@ -11,8 +11,6 @@ To use this field, you must specify *either* ``choices`` or ``choice_loader`` op +---------------------------+----------------------------------------------------------------------+ | Default invalid message | The selected choice is invalid. | +---------------------------+----------------------------------------------------------------------+ -| Legacy invalid message | The value {{ value }} is not valid. | -+---------------------------+----------------------------------------------------------------------+ | Parent type | :doc:`FormType ` | +---------------------------+----------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\ChoiceType` | diff --git a/reference/forms/types/collection.rst b/reference/forms/types/collection.rst index acb110fd722..c5fee42f06c 100644 --- a/reference/forms/types/collection.rst +++ b/reference/forms/types/collection.rst @@ -16,8 +16,6 @@ that is passed as the collection type field data. +---------------------------+--------------------------------------------------------------------------+ | Default invalid message | The collection is invalid. | +---------------------------+--------------------------------------------------------------------------+ -| Legacy invalid message | The value {{ value }} is not valid. | -+---------------------------+--------------------------------------------------------------------------+ | Parent type | :doc:`FormType ` | +---------------------------+--------------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\CollectionType` | diff --git a/reference/forms/types/color.rst b/reference/forms/types/color.rst index 1a320b9bdbf..b205127fb91 100644 --- a/reference/forms/types/color.rst +++ b/reference/forms/types/color.rst @@ -16,8 +16,6 @@ element. +---------------------------+---------------------------------------------------------------------+ | Default invalid message | Please select a valid color. | +---------------------------+---------------------------------------------------------------------+ -| Legacy invalid message | The value {{ value }} is not valid. | -+---------------------------+---------------------------------------------------------------------+ | Parent type | :doc:`TextType ` | +---------------------------+---------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\ColorType` | diff --git a/reference/forms/types/country.rst b/reference/forms/types/country.rst index 8913e639f23..d841461b2f5 100644 --- a/reference/forms/types/country.rst +++ b/reference/forms/types/country.rst @@ -20,8 +20,6 @@ the option manually, but then you should just use the ``ChoiceType`` directly. +---------------------------+-----------------------------------------------------------------------+ | Default invalid message | Please select a valid country. | +---------------------------+-----------------------------------------------------------------------+ -| Legacy invalid message | The value {{ value }} is not valid. | -+---------------------------+-----------------------------------------------------------------------+ | Parent type | :doc:`ChoiceType ` | +---------------------------+-----------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\CountryType` | diff --git a/reference/forms/types/currency.rst b/reference/forms/types/currency.rst index cca441ff930..b69225eb78c 100644 --- a/reference/forms/types/currency.rst +++ b/reference/forms/types/currency.rst @@ -13,8 +13,6 @@ manually, but then you should just use the ``ChoiceType`` directly. +---------------------------+------------------------------------------------------------------------+ | Default invalid message | Please select a valid currency. | +---------------------------+------------------------------------------------------------------------+ -| Legacy invalid message | The value {{ value }} is not valid. | -+---------------------------+------------------------------------------------------------------------+ | Parent type | :doc:`ChoiceType ` | +---------------------------+------------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\CurrencyType` | diff --git a/reference/forms/types/date.rst b/reference/forms/types/date.rst index 515c12099a1..c412872442e 100644 --- a/reference/forms/types/date.rst +++ b/reference/forms/types/date.rst @@ -14,8 +14,6 @@ and can understand a number of different input formats via the `input`_ option. +---------------------------+-----------------------------------------------------------------------------+ | Default invalid message | Please enter a valid date. | +---------------------------+-----------------------------------------------------------------------------+ -| Legacy invalid message | The value {{ value }} is not valid. | -+---------------------------+-----------------------------------------------------------------------------+ | Parent type | :doc:`FormType ` | +---------------------------+-----------------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\DateType` | diff --git a/reference/forms/types/dateinterval.rst b/reference/forms/types/dateinterval.rst index 627fb78d7ed..38fccb47cd1 100644 --- a/reference/forms/types/dateinterval.rst +++ b/reference/forms/types/dateinterval.rst @@ -16,8 +16,6 @@ or an array (see `input`_). +---------------------------+----------------------------------------------------------------------------------+ | Default invalid message | Please choose a valid date interval. | +---------------------------+----------------------------------------------------------------------------------+ -| Legacy invalid message | The value {{ value }} is not valid. | -+---------------------------+----------------------------------------------------------------------------------+ | Parent type | :doc:`FormType ` | +---------------------------+----------------------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\DateIntervalType` | diff --git a/reference/forms/types/datetime.rst b/reference/forms/types/datetime.rst index 7ffc0ee216f..5fda8e9a14f 100644 --- a/reference/forms/types/datetime.rst +++ b/reference/forms/types/datetime.rst @@ -14,8 +14,6 @@ the data can be a ``DateTime`` object, a string, a timestamp or an array. +---------------------------+-----------------------------------------------------------------------------+ | Default invalid message | Please enter a valid date and time. | +---------------------------+-----------------------------------------------------------------------------+ -| Legacy invalid message | The value {{ value }} is not valid. | -+---------------------------+-----------------------------------------------------------------------------+ | Parent type | :doc:`FormType ` | +---------------------------+-----------------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\DateTimeType` | diff --git a/reference/forms/types/email.rst b/reference/forms/types/email.rst index 9045bba8cc4..ef535050813 100644 --- a/reference/forms/types/email.rst +++ b/reference/forms/types/email.rst @@ -9,8 +9,6 @@ The ``EmailType`` field is a text field that is rendered using the HTML5 +---------------------------+---------------------------------------------------------------------+ | Default invalid message | Please enter a valid email address. | +---------------------------+---------------------------------------------------------------------+ -| Legacy invalid message | The value {{ value }} is not valid. | -+---------------------------+---------------------------------------------------------------------+ | Parent type | :doc:`TextType ` | +---------------------------+---------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\EmailType` | diff --git a/reference/forms/types/enum.rst b/reference/forms/types/enum.rst index 0aad19767e3..875c0808108 100644 --- a/reference/forms/types/enum.rst +++ b/reference/forms/types/enum.rst @@ -10,8 +10,6 @@ field and defines the same options. +---------------------------+----------------------------------------------------------------------+ | Default invalid message | The selected choice is invalid. | +---------------------------+----------------------------------------------------------------------+ -| Legacy invalid message | The value {{ value }} is not valid. | -+---------------------------+----------------------------------------------------------------------+ | Parent type | :doc:`ChoiceType ` | +---------------------------+----------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\EnumType` | diff --git a/reference/forms/types/file.rst b/reference/forms/types/file.rst index b4982859b98..2e841611eb8 100644 --- a/reference/forms/types/file.rst +++ b/reference/forms/types/file.rst @@ -8,8 +8,6 @@ The ``FileType`` represents a file input in your form. +---------------------------+--------------------------------------------------------------------+ | Default invalid message | Please select a valid file. | +---------------------------+--------------------------------------------------------------------+ -| Legacy invalid message | The value {{ value }} is not valid. | -+---------------------------+--------------------------------------------------------------------+ | Parent type | :doc:`FormType ` | +---------------------------+--------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\FileType` | diff --git a/reference/forms/types/form.rst b/reference/forms/types/form.rst index 0d0089c1fd3..58a6214d379 100644 --- a/reference/forms/types/form.rst +++ b/reference/forms/types/form.rst @@ -7,8 +7,6 @@ on all types for which ``FormType`` is the parent. +---------------------------+--------------------------------------------------------------------+ | Default invalid message | This value is not valid. | +---------------------------+--------------------------------------------------------------------+ -| Legacy invalid message | This value is not valid. | -+---------------------------+--------------------------------------------------------------------+ | Parent | none | +---------------------------+--------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\FormType` | diff --git a/reference/forms/types/hidden.rst b/reference/forms/types/hidden.rst index fba056b88e5..d6aff282edd 100644 --- a/reference/forms/types/hidden.rst +++ b/reference/forms/types/hidden.rst @@ -8,8 +8,6 @@ The hidden type represents a hidden input field. +---------------------------+----------------------------------------------------------------------+ | Default invalid message | The hidden field is invalid. | +---------------------------+----------------------------------------------------------------------+ -| Legacy invalid message | The value {{ value }} is not valid. | -+---------------------------+----------------------------------------------------------------------+ | Parent type | :doc:`FormType ` | +---------------------------+----------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\HiddenType` | diff --git a/reference/forms/types/integer.rst b/reference/forms/types/integer.rst index 619ac996df6..1f94f9e2525 100644 --- a/reference/forms/types/integer.rst +++ b/reference/forms/types/integer.rst @@ -15,8 +15,6 @@ integers. By default, all non-integer values (e.g. 6.78) will round down +---------------------------+-----------------------------------------------------------------------+ | Default invalid message | Please enter an integer. | +---------------------------+-----------------------------------------------------------------------+ -| Legacy invalid message | The value {{ value }} is not valid. | -+---------------------------+-----------------------------------------------------------------------+ | Parent type | :doc:`FormType ` | +---------------------------+-----------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\IntegerType` | diff --git a/reference/forms/types/language.rst b/reference/forms/types/language.rst index 4b1bccd077d..e3dddfb8ae6 100644 --- a/reference/forms/types/language.rst +++ b/reference/forms/types/language.rst @@ -22,8 +22,6 @@ manually, but then you should just use the ``ChoiceType`` directly. +---------------------------+------------------------------------------------------------------------+ | Default invalid message | Please select a valid language. | +---------------------------+------------------------------------------------------------------------+ -| Legacy invalid message | The value {{ value }} is not valid. | -+---------------------------+------------------------------------------------------------------------+ | Parent type | :doc:`ChoiceType ` | +---------------------------+------------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\LanguageType` | diff --git a/reference/forms/types/locale.rst b/reference/forms/types/locale.rst index 1868f20eda1..68155a248fd 100644 --- a/reference/forms/types/locale.rst +++ b/reference/forms/types/locale.rst @@ -23,8 +23,6 @@ manually, but then you should just use the ``ChoiceType`` directly. +---------------------------+----------------------------------------------------------------------+ | Default invalid message | Please select a valid locale. | +---------------------------+----------------------------------------------------------------------+ -| Legacy invalid message | The value {{ value }} is not valid. | -+---------------------------+----------------------------------------------------------------------+ | Parent type | :doc:`ChoiceType ` | +---------------------------+----------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\LocaleType` | diff --git a/reference/forms/types/money.rst b/reference/forms/types/money.rst index 5793097fe2f..f9f8cefdd58 100644 --- a/reference/forms/types/money.rst +++ b/reference/forms/types/money.rst @@ -13,8 +13,6 @@ how the input and output of the data is handled. +---------------------------+---------------------------------------------------------------------+ | Default invalid message | Please enter a valid money amount. | +---------------------------+---------------------------------------------------------------------+ -| Legacy invalid message | The value {{ value }} is not valid. | -+---------------------------+---------------------------------------------------------------------+ | Parent type | :doc:`FormType ` | +---------------------------+---------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\MoneyType` | diff --git a/reference/forms/types/number.rst b/reference/forms/types/number.rst index 86d8eda3116..7e125a5fd05 100644 --- a/reference/forms/types/number.rst +++ b/reference/forms/types/number.rst @@ -10,8 +10,6 @@ that you want to use for your number. +---------------------------+----------------------------------------------------------------------+ | Default invalid message | Please enter a number. | +---------------------------+----------------------------------------------------------------------+ -| Legacy invalid message | The value {{ value }} is not valid. | -+---------------------------+----------------------------------------------------------------------+ | Parent type | :doc:`FormType ` | +---------------------------+----------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\NumberType` | diff --git a/reference/forms/types/password.rst b/reference/forms/types/password.rst index 7fb760471ef..83342194a4e 100644 --- a/reference/forms/types/password.rst +++ b/reference/forms/types/password.rst @@ -8,8 +8,6 @@ The ``PasswordType`` field renders an input password text box. +---------------------------+------------------------------------------------------------------------+ | Default invalid message | The password is invalid. | +---------------------------+------------------------------------------------------------------------+ -| Legacy invalid message | The value {{ value }} is not valid. | -+---------------------------+------------------------------------------------------------------------+ | Parent type | :doc:`TextType ` | +---------------------------+------------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\PasswordType` | diff --git a/reference/forms/types/percent.rst b/reference/forms/types/percent.rst index ce985488c76..b46ca298c53 100644 --- a/reference/forms/types/percent.rst +++ b/reference/forms/types/percent.rst @@ -14,8 +14,6 @@ the input. +---------------------------+-----------------------------------------------------------------------+ | Default invalid message | Please enter a percentage value. | +---------------------------+-----------------------------------------------------------------------+ -| Legacy invalid message | The value {{ value }} is not valid. | -+---------------------------+-----------------------------------------------------------------------+ | Parent type | :doc:`FormType ` | +---------------------------+-----------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\PercentType` | diff --git a/reference/forms/types/radio.rst b/reference/forms/types/radio.rst index 7702b87cbad..7ab90086803 100644 --- a/reference/forms/types/radio.rst +++ b/reference/forms/types/radio.rst @@ -15,8 +15,6 @@ If you want to have a boolean field, use :doc:`CheckboxType ` | +---------------------------+---------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\RadioType` | diff --git a/reference/forms/types/range.rst b/reference/forms/types/range.rst index 294023ce0c6..06eebfd5473 100644 --- a/reference/forms/types/range.rst +++ b/reference/forms/types/range.rst @@ -9,8 +9,6 @@ The ``RangeType`` field is a slider that is rendered using the HTML5 +---------------------------+---------------------------------------------------------------------+ | Default invalid message | Please choose a valid range. | +---------------------------+---------------------------------------------------------------------+ -| Legacy invalid message | The value {{ value }} is not valid. | -+---------------------------+---------------------------------------------------------------------+ | Parent type | :doc:`TextType ` | +---------------------------+---------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\RangeType` | diff --git a/reference/forms/types/repeated.rst b/reference/forms/types/repeated.rst index e5bd0cd4520..36211237bbd 100644 --- a/reference/forms/types/repeated.rst +++ b/reference/forms/types/repeated.rst @@ -11,8 +11,6 @@ accuracy. +---------------------------+------------------------------------------------------------------------+ | Default invalid message | The values do not match. | +---------------------------+------------------------------------------------------------------------+ -| Legacy invalid message | The value {{ value }} is not valid. | -+---------------------------+------------------------------------------------------------------------+ | Parent type | :doc:`FormType ` | +---------------------------+------------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\RepeatedType` | diff --git a/reference/forms/types/search.rst b/reference/forms/types/search.rst index e38021bc461..5ece0f6416b 100644 --- a/reference/forms/types/search.rst +++ b/reference/forms/types/search.rst @@ -11,8 +11,6 @@ Read about the input search field at `DiveIntoHTML5.info`_ +---------------------------+----------------------------------------------------------------------+ | Default invalid message | Please enter a valid search term. | +---------------------------+----------------------------------------------------------------------+ -| Legacy invalid message | The value {{ value }} is not valid. | -+---------------------------+----------------------------------------------------------------------+ | Parent type | :doc:`TextType ` | +---------------------------+----------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\SearchType` | diff --git a/reference/forms/types/tel.rst b/reference/forms/types/tel.rst index 675f8e3f5cd..e8ab9c322fe 100644 --- a/reference/forms/types/tel.rst +++ b/reference/forms/types/tel.rst @@ -15,8 +15,6 @@ to input phone numbers. +---------------------------+-------------------------------------------------------------------+ | Default invalid message | Please provide a valid phone number. | +---------------------------+-------------------------------------------------------------------+ -| Legacy invalid message | The value {{ value }} is not valid. | -+---------------------------+-------------------------------------------------------------------+ | Parent type | :doc:`TextType ` | +---------------------------+-------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\TelType` | diff --git a/reference/forms/types/time.rst b/reference/forms/types/time.rst index 2ce41c6ff74..43cf0644e0e 100644 --- a/reference/forms/types/time.rst +++ b/reference/forms/types/time.rst @@ -14,8 +14,6 @@ stored as a ``DateTime`` object, a string, a timestamp or an array. +---------------------------+-----------------------------------------------------------------------------+ | Default invalid message | Please enter a valid time. | +---------------------------+-----------------------------------------------------------------------------+ -| Legacy invalid message | The value {{ value }} is not valid. | -+---------------------------+-----------------------------------------------------------------------------+ | Parent type | FormType | +---------------------------+-----------------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\TimeType` | diff --git a/reference/forms/types/timezone.rst b/reference/forms/types/timezone.rst index 3750e1b98d8..7dae0f351b4 100644 --- a/reference/forms/types/timezone.rst +++ b/reference/forms/types/timezone.rst @@ -16,8 +16,6 @@ manually, but then you should just use the ``ChoiceType`` directly. +---------------------------+------------------------------------------------------------------------+ | Default invalid message | Please select a valid timezone. | +---------------------------+------------------------------------------------------------------------+ -| Legacy invalid message | The value {{ value }} is not valid. | -+---------------------------+------------------------------------------------------------------------+ | Parent type | :doc:`ChoiceType ` | +---------------------------+------------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\TimezoneType` | diff --git a/reference/forms/types/ulid.rst b/reference/forms/types/ulid.rst index 52bdb8eb136..71fb77cffa0 100644 --- a/reference/forms/types/ulid.rst +++ b/reference/forms/types/ulid.rst @@ -9,8 +9,6 @@ a proper :ref:`Ulid object ` when submitting the form. +---------------------------+-----------------------------------------------------------------------+ | Default invalid message | Please enter a valid ULID. | +---------------------------+-----------------------------------------------------------------------+ -| Legacy invalid message | The value {{ value }} is not valid. | -+---------------------------+-----------------------------------------------------------------------+ | Parent type | :doc:`FormType ` | +---------------------------+-----------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\UlidType` | diff --git a/reference/forms/types/url.rst b/reference/forms/types/url.rst index 96984b23226..d4cb312d2bb 100644 --- a/reference/forms/types/url.rst +++ b/reference/forms/types/url.rst @@ -10,8 +10,6 @@ have a protocol. +---------------------------+-------------------------------------------------------------------+ | Default invalid message | Please enter a valid URL. | +---------------------------+-------------------------------------------------------------------+ -| Legacy invalid message | The value {{ value }} is not valid. | -+---------------------------+-------------------------------------------------------------------+ | Parent type | :doc:`TextType ` | +---------------------------+-------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\UrlType` | diff --git a/reference/forms/types/uuid.rst b/reference/forms/types/uuid.rst index c5aa6c2fdde..664c446bba9 100644 --- a/reference/forms/types/uuid.rst +++ b/reference/forms/types/uuid.rst @@ -9,8 +9,6 @@ a proper :ref:`Uuid object ` when submitting the form. +---------------------------+-----------------------------------------------------------------------+ | Default invalid message | Please enter a valid UUID. | +---------------------------+-----------------------------------------------------------------------+ -| Legacy invalid message | The value {{ value }} is not valid. | -+---------------------------+-----------------------------------------------------------------------+ | Parent type | :doc:`FormType ` | +---------------------------+-----------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\UuidType` | diff --git a/reference/forms/types/week.rst b/reference/forms/types/week.rst index 84ee98aff85..bcd39249015 100644 --- a/reference/forms/types/week.rst +++ b/reference/forms/types/week.rst @@ -14,8 +14,6 @@ the data can be a string or an array. +---------------------------+--------------------------------------------------------------------+ | Default invalid message | Please enter a valid week. | +---------------------------+--------------------------------------------------------------------+ -| Legacy invalid message | The value {{ value }} is not valid. | -+---------------------------+--------------------------------------------------------------------+ | Parent type | :doc:`FormType ` | +---------------------------+--------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\WeekType` | From e1573270fed16a31515c8b97eb175acc09fbf2c0 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 25 Sep 2024 17:49:56 +0200 Subject: [PATCH 360/477] [Testing] Remove an old article --- _build/redirection_map | 1 + testing/http_authentication.rst | 14 -------------- 2 files changed, 1 insertion(+), 14 deletions(-) delete mode 100644 testing/http_authentication.rst diff --git a/_build/redirection_map b/_build/redirection_map index f7c1f65033a..5c11914cfcb 100644 --- a/_build/redirection_map +++ b/_build/redirection_map @@ -568,3 +568,4 @@ /messenger/multiple_buses /messenger#messenger-multiple-buses /frontend/encore/server-data /frontend/server-data /components/string /string +/testing/http_authentication /testing#testing_logging_in_users diff --git a/testing/http_authentication.rst b/testing/http_authentication.rst deleted file mode 100644 index 46ddb82b87d..00000000000 --- a/testing/http_authentication.rst +++ /dev/null @@ -1,14 +0,0 @@ -How to Simulate HTTP Authentication in a Functional Test -======================================================== - -.. caution:: - - Starting from Symfony 5.1, a ``loginUser()`` method was introduced to - ease testing secured applications. See :ref:`testing_logging_in_users` - for more information about this. - - If you are still using an older version of Symfony, view - `previous versions of this article`_ for information on how to simulate - HTTP authentication. - -.. _previous versions of this article: https://symfony.com/doc/5.0/testing/http_authentication.html From 299e6f5e4a4c7a57683aebf315c99df11214beb6 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 25 Sep 2024 17:59:26 +0200 Subject: [PATCH 361/477] [Doctrine][Security] Remove an old article about registration forms --- _build/redirection_map | 1 + doctrine.rst | 1 - doctrine/registration_form.rst | 15 --------------- security.rst | 2 ++ 4 files changed, 3 insertions(+), 16 deletions(-) delete mode 100644 doctrine/registration_form.rst diff --git a/_build/redirection_map b/_build/redirection_map index 5c11914cfcb..8f31032e7a5 100644 --- a/_build/redirection_map +++ b/_build/redirection_map @@ -569,3 +569,4 @@ /frontend/encore/server-data /frontend/server-data /components/string /string /testing/http_authentication /testing#testing_logging_in_users +/doctrine/registration_form /security#security-make-registration-form diff --git a/doctrine.rst b/doctrine.rst index aba27545211..ca1ed25b7b5 100644 --- a/doctrine.rst +++ b/doctrine.rst @@ -1103,7 +1103,6 @@ Learn more doctrine/associations doctrine/events - doctrine/registration_form doctrine/custom_dql_functions doctrine/dbal doctrine/multiple_entity_managers diff --git a/doctrine/registration_form.rst b/doctrine/registration_form.rst deleted file mode 100644 index 7063b7157a4..00000000000 --- a/doctrine/registration_form.rst +++ /dev/null @@ -1,15 +0,0 @@ -How to Implement a Registration Form -==================================== - -This article has been removed because it only explained things that are -already explained in other articles. Specifically, to implement a registration -form you must: - -#. :ref:`Define a class to represent users `; -#. :doc:`Create a form ` to ask for the registration information (you can - generate this with the ``make:registration-form`` command provided by the `MakerBundle`_); -#. Create :doc:`a controller
` to :ref:`process the form `; -#. :ref:`Protect some parts of your application ` so that - only registered users can access to them. - -.. _`MakerBundle`: https://symfony.com/doc/current/bundles/SymfonyMakerBundle/index.html diff --git a/security.rst b/security.rst index 7b1ba5b0b1d..03f41d1714e 100644 --- a/security.rst +++ b/security.rst @@ -449,6 +449,8 @@ the database:: Doctrine repository class related to the user class must implement the :class:`Symfony\\Component\\Security\\Core\\User\\PasswordUpgraderInterface`. +.. _security-make-registration-form: + .. tip:: The ``make:registration-form`` maker command can help you set-up the From 411cd509e036f8169d8a0975bf246d5de23946ea Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Thu, 26 Sep 2024 11:11:38 +0200 Subject: [PATCH 362/477] [Form] Remove a legacy article --- _build/redirection_map | 1 + form/form_dependencies.rst | 12 ------------ forms.rst | 1 - 3 files changed, 1 insertion(+), 13 deletions(-) delete mode 100644 form/form_dependencies.rst diff --git a/_build/redirection_map b/_build/redirection_map index 8f31032e7a5..dd4c92e0776 100644 --- a/_build/redirection_map +++ b/_build/redirection_map @@ -570,3 +570,4 @@ /components/string /string /testing/http_authentication /testing#testing_logging_in_users /doctrine/registration_form /security#security-make-registration-form +/form/form_dependencies /form/create_custom_field_type diff --git a/form/form_dependencies.rst b/form/form_dependencies.rst deleted file mode 100644 index 96b067362ff..00000000000 --- a/form/form_dependencies.rst +++ /dev/null @@ -1,12 +0,0 @@ -How to Access Services or Config from Inside a Form -=================================================== - -The content of this article is no longer relevant because in current Symfony -versions, form classes are services by default and you can inject services in -them using the :doc:`service autowiring ` feature. - -Read the article about :doc:`creating custom form types ` -to see an example of how to inject the database service into a form type. In the -same article you can also read about -:ref:`configuration options for form types `, which is -another way of passing services to forms. diff --git a/forms.rst b/forms.rst index 1e891ab23ef..a90e4ee1772 100644 --- a/forms.rst +++ b/forms.rst @@ -964,7 +964,6 @@ Advanced Features: /controller/upload_file /security/csrf - /form/form_dependencies /form/create_custom_field_type /form/data_transformers /form/data_mappers From eacc9c3980b47b93c7889034dc088f2f483314e8 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 25 Sep 2024 19:52:39 +0200 Subject: [PATCH 363/477] [Doctrine] Delete the article about reverse engineering --- _build/redirection_map | 1 + doctrine.rst | 5 ++--- doctrine/reverse_engineering.rst | 15 --------------- 3 files changed, 3 insertions(+), 18 deletions(-) delete mode 100644 doctrine/reverse_engineering.rst diff --git a/_build/redirection_map b/_build/redirection_map index dd4c92e0776..115ec75ade2 100644 --- a/_build/redirection_map +++ b/_build/redirection_map @@ -571,3 +571,4 @@ /testing/http_authentication /testing#testing_logging_in_users /doctrine/registration_form /security#security-make-registration-form /form/form_dependencies /form/create_custom_field_type +/doctrine/reverse_engineering /doctrine#doctrine-adding-mapping diff --git a/doctrine.rst b/doctrine.rst index ca1ed25b7b5..dc42a5b9e73 100644 --- a/doctrine.rst +++ b/doctrine.rst @@ -84,6 +84,8 @@ affect how Doctrine functions. There are many other Doctrine commands. Run ``php bin/console list doctrine`` to see a full list. +.. _doctrine-adding-mapping: + Creating an Entity Class ------------------------ @@ -91,8 +93,6 @@ Suppose you're building an application where products need to be displayed. Without even thinking about Doctrine or databases, you already know that you need a ``Product`` object to represent those products. -.. _doctrine-adding-mapping: - You can use the ``make:entity`` command to create this class and any fields you need. The command will ask you some questions - answer them like done below: @@ -1107,7 +1107,6 @@ Learn more doctrine/dbal doctrine/multiple_entity_managers doctrine/resolve_target_entity - doctrine/reverse_engineering testing/database .. _`Doctrine`: https://www.doctrine-project.org/ diff --git a/doctrine/reverse_engineering.rst b/doctrine/reverse_engineering.rst deleted file mode 100644 index 35c8e729c2d..00000000000 --- a/doctrine/reverse_engineering.rst +++ /dev/null @@ -1,15 +0,0 @@ -How to Generate Entities from an Existing Database -================================================== - -.. caution:: - - The ``doctrine:mapping:import`` command used to generate Doctrine entities - from existing databases was deprecated by Doctrine in 2019 and there's no - replacement for it. - - Instead, you can use the ``make:entity`` command from `Symfony Maker Bundle`_ - to help you generate the code of your Doctrine entities. This command - requires manual supervision because it doesn't generate entities from - existing databases. - -.. _`Symfony Maker Bundle`: https://symfony.com/bundles/SymfonyMakerBundle/current/index.html From 2492dd1a3dc9df692c3061009ba9d21bd9ef8b16 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Mon, 23 Sep 2024 08:56:16 +0200 Subject: [PATCH 364/477] [Console] Document the silent verbosity level --- components/console/usage.rst | 8 ++++++++ console/input.rst | 7 ++++++- console/verbosity.rst | 23 ++++++++++++++++++++--- 3 files changed, 34 insertions(+), 4 deletions(-) diff --git a/components/console/usage.rst b/components/console/usage.rst index d7725e8926e..591994948b8 100644 --- a/components/console/usage.rst +++ b/components/console/usage.rst @@ -65,9 +65,17 @@ You can suppress output with: .. code-block:: terminal + # suppresses all output, including errors + $ php application.php list --silent + + # suppresses all output except errors $ php application.php list --quiet $ php application.php list -q +.. versionadded:: 7.2 + + The ``--silent`` option was introduced in Symfony 7.2. + You can get more verbose messages (if this is supported for a command) with: diff --git a/console/input.rst b/console/input.rst index 6e7fc85a055..c038ace56fc 100644 --- a/console/input.rst +++ b/console/input.rst @@ -446,12 +446,17 @@ The Console component adds some predefined options to all commands: * ``--verbose``: sets the verbosity level (e.g. ``1`` the default, ``2`` and ``3``, or you can use respective shortcuts ``-v``, ``-vv`` and ``-vvv``) -* ``--quiet``: disables output and interaction +* ``--silent``: disables all output and interaction, including errors +* ``--quiet``: disables output and interaction, but errors are still displayed * ``--no-interaction``: disables interaction * ``--version``: outputs the version number of the console application * ``--help``: displays the command help * ``--ansi|--no-ansi``: whether to force of disable coloring the output +.. versionadded:: 7.2 + + The ``--silent`` option was introduced in Symfony 7.2. + When using the ``FrameworkBundle``, two more options are predefined: * ``--env``: sets the Kernel configuration environment (defaults to ``APP_ENV``) diff --git a/console/verbosity.rst b/console/verbosity.rst index f7a1a1e5e59..9910dca0c3d 100644 --- a/console/verbosity.rst +++ b/console/verbosity.rst @@ -7,7 +7,10 @@ messages, but you can control their verbosity with the ``-q`` and ``-v`` options .. code-block:: terminal - # do not output any message (not even the command result messages) + # suppress all output, including errors + $ php bin/console some-command --silent + + # suppress all output (even the command result messages) but display errors $ php bin/console some-command -q $ php bin/console some-command --quiet @@ -23,6 +26,10 @@ messages, but you can control their verbosity with the ``-q`` and ``-v`` options # display all messages (useful to debug errors) $ php bin/console some-command -vvv +.. versionadded:: 7.2 + + The ``--silent`` option was introduced in Symfony 7.2. + The verbosity level can also be controlled globally for all commands with the ``SHELL_VERBOSITY`` environment variable (the ``-q`` and ``-v`` options still have more precedence over the value of ``SHELL_VERBOSITY``): @@ -30,6 +37,7 @@ have more precedence over the value of ``SHELL_VERBOSITY``): ===================== ========================= =========================================== Console option ``SHELL_VERBOSITY`` value Equivalent PHP constant ===================== ========================= =========================================== +``--silent`` ``-2`` ``OutputInterface::VERBOSITY_SILENT`` ``-q`` or ``--quiet`` ``-1`` ``OutputInterface::VERBOSITY_QUIET`` (none) ``0`` ``OutputInterface::VERBOSITY_NORMAL`` ``-v`` ``1`` ``OutputInterface::VERBOSITY_VERBOSE`` @@ -58,7 +66,7 @@ level. For example:: 'Password: '.$input->getArgument('password'), ]); - // available methods: ->isQuiet(), ->isVerbose(), ->isVeryVerbose(), ->isDebug() + // available methods: ->isSilent(), ->isQuiet(), ->isVerbose(), ->isVeryVerbose(), ->isDebug() if ($output->isVerbose()) { $output->writeln('User class: '.get_class($user)); } @@ -73,10 +81,19 @@ level. For example:: } } -When the quiet level is used, all output is suppressed as the default +.. versionadded:: 7.2 + + The ``isSilent()`` method was introduced in Symfony 7.2. + +When the silent or quiet level are used, all output is suppressed as the default :method:`Symfony\\Component\\Console\\Output\\Output::write` method returns without actually printing. +.. tip:: + + When using the ``silent`` verbosity, errors won't be displayed in the console + but they will still be logged through the :doc:`Symfony logger ` integration. + .. tip:: The MonologBridge provides a :class:`Symfony\\Bridge\\Monolog\\Handler\\ConsoleHandler` From ecb343bf576206de34d57a190447b1128684d8cf Mon Sep 17 00:00:00 2001 From: Kevin Bond Date: Fri, 27 Sep 2024 13:05:03 +0200 Subject: [PATCH 365/477] [Webhook] add Mailtrap webhook docs --- webhook.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/webhook.rst b/webhook.rst index 176abc49cd2..e2c7083ac43 100644 --- a/webhook.rst +++ b/webhook.rst @@ -28,6 +28,7 @@ MailerSend ``mailer.webhook.request_parser.mailersend`` Mailgun ``mailer.webhook.request_parser.mailgun`` Mailjet ``mailer.webhook.request_parser.mailjet`` Mailomat ``mailer.webhook.request_parser.mailomat`` +Mailtrap ``mailer.webhook.request_parser.mailtrap`` Postmark ``mailer.webhook.request_parser.postmark`` Resend ``mailer.webhook.request_parser.resend`` Sendgrid ``mailer.webhook.request_parser.sendgrid`` @@ -40,7 +41,8 @@ Sweego ``mailer.webhook.request_parser.sweego`` .. versionadded:: 7.2 - The ``Mailomat`` and ``Sweego`` integrations were introduced in Symfony 7.2. + The ``Mailomat``, ``Mailtrap``, and ``Sweego`` integrations were introduced in + Symfony 7.2. .. note:: From 0bb5a68545d695d7bf9f9ec31843920756ffdf44 Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Mon, 30 Sep 2024 09:51:52 +0200 Subject: [PATCH 366/477] [String] Add the `AbstractString::kebab()` method --- string.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/string.rst b/string.rst index f2856976986..d9fdeded470 100644 --- a/string.rst +++ b/string.rst @@ -232,6 +232,8 @@ Methods to Change Case u('Foo: Bar-baz.')->camel(); // 'fooBarBaz' // changes all graphemes/code points to snake_case u('Foo: Bar-baz.')->snake(); // 'foo_bar_baz' + // changes all graphemes/code points to kebab-case + u('Foo: Bar-baz.')->kebab(); // 'foo-bar-baz' // other cases can be achieved by chaining methods. E.g. PascalCase: u('Foo: Bar-baz.')->camel()->title(); // 'FooBarBaz' @@ -240,6 +242,10 @@ Methods to Change Case The ``localeLower()``, ``localeUpper()`` and ``localeTitle()`` methods were introduced in Symfony 7.1. +.. versionadded:: 7.2 + + The ``kebab()`` method was introduced in Symfony 7.2. + The methods of all string classes are case-sensitive by default. You can perform case-insensitive operations with the ``ignoreCase()`` method:: From d810f6caabcc1960f5e3d7ffde08a44fa2733fb1 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Mon, 30 Sep 2024 10:09:10 +0200 Subject: [PATCH 367/477] Minor tweaks --- configuration.rst | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/configuration.rst b/configuration.rst index 52dc9b98c95..5ebe952740e 100644 --- a/configuration.rst +++ b/configuration.rst @@ -385,22 +385,17 @@ a new ``locale`` parameter is added to the ``config/services.yaml`` file). Configuration parameters are usually validation-free, but you can ensure that essential parameters for your application's functionality are not empty:: - // ContainerBuilder - $container->parameterCannotBeEmpty('app.private_key', 'Did you forget to configure a non-empty value for "app.private_key" parameter?'); + /** @var ContainerBuilder $container */ + $container->parameterCannotBeEmpty('app.private_key', 'Did you forget to set a value for the "app.private_key" parameter?'); If a non-empty parameter is ``null``, an empty string ``''``, or an empty array ``[]``, -Symfony will throw an exception with the custom error message when attempting to -retrieve the value of this parameter. +Symfony will throw an exception. This validation is **not** made at compile time +but when attempting to retrieve the value of the parameter. .. versionadded:: 7.2 Validating non-empty parameters was introduced in Symfony 7.2. -.. note:: - - Please note that this validation will *only* occur if a non-empty parameter value - is retrieved; otherwise, no exception will be thrown. - .. seealso:: Later in this article you can read how to From a3815364478bdf7d2569655a1092880f06bfc94d Mon Sep 17 00:00:00 2001 From: Pierre Rineau Date: Fri, 28 Jun 2024 12:34:40 +0200 Subject: [PATCH 368/477] [Messenger] document the #[AsMessage] attribute --- messenger.rst | 49 ++++++++++++++++++++++++++++++++++++++++ reference/attributes.rst | 1 + 2 files changed, 50 insertions(+) diff --git a/messenger.rst b/messenger.rst index cecb84d9dec..8ba335b4e2b 100644 --- a/messenger.rst +++ b/messenger.rst @@ -345,6 +345,55 @@ to multiple transports: name as its only argument. For more information about stamps, see `Envelopes & Stamps`_. +.. _messenger-message-attribute: + +Configuring Routing Using Attributes +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +You can optionally use the `#[AsMessage]` attribute to configure message transport:: + + // src/Message/SmsNotification.php + namespace App\Message; + + use Symfony\Component\Messenger\Attribute\AsMessage; + + #[AsMessage(transport: 'async')] + class SmsNotification + { + public function __construct( + private string $content, + ) { + } + + public function getContent(): string + { + return $this->content; + } + } + +.. note:: + + If you configure routing with both configuration and attributes, the + configuration will take precedence over the attributes and override + them. This allows to override routing on a per-environment basis + for example: + + .. code-block:: yaml + + # config/packages/messenger.yaml + when@dev: + framework: + messenger: + routing: + # override class attribute + 'App\Message\SmsNotification': sync + +.. tip:: + + The `$transport` parameter can be either a `string` or an `array`: configuring multiple + transports is possible. You may also repeat the attribute if you prefer instead of using + an array. + Doctrine Entities in Messages ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/reference/attributes.rst b/reference/attributes.rst index 559893ca2e4..19a27b71793 100644 --- a/reference/attributes.rst +++ b/reference/attributes.rst @@ -79,6 +79,7 @@ HttpKernel Messenger ~~~~~~~~~ +* :ref:`AsMessage ` * :ref:`AsMessageHandler ` RemoteEvent From a8a0e2beed33617c7143fbbeaabee884f3b9f357 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Mon, 30 Sep 2024 10:25:40 +0200 Subject: [PATCH 369/477] [AssetMapper] Document the filtering options of debug:asset-map --- frontend/asset_mapper.rst | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/frontend/asset_mapper.rst b/frontend/asset_mapper.rst index f6300e7adb9..6987718381f 100644 --- a/frontend/asset_mapper.rst +++ b/frontend/asset_mapper.rst @@ -137,6 +137,28 @@ This will show you all the mapped paths and the assets inside of each: The "Logical Path" is the path to use when referencing the asset, like from a template. +The ``debug:asset-map`` command provides several options to filter results: + +.. code-block:: terminal + + # provide an asset name or dir to only show results that match it + $ php bin/console debug:asset-map bootstrap.js + $ php bin/console debug:asset-map style/ + + # provide an extension to only show that file type + $ php bin/console debug:asset-map --ext=css + + # you can also only show assets in vendor/ dir or exclude any results from it + $ php bin/console debug:asset-map --vendor + $ php bin/console debug:asset-map --no-vendor + + # you can also combine all filters (e.g. find bold web fonts in your own asset dirs) + $ php bin/console debug:asset-map bold --no-vendor --ext=woff2 + +.. versionadded:: 7.2 + + The options to filter ``debug:asset-map`` results were introduced in Symfony 7.2. + .. _importmaps-javascript: Importmaps & Writing JavaScript From 476c1c1e6795e3384f6d392036147727af627528 Mon Sep 17 00:00:00 2001 From: Kevin Bond Date: Tue, 1 Oct 2024 04:12:12 -0400 Subject: [PATCH 370/477] [Mailer] mark Mailtrap as having Webhook support --- mailer.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mailer.rst b/mailer.rst index a8d0eda3072..2954fa7217a 100644 --- a/mailer.rst +++ b/mailer.rst @@ -109,7 +109,7 @@ Service Install with Webhook su `Mailomat`_ ``composer require symfony/mailomat-mailer`` yes `MailPace`_ ``composer require symfony/mail-pace-mailer`` `MailerSend`_ ``composer require symfony/mailer-send-mailer`` -`Mailtrap`_ ``composer require symfony/mailtrap-mailer`` +`Mailtrap`_ ``composer require symfony/mailtrap-mailer`` yes `Mandrill`_ ``composer require symfony/mailchimp-mailer`` `Postal`_ ``composer require symfony/postal-mailer`` `Postmark`_ ``composer require symfony/postmark-mailer`` yes From 9ac77eefb559c3e223722db352b485c374df9f98 Mon Sep 17 00:00:00 2001 From: W0rma Date: Tue, 1 Oct 2024 13:12:01 +0200 Subject: [PATCH 371/477] [Validator] Add example for passing groups and payload to the Compound constraint --- reference/constraints/Compound.rst | 44 ++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/reference/constraints/Compound.rst b/reference/constraints/Compound.rst index fc8081f5917..0d0dc933ae0 100644 --- a/reference/constraints/Compound.rst +++ b/reference/constraints/Compound.rst @@ -102,6 +102,50 @@ You can now use it anywhere you need it: } } +Validation groups and payload can be passed via constructor: + +.. configuration-block:: + + .. code-block:: php-attributes + + // src/Entity/User.php + namespace App\Entity\User; + + use App\Validator\Constraints as Assert; + + class User + { + #[Assert\PasswordRequirements( + groups: ['registration'], + payload: ['severity' => 'error'], + )] + public string $plainPassword; + } + + .. code-block:: php + + // src/Entity/User.php + namespace App\Entity\User; + + use App\Validator\Constraints as Assert; + use Symfony\Component\Validator\Mapping\ClassMetadata; + + class User + { + public static function loadValidatorMetadata(ClassMetadata $metadata): void + { + $metadata->addPropertyConstraint('plainPassword', new Assert\PasswordRequirements( + groups: ['registration'], + payload: ['severity' => 'error'], + )); + } + } + +.. versionadded:: 7.2 + + Support for passing validation groups and the payload to the constructor + of the ``Compound`` class was introduced in Symfony 7.2. + Options ------- From 743f4c6096f7d6fdd9fc968e402c486064a3b9a6 Mon Sep 17 00:00:00 2001 From: Pierre Ambroise Date: Tue, 1 Oct 2024 14:45:15 +0200 Subject: [PATCH 372/477] Document logical xor in expression language --- reference/formats/expression_language.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/reference/formats/expression_language.rst b/reference/formats/expression_language.rst index f902087d380..368c95bc2a8 100644 --- a/reference/formats/expression_language.rst +++ b/reference/formats/expression_language.rst @@ -345,6 +345,11 @@ Logical Operators * ``not`` or ``!`` * ``and`` or ``&&`` * ``or`` or ``||`` +* ``xor`` + +.. versionadded:: 7.2 + + Support for the ``xor`` logical operator was introduced in Symfony 7.2. For example:: @@ -487,6 +492,8 @@ The following table summarizes the operators and their associativity from the +-----------------------------------------------------------------+---------------+ | ``and``, ``&&`` | left | +-----------------------------------------------------------------+---------------+ +| ``xor`` | left | ++-----------------------------------------------------------------+---------------+ | ``or``, ``||`` | left | +-----------------------------------------------------------------+---------------+ From e8084a2413e3675713321e3749fe9bbbc37eea79 Mon Sep 17 00:00:00 2001 From: johan Vlaar Date: Tue, 1 Oct 2024 16:10:51 +0200 Subject: [PATCH 373/477] [Mailer][Webhook] Mandrill Webhook support --- mailer.rst | 2 +- webhook.rst | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/mailer.rst b/mailer.rst index 2954fa7217a..3dbf8a79575 100644 --- a/mailer.rst +++ b/mailer.rst @@ -110,7 +110,7 @@ Service Install with Webhook su `MailPace`_ ``composer require symfony/mail-pace-mailer`` `MailerSend`_ ``composer require symfony/mailer-send-mailer`` `Mailtrap`_ ``composer require symfony/mailtrap-mailer`` yes -`Mandrill`_ ``composer require symfony/mailchimp-mailer`` +`Mandrill`_ ``composer require symfony/mailchimp-mailer`` yes `Postal`_ ``composer require symfony/postal-mailer`` `Postmark`_ ``composer require symfony/postmark-mailer`` yes `Resend`_ ``composer require symfony/resend-mailer`` yes diff --git a/webhook.rst b/webhook.rst index e2c7083ac43..6b79da037e4 100644 --- a/webhook.rst +++ b/webhook.rst @@ -24,6 +24,7 @@ Currently, the following third-party mailer providers support webhooks: Mailer Service Parser service name ============== ============================================ Brevo ``mailer.webhook.request_parser.brevo`` +Mandrill ``mailer.webhook.request_parser.mailchimp`` MailerSend ``mailer.webhook.request_parser.mailersend`` Mailgun ``mailer.webhook.request_parser.mailgun`` Mailjet ``mailer.webhook.request_parser.mailjet`` @@ -41,7 +42,7 @@ Sweego ``mailer.webhook.request_parser.sweego`` .. versionadded:: 7.2 - The ``Mailomat``, ``Mailtrap``, and ``Sweego`` integrations were introduced in + The ``Mandrill``, ``Mailomat``, ``Mailtrap``, and ``Sweego`` integrations were introduced in Symfony 7.2. .. note:: From 6e2045a3ed2689f9443eb062ea15a54b7261e781 Mon Sep 17 00:00:00 2001 From: W0rma Date: Wed, 2 Oct 2024 07:21:30 +0200 Subject: [PATCH 374/477] [Messenger] Describe the options of the messenger:failed:retry command --- messenger.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/messenger.rst b/messenger.rst index cecb84d9dec..9f75ce33bed 100644 --- a/messenger.rst +++ b/messenger.rst @@ -1173,6 +1173,8 @@ to retry them: $ php bin/console messenger:failed:show 20 -vv # view and retry messages one-by-one + # for each message the command asks whether the message should be retried, + # skipped or deleted $ php bin/console messenger:failed:retry -vv # retry specific messages @@ -1191,6 +1193,11 @@ If the message fails again, it will be re-sent back to the failure transport due to the normal :ref:`retry rules `. Once the max retry has been hit, the message will be discarded permanently. +.. versionadded:: 7.2 + + The possibility to skip a message in the `messenger:failed:retry` + command was introduced in Symfony 7.2 + Multiple Failed Transports ~~~~~~~~~~~~~~~~~~~~~~~~~~ From 795148ee5958773c4f7be614f56358663a677380 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 2 Oct 2024 17:46:12 +0200 Subject: [PATCH 375/477] Minor tweaks --- messenger.rst | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/messenger.rst b/messenger.rst index 9f75ce33bed..add197e8df6 100644 --- a/messenger.rst +++ b/messenger.rst @@ -1172,9 +1172,7 @@ to retry them: # see details about a specific failure $ php bin/console messenger:failed:show 20 -vv - # view and retry messages one-by-one - # for each message the command asks whether the message should be retried, - # skipped or deleted + # for each message, this command asks whether to retry, skip, or delete $ php bin/console messenger:failed:retry -vv # retry specific messages @@ -1195,8 +1193,8 @@ retry has been hit, the message will be discarded permanently. .. versionadded:: 7.2 - The possibility to skip a message in the `messenger:failed:retry` - command was introduced in Symfony 7.2 + The option to skip a message in the ``messenger:failed:retry`` command was + introduced in Symfony 7.2 Multiple Failed Transports ~~~~~~~~~~~~~~~~~~~~~~~~~~ From 50ab3eed6e865d381b3ef914529a63f0a9bb5395 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Mon, 7 Oct 2024 08:37:24 +0200 Subject: [PATCH 376/477] [Mailer] Support unicode email addresses --- mailer.rst | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/mailer.rst b/mailer.rst index 2954fa7217a..e21951df557 100644 --- a/mailer.rst +++ b/mailer.rst @@ -542,6 +542,10 @@ both strings or address objects:: // email address as a simple string ->from('fabien@example.com') + // non-ASCII characters are supported both in the local part and the domain; + // if the SMTP server doesn't support this feature, you'll see an exception + ->from('jânë.dœ@ëxãmplę.com') + // email address as an object ->from(new Address('fabien@example.com')) @@ -556,6 +560,11 @@ both strings or address objects:: // ... ; +.. versionadded:: 7.2 + + Support for non-ASCII email addresses (e.g. ``jânë.dœ@ëxãmplę.com``) + was introduced in Symfony 7.2. + .. tip:: Instead of calling ``->from()`` *every* time you create a new email, you can From 861a0968eec52f837115b5667a18df6485bd2ced Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jib=C3=A9=20Barth?= Date: Sun, 6 Oct 2024 19:28:44 +0200 Subject: [PATCH 377/477] [Console] Document FinishedIndicator for Progress indicator --- .../console/helpers/progressindicator.rst | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/components/console/helpers/progressindicator.rst b/components/console/helpers/progressindicator.rst index d64ec6367b7..dd18c6bdbc9 100644 --- a/components/console/helpers/progressindicator.rst +++ b/components/console/helpers/progressindicator.rst @@ -95,6 +95,26 @@ The progress indicator will now look like this: ⠹ Processing... ⢸ Processing... +Custom Finished Indicator +~~~~~~~~~~~~~~~~~~~~~~~~~ + +Once the progress indicator is finished, it keeps by default the latest indicator value. You can replace it with a your own:: + + $progressIndicator->finish('Finished', '✅'); + +Then the progress indicator will render like this: + +.. code-block:: text + + ⠏ Processing... + ⠛ Processing... + ✅ Finished + +.. versionadded:: 7.2 + + The ``finishedIndicator`` parameter for method ``finish()`` was introduced in Symfony 7.2. + + Customize Placeholders ~~~~~~~~~~~~~~~~~~~~~~ From 1b26f7681a2f4aff35adf89014767972a50a8585 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Mon, 7 Oct 2024 10:21:40 +0200 Subject: [PATCH 378/477] Minor tweaks --- components/console/helpers/progressindicator.rst | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/components/console/helpers/progressindicator.rst b/components/console/helpers/progressindicator.rst index dd18c6bdbc9..fedc8439e64 100644 --- a/components/console/helpers/progressindicator.rst +++ b/components/console/helpers/progressindicator.rst @@ -95,10 +95,8 @@ The progress indicator will now look like this: ⠹ Processing... ⢸ Processing... -Custom Finished Indicator -~~~~~~~~~~~~~~~~~~~~~~~~~ - -Once the progress indicator is finished, it keeps by default the latest indicator value. You can replace it with a your own:: +Once the progress indicator is finished, it keeps the latest indicator value by +default. You can replace it with your own:: $progressIndicator->finish('Finished', '✅'); @@ -114,7 +112,6 @@ Then the progress indicator will render like this: The ``finishedIndicator`` parameter for method ``finish()`` was introduced in Symfony 7.2. - Customize Placeholders ~~~~~~~~~~~~~~~~~~~~~~ From 2c93089f1781396bcd54b6f7f8eec403fa1c87a8 Mon Sep 17 00:00:00 2001 From: Maxime Doutreluingne Date: Sat, 28 Sep 2024 18:47:17 +0200 Subject: [PATCH 379/477] [Serializer] Deprecate ``AdvancedNameConverterInterface`` --- components/serializer.rst | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/components/serializer.rst b/components/serializer.rst index de8f67c853d..0764612e28a 100644 --- a/components/serializer.rst +++ b/components/serializer.rst @@ -549,12 +549,12 @@ A custom name converter can handle such cases:: class OrgPrefixNameConverter implements NameConverterInterface { - public function normalize(string $propertyName): string + public function normalize(string $propertyName, ?string $class = null, ?string $format = null, array $context = []): string { return 'org_'.$propertyName; } - public function denormalize(string $propertyName): string + public function denormalize(string $propertyName, ?string $class = null, ?string $format = null, array $context = []): string { // removes 'org_' prefix return str_starts_with($propertyName, 'org_') ? substr($propertyName, 4) : $propertyName; @@ -584,12 +584,6 @@ and :class:`Symfony\\Component\\Serializer\\Normalizer\\PropertyNormalizer`:: $companyCopy = $serializer->deserialize($json, Company::class, 'json'); // Same data as $company -.. note:: - - You can also implement - :class:`Symfony\\Component\\Serializer\\NameConverter\\AdvancedNameConverterInterface` - to access the current class name, format and context. - .. _using-camelized-method-names-for-underscored-attributes: CamelCase to snake_case From e14e05f4eaea753f625656949d9d9fc4814510ff Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Thu, 3 Oct 2024 10:13:16 +0200 Subject: [PATCH 380/477] Document the new `SYMFONY_*` env vars --- deployment/proxies.rst | 11 ++++++++++- reference/configuration/framework.rst | 14 ++++++++++++-- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/deployment/proxies.rst b/deployment/proxies.rst index fc6f855451d..cd5649d979a 100644 --- a/deployment/proxies.rst +++ b/deployment/proxies.rst @@ -22,7 +22,11 @@ Solution: ``setTrustedProxies()`` --------------------------------- To fix this, you need to tell Symfony which reverse proxy IP addresses to trust -and what headers your reverse proxy uses to send information: +and what headers your reverse proxy uses to send information. + +You can do that by setting the ``SYMFONY_TRUSTED_PROXIES`` and ``SYMFONY_TRUSTED_HEADERS`` +environment variables on your machine. Alternatively, you can configure them +using the following configuration options: .. configuration-block:: @@ -93,6 +97,11 @@ and what headers your reverse proxy uses to send information: ``private_ranges`` as a shortcut for private IP address ranges for the ``trusted_proxies`` option was introduced in Symfony 7.1. +.. versionadded:: 7.2 + + Support for the ``SYMFONY_TRUSTED_PROXIES`` and ``SYMFONY_TRUSTED_HEADERS`` + environment variables was introduced in Symfony 7.2. + .. caution:: Enabling the ``Request::HEADER_X_FORWARDED_HOST`` option exposes the diff --git a/reference/configuration/framework.rst b/reference/configuration/framework.rst index 19f72bb6cb3..53edf220642 100644 --- a/reference/configuration/framework.rst +++ b/reference/configuration/framework.rst @@ -198,7 +198,12 @@ named ``kernel.http_method_override``. trust_x_sendfile_type_header ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -**type**: ``boolean`` **default**: ``false`` +**type**: ``boolean`` **default**: ``%env(bool:default::SYMFONY_TRUST_X_SENDFILE_TYPE_HEADER)%`` + +.. versionadded:: 7.2 + + In Symfony 7.2, the default value of this option was changed from ``false`` to the + value stored in the ``SYMFONY_TRUST_X_SENDFILE_TYPE_HEADER`` environment variable. ``X-Sendfile`` is a special HTTP header that tells web servers to replace the response contents by the file that is defined in that header. This improves @@ -450,7 +455,12 @@ in debug mode. trusted_hosts ~~~~~~~~~~~~~ -**type**: ``array`` | ``string`` **default**: ``[]`` +**type**: ``array`` | ``string`` **default**: ``['%env(default::SYMFONY_TRUSTED_HOSTS)%']`` + +.. versionadded:: 7.2 + + In Symfony 7.2, the default value of this option was changed from ``[]`` to the + value stored in the ``SYMFONY_TRUSTED_HOSTS`` environment variable. A lot of different attacks have been discovered relying on inconsistencies in handling the ``Host`` header by various software (web servers, reverse From 03922de2588b2ec965cd31f40c2ecc4d9b3e0c97 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Thu, 3 Oct 2024 16:04:31 +0200 Subject: [PATCH 381/477] [Ldap] Add support for `sasl_bind` and `whoami` LDAP operations --- components/ldap.rst | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/components/ldap.rst b/components/ldap.rst index 89094fad0b7..d5f6bc3fdfe 100644 --- a/components/ldap.rst +++ b/components/ldap.rst @@ -74,6 +74,19 @@ distinguished name (DN) and the password of a user:: When the LDAP server allows unauthenticated binds, a blank password will always be valid. +You can also use the :method:`Symfony\\Component\\Ldap\\Ldap::saslBind` method +for binding to an LDAP server using `SASL`_:: + + // this method defines other optional arguments like $mech, $realm, $authcId, etc. + $ldap->saslBind($dn, $password); + +After binding to the LDAP server, you can use the :method:`Symfony\\Component\\Ldap\\Ldap::whoami` +method to get the distinguished name (DN) of the authenticated and authorized user. + +.. versionadded:: 7.2 + + The ``saslBind()`` and ``whoami()`` methods were introduced in Symfony 7.2. + Once bound (or if you enabled anonymous authentication on your LDAP server), you may query the LDAP server using the :method:`Symfony\\Component\\Ldap\\Ldap::query` method:: @@ -183,3 +196,5 @@ Possible operation types are ``LDAP_MODIFY_BATCH_ADD``, ``LDAP_MODIFY_BATCH_REMO ``LDAP_MODIFY_BATCH_REMOVE_ALL``, ``LDAP_MODIFY_BATCH_REPLACE``. Parameter ``$values`` must be ``NULL`` when using ``LDAP_MODIFY_BATCH_REMOVE_ALL`` operation type. + +.. _`SASL`: https://en.wikipedia.org/wiki/Simple_Authentication_and_Security_Layer From 3df38498bba9aaede83aafad5366d6449630d437 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=F0=9F=A6=85KoNekoD?= Date: Thu, 10 Oct 2024 11:01:05 +0300 Subject: [PATCH 382/477] feat(when constraint): add context variable --- reference/constraints/When.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/reference/constraints/When.rst b/reference/constraints/When.rst index e1e8ac895ce..12b43fc7d63 100644 --- a/reference/constraints/When.rst +++ b/reference/constraints/When.rst @@ -163,7 +163,7 @@ validation of constraints won't be triggered. To learn more about the expression language syntax, see :doc:`/reference/formats/expression_language`. -Depending on how you use the constraint, you have access to 1 or 2 variables +Depending on how you use the constraint, you have access to 1 or 3 variables in your expression: ``this`` @@ -171,6 +171,8 @@ in your expression: ``value`` The value of the property being validated (only available when the constraint is applied to a property). +``context`` + This is the context that is used in validation The ``value`` variable can be used when you want to execute more complex validation based on its value: From 5e8fb6ebd991577c9645d1df13bdabca8cf3b922 Mon Sep 17 00:00:00 2001 From: Antoine Lamirault Date: Thu, 10 Oct 2024 14:21:34 +0200 Subject: [PATCH 383/477] [Lock] Add NullStore --- components/lock.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/components/lock.rst b/components/lock.rst index 5a76223112b..69e51a1407b 100644 --- a/components/lock.rst +++ b/components/lock.rst @@ -406,6 +406,14 @@ Store Scope Blocking Ex A special ``InMemoryStore`` is available for saving locks in memory during a process, and can be useful for testing. +.. tip:: + + A special ``NullStore`` is available and persist nothing, it can be useful for testing. + +.. versionadded:: 7.2 + + The :class:`Symfony\\Component\\Lock\\Store\\NullStore` was introduced in Symfony 7.2. + .. _lock-store-flock: FlockStore From 52d4f7bc5681bbf563eff8c4db8c439e0151d279 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Thu, 10 Oct 2024 16:06:12 +0200 Subject: [PATCH 384/477] Minor reword --- components/lock.rst | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/components/lock.rst b/components/lock.rst index 69e51a1407b..bf75fb49f7a 100644 --- a/components/lock.rst +++ b/components/lock.rst @@ -403,12 +403,9 @@ Store Scope Blocking Ex .. tip:: - A special ``InMemoryStore`` is available for saving locks in memory during - a process, and can be useful for testing. - -.. tip:: - - A special ``NullStore`` is available and persist nothing, it can be useful for testing. + Symfony includes two other special stores that are mostly useful for testing: + ``InMemoryStore``, which saves locks in memory during a process, and ``NullStore``, + which doesn't persist anything. .. versionadded:: 7.2 From 16bccc3a3bab72597e7ad7bf23a291a12f4b958e Mon Sep 17 00:00:00 2001 From: Benjamin Georgeault Date: Mon, 14 Oct 2024 11:27:37 +0200 Subject: [PATCH 385/477] Add missing ref in constraint map to the new Yaml constraint. --- reference/constraints/map.rst.inc | 1 + 1 file changed, 1 insertion(+) diff --git a/reference/constraints/map.rst.inc b/reference/constraints/map.rst.inc index e0dbd6c4512..97c049dae90 100644 --- a/reference/constraints/map.rst.inc +++ b/reference/constraints/map.rst.inc @@ -34,6 +34,7 @@ String Constraints * :doc:`Charset ` * :doc:`MacAddress ` * :doc:`WordCount ` +* :doc:`Yaml ` Comparison Constraints ~~~~~~~~~~~~~~~~~~~~~~ From d10abd7ad04171dd74b8032826bdb1db910894c7 Mon Sep 17 00:00:00 2001 From: pan93412 Date: Fri, 11 Oct 2024 14:19:45 +0800 Subject: [PATCH 386/477] [Notifier] Add LINE Bot notifier --- notifier.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/notifier.rst b/notifier.rst index 8b684ef2d1d..e5671eea534 100644 --- a/notifier.rst +++ b/notifier.rst @@ -341,6 +341,7 @@ Service Package D `Firebase`_ ``symfony/firebase-notifier`` ``firebase://USERNAME:PASSWORD@default`` `Gitter`_ ``symfony/gitter-notifier`` ``gitter://TOKEN@default?room_id=ROOM_ID`` `GoogleChat`_ ``symfony/google-chat-notifier`` ``googlechat://ACCESS_KEY:ACCESS_TOKEN@default/SPACE?thread_key=THREAD_KEY`` +`LINE Bot`_ ``symfony/line-bot-notifier`` ``linebot://TOKEN@default?receiver=RECEIVER`` `LINE Notify`_ ``symfony/line-notify-notifier`` ``linenotify://TOKEN@default`` `LinkedIn`_ ``symfony/linked-in-notifier`` ``linkedin://TOKEN:USER_ID@default`` `Mastodon`_ ``symfony/mastodon-notifier`` ``mastodon://ACCESS_TOKEN@HOST`` @@ -355,6 +356,10 @@ Service Package D `Zulip`_ ``symfony/zulip-notifier`` ``zulip://EMAIL:TOKEN@HOST?channel=CHANNEL`` ====================================== ==================================== ============================================================================= +.. versionadded:: 7.2 + + The ``LINE Bot`` integration was introduced in Symfony 7.2. + .. versionadded:: 7.1 The ``Bluesky`` integration was introduced in Symfony 7.1. @@ -1100,6 +1105,7 @@ is dispatched. Listeners receive a .. _`Iqsms`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Iqsms/README.md .. _`iSendPro`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Isendpro/README.md .. _`KazInfoTeh`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/KazInfoTeh/README.md +.. _`LINE Bot`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/LineBot/README.md .. _`LINE Notify`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/LineNotify/README.md .. _`LightSms`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/LightSms/README.md .. _`LinkedIn`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/LinkedIn/README.md From b4b0c4c727ae35e16807717307ba37ad48b31777 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Mon, 14 Oct 2024 11:43:52 +0200 Subject: [PATCH 387/477] Minor tweak --- notifier.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/notifier.rst b/notifier.rst index 7d4ce6ef6be..71af2ccb440 100644 --- a/notifier.rst +++ b/notifier.rst @@ -370,14 +370,14 @@ Service Package D `Zulip`_ ``symfony/zulip-notifier`` ``zulip://EMAIL:TOKEN@HOST?channel=CHANNEL`` ====================================== ==================================== ============================================================================= -.. versionadded:: 7.2 - - The ``LINE Bot`` integration was introduced in Symfony 7.2. - .. versionadded:: 7.1 The ``Bluesky`` integration was introduced in Symfony 7.1. +.. versionadded:: 7.2 + + The ``LINE Bot`` integration was introduced in Symfony 7.2. + .. deprecated:: 7.2 The ``Gitter`` integration was removed in Symfony 7.2 because that service From e55e7cda09565450489232ab9144b752f8fe7e73 Mon Sep 17 00:00:00 2001 From: Yonel Ceruto Date: Sun, 13 Oct 2024 15:23:24 -0400 Subject: [PATCH 388/477] documenting choice_lazy option --- reference/forms/types/choice.rst | 2 ++ .../forms/types/options/choice_lazy.rst.inc | 31 +++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 reference/forms/types/options/choice_lazy.rst.inc diff --git a/reference/forms/types/choice.rst b/reference/forms/types/choice.rst index 55f2d016001..2d31aac890c 100644 --- a/reference/forms/types/choice.rst +++ b/reference/forms/types/choice.rst @@ -178,6 +178,8 @@ correct types will be assigned to the model. .. include:: /reference/forms/types/options/choice_loader.rst.inc +.. include:: /reference/forms/types/options/choice_lazy.rst.inc + .. include:: /reference/forms/types/options/choice_name.rst.inc .. include:: /reference/forms/types/options/choice_translation_domain_enabled.rst.inc diff --git a/reference/forms/types/options/choice_lazy.rst.inc b/reference/forms/types/options/choice_lazy.rst.inc new file mode 100644 index 00000000000..db8591a613d --- /dev/null +++ b/reference/forms/types/options/choice_lazy.rst.inc @@ -0,0 +1,31 @@ +``choice_lazy`` +~~~~~~~~~~~~~~~ + +**type**: ``boolean`` **default**: ``false`` + +The ``choice_lazy`` option is especially useful when dealing with a large set of +choices, where loading all of them at once could lead to performance issues or +significant delays:: + + use App\Entity\User; + use Symfony\Bridge\Doctrine\Form\Type\EntityType; + + $builder->add('user', EntityType::class, [ + 'class' => User::class, + 'choice_lazy' => true, + ]); + +When set to ``true``, and used in combination with the ``choice_loader`` option, +the form will only load and render the choices that are preset as default values +or submitted. This allows you to defer loading the full list of choices and can +improve the performance of your form. + +.. caution:: + + Please note that when using ``choice_lazy``, you are responsible for providing + the user interface to select choices, typically through a JavaScript plugin that + can handle the dynamic loading of choices. + +.. versionadded:: 7.2 + + The ``choice_lazy`` option was introduced in Symfony 7.2. From e9bd37b9073074b82a31789851c97b6219e79d1e Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Mon, 14 Oct 2024 14:58:35 +0200 Subject: [PATCH 389/477] merge versionadded directives --- notifier.rst | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/notifier.rst b/notifier.rst index 71af2ccb440..b2329b2b28a 100644 --- a/notifier.rst +++ b/notifier.rst @@ -207,10 +207,6 @@ Service **Webhook support**: No ================== ==================================================================================================================================== -.. versionadded:: 7.2 - - The ``Primotexto`` integration was introduced in Symfony 7.2. - .. tip:: Use :doc:`Symfony configuration secrets ` to securely @@ -229,7 +225,7 @@ Service .. versionadded:: 7.2 - The ``Sipgate`` integration was introduced in Symfony 7.2. + The ``Primotexto`` and ``Sipgate`` integrations were introduced in Symfony 7.2. .. deprecated:: 7.1 From 12dfa63405ec8b7413ec69fa6df8306ce445d648 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Mon, 14 Oct 2024 15:46:52 +0200 Subject: [PATCH 390/477] Minor tweaks --- .../forms/types/options/choice_lazy.rst.inc | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/reference/forms/types/options/choice_lazy.rst.inc b/reference/forms/types/options/choice_lazy.rst.inc index db8591a613d..bdcbf178406 100644 --- a/reference/forms/types/options/choice_lazy.rst.inc +++ b/reference/forms/types/options/choice_lazy.rst.inc @@ -3,9 +3,13 @@ **type**: ``boolean`` **default**: ``false`` -The ``choice_lazy`` option is especially useful when dealing with a large set of -choices, where loading all of them at once could lead to performance issues or -significant delays:: +.. versionadded:: 7.2 + + The ``choice_lazy`` option was introduced in Symfony 7.2. + +The ``choice_lazy`` option is particularly useful when dealing with a large set +of choices, where loading them all at once could cause performance issues or +delays:: use App\Entity\User; use Symfony\Bridge\Doctrine\Form\Type\EntityType; @@ -15,17 +19,13 @@ significant delays:: 'choice_lazy' => true, ]); -When set to ``true``, and used in combination with the ``choice_loader`` option, -the form will only load and render the choices that are preset as default values -or submitted. This allows you to defer loading the full list of choices and can -improve the performance of your form. +When set to ``true`` and used alongside the ``choice_loader`` option, the form +will only load and render the choices that are preset as default values or +submitted. This defers the loading of the full list of choices, helping to +improve your form's performance. .. caution:: - Please note that when using ``choice_lazy``, you are responsible for providing - the user interface to select choices, typically through a JavaScript plugin that - can handle the dynamic loading of choices. - -.. versionadded:: 7.2 - - The ``choice_lazy`` option was introduced in Symfony 7.2. + Keep in mind that when using ``choice_lazy``, you are responsible for + providing the user interface for selecting choices, typically through a + JavaScript plugin capable of dynamically loading choices. From 902d7500886526a147f564d8061a8140d3aa0c45 Mon Sep 17 00:00:00 2001 From: seb-jean Date: Mon, 14 Oct 2024 20:39:46 +0200 Subject: [PATCH 391/477] Update controller.rst --- controller.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/controller.rst b/controller.rst index 17cf30e40ef..4fd03948ae2 100644 --- a/controller.rst +++ b/controller.rst @@ -578,7 +578,7 @@ To do so, map the parameter as an array and configure the type of each element using the ``type`` option of the attribute:: public function dashboard( - #[MapRequestPayload(type: UserDTO::class)] array $users + #[MapRequestPayload(type: UserDto::class)] array $users ): Response { // ... From 93ca37815417a6c11b7d8807beec1d9bf111b557 Mon Sep 17 00:00:00 2001 From: Laurens Laman Date: Tue, 15 Oct 2024 14:56:21 +0200 Subject: [PATCH 392/477] Update progressindicator.rst Corrected false statement about the finishedIndicator. Make documentation more clear --- .../console/helpers/progressindicator.rst | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/components/console/helpers/progressindicator.rst b/components/console/helpers/progressindicator.rst index fedc8439e64..1d4384958e9 100644 --- a/components/console/helpers/progressindicator.rst +++ b/components/console/helpers/progressindicator.rst @@ -44,18 +44,21 @@ level of verbosity of the ``OutputInterface`` instance: | Processing... / Processing... - Processing... + ✔ Finished # OutputInterface::VERBOSITY_VERBOSE (-v) \ Processing... (1 sec) | Processing... (1 sec) / Processing... (1 sec) - Processing... (1 sec) + ✔ Finished (1 sec) # OutputInterface::VERBOSITY_VERY_VERBOSE (-vv) and OutputInterface::VERBOSITY_DEBUG (-vvv) \ Processing... (1 sec, 6.0 MiB) | Processing... (1 sec, 6.0 MiB) / Processing... (1 sec, 6.0 MiB) - Processing... (1 sec, 6.0 MiB) + ✔ Finished (1 sec, 6.0 MiB) .. tip:: @@ -94,22 +97,23 @@ The progress indicator will now look like this: ⠛ Processing... ⠹ Processing... ⢸ Processing... + ✔ Finished -Once the progress indicator is finished, it keeps the latest indicator value by -default. You can replace it with your own:: +Once the progress indicator is finished, it uses the finishedIndicator value (which defaults to ✔). You can replace it with your own:: - $progressIndicator->finish('Finished', '✅'); - -Then the progress indicator will render like this: - -.. code-block:: text + $progressIndicator = new ProgressIndicator($output, 'verbose', 100, null, '🎉'); + + try { + /* do something */ + $progressIndicator->finish('Finished'); + } catch (\Exception) { + $progressIndicator->finish('Failed', '🚨'); + } - ⠏ Processing... - ⠛ Processing... - ✅ Finished .. versionadded:: 7.2 + The ``finishedIndicator`` parameter for the constructor was introduced in Symfony 7.2. The ``finishedIndicator`` parameter for method ``finish()`` was introduced in Symfony 7.2. Customize Placeholders From 7fff76bd4fa1367554b959598c505dee6f4489e5 Mon Sep 17 00:00:00 2001 From: Matthieu Lempereur Date: Tue, 15 Oct 2024 16:36:14 +0200 Subject: [PATCH 393/477] rename addHeader to setHeader in httpclient --- http_client.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/http_client.rst b/http_client.rst index 91b91ebc4a5..bf64026b946 100644 --- a/http_client.rst +++ b/http_client.rst @@ -152,7 +152,7 @@ brings most of the available options with type-hinted getters and setters:: ->setBaseUri('https://...') // replaces *all* headers at once, and deletes the headers you do not provide ->setHeaders(['header-name' => 'header-value']) - // set or replace a single header using addHeader() + // set or replace a single header using setHeader() ->setHeader('another-header-name', 'another-header-value') ->toArray() ); From d926bbb4e7cb2cd75e0f2f444a3b41dc3a1938d5 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 16 Oct 2024 10:53:34 +0200 Subject: [PATCH 394/477] Reword --- messenger.rst | 102 +++++++++++++++++++++++++------------------------- 1 file changed, 50 insertions(+), 52 deletions(-) diff --git a/messenger.rst b/messenger.rst index 03c429e214e..9cb6b4a6ff4 100644 --- a/messenger.rst +++ b/messenger.rst @@ -203,8 +203,23 @@ Routing Messages to a Transport Now that you have a transport configured, instead of handling a message immediately, you can configure them to be sent to a transport: +.. _messenger-message-attribute: + .. configuration-block:: + .. code-block:: php-attributes + + // src/Message/SmsNotification.php + namespace App\Message; + + use Symfony\Component\Messenger\Attribute\AsMessage; + + #[AsMessage('async')] + class SmsNotification + { + // ... + } + .. code-block:: yaml # config/packages/messenger.yaml @@ -251,15 +266,26 @@ you can configure them to be sent to a transport: ; }; +.. versionadded:: 7.2 + + The ``#[AsMessage]`` attribute was introduced in Symfony 7.2. + Thanks to this, the ``App\Message\SmsNotification`` will be sent to the ``async`` transport and its handler(s) will *not* be called immediately. Any messages not matched under ``routing`` will still be handled immediately, i.e. synchronously. .. note:: - You may 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. + If you configure routing with both YAML/XML/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 + 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. You may use ``'*'`` as the message class. This will act as a default routing rule for any message not matched under ``routing``. This is useful to ensure @@ -275,6 +301,27 @@ to multiple transports: .. configuration-block:: + .. code-block:: php-attributes + + // src/Message/SmsNotification.php + namespace App\Message; + + use Symfony\Component\Messenger\Attribute\AsMessage; + + #[AsMessage(['async', 'audit'])] + class SmsNotification + { + // ... + } + + // if you prefer, you can also apply multiple attributes to the message class + #[AsMessage('async')] + #[AsMessage('audit')] + class SmsNotification + { + // ... + } + .. code-block:: yaml # config/packages/messenger.yaml @@ -345,55 +392,6 @@ to multiple transports: name as its only argument. For more information about stamps, see `Envelopes & Stamps`_. -.. _messenger-message-attribute: - -Configuring Routing Using Attributes -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -You can optionally use the `#[AsMessage]` attribute to configure message transport:: - - // src/Message/SmsNotification.php - namespace App\Message; - - use Symfony\Component\Messenger\Attribute\AsMessage; - - #[AsMessage(transport: 'async')] - class SmsNotification - { - public function __construct( - private string $content, - ) { - } - - public function getContent(): string - { - return $this->content; - } - } - -.. note:: - - If you configure routing with both configuration and attributes, the - configuration will take precedence over the attributes and override - them. This allows to override routing on a per-environment basis - for example: - - .. code-block:: yaml - - # config/packages/messenger.yaml - when@dev: - framework: - messenger: - routing: - # override class attribute - 'App\Message\SmsNotification': sync - -.. tip:: - - The `$transport` parameter can be either a `string` or an `array`: configuring multiple - transports is possible. You may also repeat the attribute if you prefer instead of using - an array. - Doctrine Entities in Messages ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ From 9d85b6904c11777c31263b276152ad980cbd08fc Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 16 Oct 2024 16:43:56 +0200 Subject: [PATCH 395/477] Tweaks --- components/console/helpers/progressindicator.rst | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/components/console/helpers/progressindicator.rst b/components/console/helpers/progressindicator.rst index 1d4384958e9..0defe7c83fd 100644 --- a/components/console/helpers/progressindicator.rst +++ b/components/console/helpers/progressindicator.rst @@ -99,9 +99,10 @@ The progress indicator will now look like this: ⢸ Processing... ✔ Finished -Once the progress indicator is finished, it uses the finishedIndicator value (which defaults to ✔). You can replace it with your own:: +Once the progress finishes, it displays a special finished indicator (which defaults +to ✔). You can replace it with your own:: - $progressIndicator = new ProgressIndicator($output, 'verbose', 100, null, '🎉'); + $progressIndicator = new ProgressIndicator($output, finishedIndicatorValue: '🎉'); try { /* do something */ @@ -110,6 +111,15 @@ Once the progress indicator is finished, it uses the finishedIndicator value (wh $progressIndicator->finish('Failed', '🚨'); } +The progress indicator will now look like this: + +.. code-block:: text + + \ Processing... + | Processing... + / Processing... + - Processing... + 🎉 Finished .. versionadded:: 7.2 From 6473d6c91f016b26b28ec8dc083fc300b0525133 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 16 Oct 2024 16:50:50 +0200 Subject: [PATCH 396/477] Finished the docs --- security/user_checkers.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/security/user_checkers.rst b/security/user_checkers.rst index 1e1dcaf3e55..ec8f49da522 100644 --- a/security/user_checkers.rst +++ b/security/user_checkers.rst @@ -21,6 +21,8 @@ displayed to the user:: namespace App\Security; use App\Entity\User as AppUser; + use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; + use Symfony\Component\Security\Core\Exception\AccessDeniedException; use Symfony\Component\Security\Core\Exception\AccountExpiredException; use Symfony\Component\Security\Core\Exception\CustomUserMessageAccountStatusException; use Symfony\Component\Security\Core\User\UserCheckerInterface; @@ -50,9 +52,17 @@ displayed to the user:: if ($user->isExpired()) { throw new AccountExpiredException('...'); } + + if (!\in_array('foo', $token->getRoleNames())) { + throw new AccessDeniedException('...'); + } } } +.. versionadded:: 7.2 + + The ``token`` argument for the ``checkPostAuth()`` method was introduced in Symfony 7.2. + Enabling the Custom User Checker -------------------------------- From f932585d967262ffcd0f2b63ac47faa043e9d3bf Mon Sep 17 00:00:00 2001 From: Mathieu Santostefano Date: Sat, 19 Oct 2024 16:52:24 +0200 Subject: [PATCH 397/477] Add Sweego Notifier doc --- notifier.rst | 6 +++++- webhook.rst | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/notifier.rst b/notifier.rst index b2329b2b28a..144044ebe3e 100644 --- a/notifier.rst +++ b/notifier.rst @@ -187,6 +187,9 @@ Service `SpotHit`_ **Install**: ``composer require symfony/spot-hit-notifier`` \ **DSN**: ``spothit://TOKEN@default?from=FROM`` \ **Webhook support**: No +`Sweego`_ **Install**: ``composer require symfony/sweego-notifier`` \ + **DSN**: ``sweego://API_KEY@default?region=REGION&campaign_type=CAMPAIGN_TYPE`` \ + **Webhook support**: Yes `Telnyx`_ **Install**: ``composer require symfony/telnyx-notifier`` \ **DSN**: ``telnyx://API_KEY@default?from=FROM&messaging_profile_id=MESSAGING_PROFILE_ID`` \ **Webhook support**: No @@ -225,7 +228,7 @@ Service .. versionadded:: 7.2 - The ``Primotexto`` and ``Sipgate`` integrations were introduced in Symfony 7.2. + The ``Primotexto``, ``Sipgate`` and ``Sweego`` integrations were introduced in Symfony 7.2. .. deprecated:: 7.1 @@ -1239,6 +1242,7 @@ is dispatched. Listeners receive a .. _`SMSense`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/SMSense/README.md .. _`SmsSluzba`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/SmsSluzba/README.md .. _`SpotHit`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/SpotHit/README.md +.. _`Sweego`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Sweego/README.md .. _`Telegram`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Telegram/README.md .. _`Telnyx`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Telnyx/README.md .. _`TurboSms`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/TurboSms/README.md diff --git a/webhook.rst b/webhook.rst index 6b79da037e4..aba95cffb04 100644 --- a/webhook.rst +++ b/webhook.rst @@ -166,6 +166,7 @@ Currently, the following third-party SMS transports support webhooks: SMS service Parser service name ============ ========================================== Twilio ``notifier.webhook.request_parser.twilio`` +Sweego ``notifier.webhook.request_parser.sweego`` Vonage ``notifier.webhook.request_parser.vonage`` ============ ========================================== From ef9baef15df2f02bec0221f78cbab3151695f542 Mon Sep 17 00:00:00 2001 From: Matthieu Lempereur Date: Mon, 21 Oct 2024 08:56:56 +0200 Subject: [PATCH 398/477] fix param name for lint:translations --- translation.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/translation.rst b/translation.rst index 4663d9d7c15..a1d012f3b38 100644 --- a/translation.rst +++ b/translation.rst @@ -1405,7 +1405,7 @@ to check that the translation contents are also correct: $ php bin/console lint:translations # checks the contents of the translation catalogues for Italian (it) and Japanese (ja) locales - $ php bin/console lint:translations --locales=it --locales=ja + $ php bin/console lint:translations --locale=it --locale=ja .. versionadded:: 7.2 From b8e5d0c59bf7a287687317026f56b7f5cd8d1f03 Mon Sep 17 00:00:00 2001 From: Jawira Portugal Date: Sun, 27 Oct 2024 19:23:45 +0100 Subject: [PATCH 399/477] Add --prefix and --no-fill to translation page --- translation.rst | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/translation.rst b/translation.rst index a1d012f3b38..2bbce00977a 100644 --- a/translation.rst +++ b/translation.rst @@ -467,8 +467,33 @@ The ``translation:extract`` command looks for missing translations in: $ composer require nikic/php-parser +By default, the ``translation:extract`` command extracts new messages in +*message/translation* pairs, with the translation populated with the same +text as the message, prefixed by ``__``. You can customize this prefix using +the ``--prefix`` option. + +If you want to leave new translations empty, use the ``--no-fill`` option. +When enabled, only messages are created, and the translation strings are left +empty. This is particularly useful when using external translation tools, as +it ensures untranslated strings are easily identifiable without any pre-filled +content. Note that when ``--no-fill`` is used, the ``--prefix`` option has +no effect. + +.. code-block:: terminal + + # changes default prefix + $ php bin/console translation:extract --force --prefix="NEW_" fr + + # leaves new translations empty + $ php bin/console translation:extract --force --no-fill fr + +.. versionadded:: 7.2 + + The ``--no-fill`` option was introduced in Symfony 7.2. + .. _translation-resource-locations: + Translation Resource/File Names and Locations --------------------------------------------- From 65a14d07553951cf305069d4d56485898d8121b6 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Mon, 28 Oct 2024 17:59:56 +0100 Subject: [PATCH 400/477] Minor tweaks --- translation.rst | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/translation.rst b/translation.rst index 2bbce00977a..a41b305dc8b 100644 --- a/translation.rst +++ b/translation.rst @@ -467,24 +467,23 @@ The ``translation:extract`` command looks for missing translations in: $ composer require nikic/php-parser -By default, the ``translation:extract`` command extracts new messages in -*message/translation* pairs, with the translation populated with the same -text as the message, prefixed by ``__``. You can customize this prefix using -the ``--prefix`` option. - -If you want to leave new translations empty, use the ``--no-fill`` option. -When enabled, only messages are created, and the translation strings are left -empty. This is particularly useful when using external translation tools, as -it ensures untranslated strings are easily identifiable without any pre-filled -content. Note that when ``--no-fill`` is used, the ``--prefix`` option has -no effect. +By default, when the ``translation:extract`` command creates new entries in the +trnaslation file, it uses the same content as both the source and the pending +translation. The only difference is that the pending translation is prefixed by +``__``. You can customize this prefix using the ``--prefix`` option: .. code-block:: terminal - # changes default prefix $ php bin/console translation:extract --force --prefix="NEW_" fr - # leaves new translations empty +Alternatively, you can use the ``--no-fill`` option to leave the pending translation +completely empty when creating new entries in the translation catalog. This is +particularly useful when using external translation tools, as it makes it easier +to spot untranslated strings: + +.. code-block:: terminal + + # when using the --no-fill option, the --prefix option is ignored $ php bin/console translation:extract --force --no-fill fr .. versionadded:: 7.2 @@ -493,7 +492,6 @@ no effect. .. _translation-resource-locations: - Translation Resource/File Names and Locations --------------------------------------------- From 562893be94672b5987b74521d8abebac4d618d30 Mon Sep 17 00:00:00 2001 From: Jawira Portugal Date: Mon, 28 Oct 2024 22:10:26 +0100 Subject: [PATCH 401/477] fix typo --- translation.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/translation.rst b/translation.rst index a41b305dc8b..0e5f09d342e 100644 --- a/translation.rst +++ b/translation.rst @@ -468,7 +468,7 @@ The ``translation:extract`` command looks for missing translations in: $ composer require nikic/php-parser By default, when the ``translation:extract`` command creates new entries in the -trnaslation file, it uses the same content as both the source and the pending +translation file, it uses the same content as both the source and the pending translation. The only difference is that the pending translation is prefixed by ``__``. You can customize this prefix using the ``--prefix`` option: From e033e433ab3d65e88fc5470662ecc485fc3117a6 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Tue, 29 Oct 2024 10:07:55 +0100 Subject: [PATCH 402/477] [Notifier] Add some examples to the new Desktop channel notifications --- notifier.rst | 71 ++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 61 insertions(+), 10 deletions(-) diff --git a/notifier.rst b/notifier.rst index 144044ebe3e..b28bb541475 100644 --- a/notifier.rst +++ b/notifier.rst @@ -33,8 +33,14 @@ The notifier component supports the following channels: services like Slack and Telegram; * :ref:`Email channel ` integrates the :doc:`Symfony Mailer `; * Browser channel uses :ref:`flash messages `. -* :ref:`Push channel ` sends notifications to phones and browsers via push notifications. -* :ref:`Desktop channel ` displays desktop notifications on the same host machine. +* :ref:`Push channel ` sends notifications to phones and + browsers via push notifications. +* :ref:`Desktop channel ` displays desktop notifications + on the same host machine. + +.. versionadded:: 7.2 + + The ``Desktop`` channel was introduced in Symfony 7.2. .. _notifier-sms-channel: @@ -635,9 +641,9 @@ configure the ``texter_transports``: Desktop Channel ~~~~~~~~~~~~~~~ -The desktop channel is used to display desktop notifications on the same host machine using -:class:`Symfony\\Component\\Notifier\\Texter` classes. Currently, Symfony -is integrated with the following providers: +The desktop channel is used to display local desktop notifications on the same +host machine using :class:`Symfony\\Component\\Notifier\\Texter` classes. Currently, +Symfony is integrated with the following providers: =============== ==================================== ============================================================================== Provider Package DSN @@ -645,18 +651,23 @@ Provider Package DSN `JoliNotif`_ ``symfony/joli-notif-notifier`` ``jolinotif://default`` =============== ==================================== ============================================================================== -.. versionadded: 7.2 +.. versionadded:: 7.2 The JoliNotif bridge was introduced in Symfony 7.2. -To enable a texter, add the correct DSN in your ``.env`` file and -configure the ``texter_transports``: +If you are using :ref:`Symfony Flex `, installing that package will +also create the necessary environment variable and configuration. Otherwise, you'll +need to add the following manually: + +1) Add the correct DSN in your ``.env`` file: .. code-block:: bash # .env JOLINOTIF=jolinotif://default +2) Update the Notifier configuration to add a new texter transport: + .. configuration-block:: .. code-block:: yaml @@ -699,9 +710,49 @@ configure the ``texter_transports``: ; }; -.. versionadded:: 7.2 +Now you can send notifications to your desktop as follows:: - The ``Desktop`` channel was introduced in Symfony 7.2. + // src/Notifier/SomeService.php + use Symfony\Component\Notifier\Message\DesktopMessage; + use Symfony\Component\Notifier\TexterInterface; + // ... + + class SomeService + { + public function __construct( + private TexterInterface $texter, + ) { + } + + public function notifyNewSubscriber(User $user): void + { + $message = new DesktopMessage( + 'New subscription! 🎉', + sprintf('%s is a new subscriber', $user->getFullName()) + ); + + $texter->send($message); + } + } + +These notifications can be customized further, and depending on your operating system, +they may support features like custom sounds, icons, and more:: + + use Symfony\Component\Notifier\Bridge\JoliNotif\JoliNotifOptions; + // ... + + $options = (new JoliNotifOptions()) + ->setIconPath('/path/to/icons/error.png') + ->setExtraOption('sound', 'sosumi') + ->setExtraOption('url', 'https://example.com'); + + $message = new DesktopMessage('Production is down', <<send($message); Configure to use Failover or Round-Robin Transports ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ From d20ac34ac17254dc48a74ced515948a825ceae35 Mon Sep 17 00:00:00 2001 From: Raffaele Carelle Date: Mon, 4 Nov 2024 09:48:23 +0100 Subject: [PATCH 403/477] add stringNode documentation --- components/config/definition.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/components/config/definition.rst b/components/config/definition.rst index 929246fa915..05f64497a66 100644 --- a/components/config/definition.rst +++ b/components/config/definition.rst @@ -83,6 +83,12 @@ reflect the real structure of the configuration values:: ->scalarNode('default_connection') ->defaultValue('mysql') ->end() + ->stringNode('username') + ->defaultValue('root') + ->end() + ->stringNode('password') + ->defaultValue('root') + ->end() ->end() ; @@ -100,6 +106,7 @@ node definition. Node types are available for: * scalar (generic type that includes booleans, strings, integers, floats and ``null``) * boolean +* string * integer * float * enum (similar to scalar, but it only allows a finite set of values) From 1a72556ae9bc4cc769fac8e81d950fc0afb2c6ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maxime=20H=C3=A9lias?= Date: Thu, 7 Nov 2024 13:26:14 +0100 Subject: [PATCH 404/477] [DependencyInjection] fix attribute first element --- service_container/service_decoration.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service_container/service_decoration.rst b/service_container/service_decoration.rst index 97c4c25090b..0f75b5284c8 100644 --- a/service_container/service_decoration.rst +++ b/service_container/service_decoration.rst @@ -630,7 +630,7 @@ Three different behaviors are available: class Bar { public function __construct( - private #[AutowireDecorated] $inner, + #[AutowireDecorated] private $inner, ) { } From 970d37b45d9b609376ce7c77f8a8384d954f509f Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Thu, 7 Nov 2024 16:47:56 +0100 Subject: [PATCH 405/477] Add the versionadded directives --- components/config/definition.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/components/config/definition.rst b/components/config/definition.rst index 05f64497a66..4e99fb4f6a7 100644 --- a/components/config/definition.rst +++ b/components/config/definition.rst @@ -92,6 +92,10 @@ reflect the real structure of the configuration values:: ->end() ; +.. versionadded:: 7.2 + + The ``stringNode()`` method was introduced in Symfony 7.2. + The root node itself is an array node, and has children, like the boolean node ``auto_connect`` and the scalar node ``default_connection``. In general: after defining a node, a call to ``end()`` takes you one step up in the @@ -116,6 +120,10 @@ node definition. Node types are available for: and are created with ``node($name, $type)`` or their associated shortcut ``xxxxNode($name)`` method. +.. versionadded:: + + Support for ``string`` types was introduced in Symfony 7.2. + Numeric Node Constraints ~~~~~~~~~~~~~~~~~~~~~~~~ From 7eb2264b2f1dff013aed0a9ffd32c6974f3f1270 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Fri, 8 Nov 2024 14:45:59 +0100 Subject: [PATCH 406/477] fix versionadded directive --- components/config/definition.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/config/definition.rst b/components/config/definition.rst index 4e99fb4f6a7..0db9923a340 100644 --- a/components/config/definition.rst +++ b/components/config/definition.rst @@ -120,9 +120,9 @@ node definition. Node types are available for: and are created with ``node($name, $type)`` or their associated shortcut ``xxxxNode($name)`` method. -.. versionadded:: +.. versionadded:: 7.2 - Support for ``string`` types was introduced in Symfony 7.2. + Support for the ``string`` type was introduced in Symfony 7.2. Numeric Node Constraints ~~~~~~~~~~~~~~~~~~~~~~~~ From 626d56ef5863b08a206196cb089a1d2c2557339c Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Sat, 9 Nov 2024 11:08:20 +0100 Subject: [PATCH 407/477] remove note about the reverted Default group change --- serializer.rst | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/serializer.rst b/serializer.rst index 91fd92a39a3..bfd838bc4bb 100644 --- a/serializer.rst +++ b/serializer.rst @@ -385,18 +385,6 @@ stored in one of the following locations: * All ``*.yaml`` and ``*.xml`` files in the ``Resources/config/serialization/`` directory of a bundle. -.. note:: - - The groups used by default when normalizing and denormalizing objects are - ``Default`` and the group that matches the class name. For example, if you - are normalizing a ``App\Entity\Product`` object, the groups used are - ``Default`` and ``Product``. - - .. versionadded:: 7.1 - - The default use of the class name and ``Default`` groups when normalizing - and denormalizing objects was introduced in Symfony 7.1. - .. _serializer-enabling-metadata-cache: Using Nested Attributes From 8ed98d3230446e82ee5dab677dc0afc8a9c53f66 Mon Sep 17 00:00:00 2001 From: Matthieu Lempereur Date: Mon, 11 Nov 2024 17:44:07 +0100 Subject: [PATCH 408/477] add a missing value in MacAdress constraint --- reference/constraints/MacAddress.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/reference/constraints/MacAddress.rst b/reference/constraints/MacAddress.rst index 59adffe7c11..9a282ddf118 100644 --- a/reference/constraints/MacAddress.rst +++ b/reference/constraints/MacAddress.rst @@ -132,6 +132,7 @@ Parameter Allowed MAC addresses ``multicast_no_broadcast`` Only multicast except broadcast ``unicast_all`` Only unicast ``universal_all`` Only universal +``universal_unicast`` Only universal and unicast ``universal_multicast`` Only universal and multicast ================================ ========================================= From f40f01b78d41fbf7ee52a6f5aba26d866f08129d Mon Sep 17 00:00:00 2001 From: Matthieu Lempereur Date: Mon, 11 Nov 2024 17:22:23 +0100 Subject: [PATCH 409/477] [Validator] Improve type for the `mode` property of the `Bic` constraint --- reference/constraints/Bic.rst | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/reference/constraints/Bic.rst b/reference/constraints/Bic.rst index 3f05e5eac25..313de3bdbbf 100644 --- a/reference/constraints/Bic.rst +++ b/reference/constraints/Bic.rst @@ -124,18 +124,13 @@ Parameter Description ``mode`` ~~~~~~~~ -**type**: ``string`` **default**: ``strict`` +**type**: ``string`` **default**: ``BIC::VALIDATION_MODE_STRICT`` -This option defines how the BIC is validated: +This option defines how the BIC is validated. Available constants are defined +in the :class:`Symfony\\Component\\Validator\\Constraints\\BIC` class. -* ``strict`` validates the given value without any modification; -* ``case-insensitive`` converts the given value to uppercase before validating it. - -.. tip:: - - The possible values of this option are also defined as PHP constants of - :class:`Symfony\\Component\\Validator\\Constraints\\BIC` - (e.g. ``BIC::VALIDATION_MODE_CASE_INSENSITIVE``). +* ``BIC::VALIDATION_MODE_STRICT`` validates the given value without any modification; +* ``BIC::VALIDATION_MODE_CASE_INSENSITIVE`` converts the given value to uppercase before validating it. .. versionadded:: 7.2 From bc8c2d222b0f89f92f630ac4de7e5674f9e11a35 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 13 Nov 2024 17:10:23 +0100 Subject: [PATCH 410/477] Minor tweaks --- reference/constraints/Bic.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/reference/constraints/Bic.rst b/reference/constraints/Bic.rst index 313de3bdbbf..6cde4a11bac 100644 --- a/reference/constraints/Bic.rst +++ b/reference/constraints/Bic.rst @@ -124,13 +124,13 @@ Parameter Description ``mode`` ~~~~~~~~ -**type**: ``string`` **default**: ``BIC::VALIDATION_MODE_STRICT`` +**type**: ``string`` **default**: ``Bic::VALIDATION_MODE_STRICT`` -This option defines how the BIC is validated. Available constants are defined -in the :class:`Symfony\\Component\\Validator\\Constraints\\BIC` class. +This option defines how the BIC is validated. The possible values are available +as constants in the :class:`Symfony\\Component\\Validator\\Constraints\\Bic` class: -* ``BIC::VALIDATION_MODE_STRICT`` validates the given value without any modification; -* ``BIC::VALIDATION_MODE_CASE_INSENSITIVE`` converts the given value to uppercase before validating it. +* ``Bic::VALIDATION_MODE_STRICT`` validates the given value without any modification; +* ``Bic::VALIDATION_MODE_CASE_INSENSITIVE`` converts the given value to uppercase before validating it. .. versionadded:: 7.2 From 40058d823673436e935308a05acd87db028fbb7c Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Thu, 14 Nov 2024 08:39:36 +0100 Subject: [PATCH 411/477] the TypeInfo component is no longer experimental --- components/type_info.rst | 5 ----- 1 file changed, 5 deletions(-) diff --git a/components/type_info.rst b/components/type_info.rst index 30ae11aa222..f46c8f8ab3a 100644 --- a/components/type_info.rst +++ b/components/type_info.rst @@ -11,11 +11,6 @@ This component provides: * A way to get types from PHP elements such as properties, method arguments, return types, and raw strings. -.. caution:: - - This component is :doc:`experimental ` and - could be changed at any time without prior notice. - Installation ------------ From 8b9ca6f5e9c1c4964cebc08b35de6344f5902870 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Sat, 16 Nov 2024 10:22:58 +0100 Subject: [PATCH 412/477] remove documentation about no longer existing getBaseType() method --- components/type_info.rst | 6 ------ 1 file changed, 6 deletions(-) diff --git a/components/type_info.rst b/components/type_info.rst index f46c8f8ab3a..bbc7d0ea8dc 100644 --- a/components/type_info.rst +++ b/components/type_info.rst @@ -58,12 +58,6 @@ based on reflection or a simple string:: // Type instances have several helper methods - // returns the main type (e.g. in this example it returns an "array" Type instance); - // for nullable types (e.g. string|null) it returns the non-null type (e.g. string) - // and for compound types (e.g. int|string) it throws an exception because both types - // can be considered the main one, so there's no way to pick one - $baseType = $type->getBaseType(); - // for collections, it returns the type of the item used as the key; // in this example, the collection is a list, so it returns an "int" Type instance $keyType = $type->getCollectionKeyType(); From 4eed10be822e64078281704b91b404b8803d2d3d Mon Sep 17 00:00:00 2001 From: Matthieu Lempereur Date: Mon, 18 Nov 2024 09:44:26 +0100 Subject: [PATCH 413/477] mailersend support webhook --- mailer.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mailer.rst b/mailer.rst index 6527fecaa16..b8421cc6d26 100644 --- a/mailer.rst +++ b/mailer.rst @@ -107,7 +107,7 @@ Service Install with Webhook su `Mailgun`_ ``composer require symfony/mailgun-mailer`` yes `Mailjet`_ ``composer require symfony/mailjet-mailer`` yes `MailPace`_ ``composer require symfony/mail-pace-mailer`` -`MailerSend`_ ``composer require symfony/mailer-send-mailer`` +`MailerSend`_ ``composer require symfony/mailer-send-mailer`` yes `Mandrill`_ ``composer require symfony/mailchimp-mailer`` `Postmark`_ ``composer require symfony/postmark-mailer`` yes `Resend`_ ``composer require symfony/resend-mailer`` yes From 2f8a9d656df47bbe5cdd25094ffb183af8aba376 Mon Sep 17 00:00:00 2001 From: Wouter de Jong Date: Sat, 23 Nov 2024 18:00:57 +0100 Subject: [PATCH 414/477] Syntax fixes --- serializer.rst | 2 +- serializer/custom_normalizer.rst | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/serializer.rst b/serializer.rst index 6a12f689512..648b44670f1 100644 --- a/serializer.rst +++ b/serializer.rst @@ -1266,7 +1266,7 @@ normalizers (in order of priority): :phpclass:`DateTime` and :phpclass:`DateTimeImmutable`) into strings, integers or floats. By default, it converts them to strings using the - `RFC3339`_ format. Use ``DateTimeNormalizer::FORMAT_KEY`` and + `RFC 3339`_ format. Use ``DateTimeNormalizer::FORMAT_KEY`` and ``DateTimeNormalizer::TIMEZONE_KEY`` to change the format. To convert the objects to integers or floats, set the serializer diff --git a/serializer/custom_normalizer.rst b/serializer/custom_normalizer.rst index 26eacdeba0b..10092c6baa7 100644 --- a/serializer/custom_normalizer.rst +++ b/serializer/custom_normalizer.rst @@ -76,6 +76,7 @@ If you're not using ``autoconfigure``, you have to tag the service with .. configuration-block:: .. code-block:: yaml + # config/services.yaml services: # ... From 337b5974e08ee43012ccd3ec6174f35409ccea41 Mon Sep 17 00:00:00 2001 From: Wouter de Jong Date: Sat, 23 Nov 2024 18:03:07 +0100 Subject: [PATCH 415/477] More syntax fixes --- serializer/encoders.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/serializer/encoders.rst b/serializer/encoders.rst index 65eece78031..003eb4523fe 100644 --- a/serializer/encoders.rst +++ b/serializer/encoders.rst @@ -65,7 +65,7 @@ are available to customize the behavior of the encoder: ``csv_end_of_line`` (default: ``\n``) Sets the character(s) used to mark the end of each line in the CSV file. ``csv_escape_char`` (default: empty string) - .. deprecated:: + .. deprecated:: 7.2 The ``csv_escape_char`` option was deprecated in Symfony 7.2. From dc999f33194b22851c44ba6147833b1e8003bc8f Mon Sep 17 00:00:00 2001 From: Baptiste Leduc Date: Fri, 15 Nov 2024 10:20:18 +0100 Subject: [PATCH 416/477] Add more details to TypeInfo documentation --- components/type_info.rst | 100 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 97 insertions(+), 3 deletions(-) diff --git a/components/type_info.rst b/components/type_info.rst index bbc7d0ea8dc..18556e02972 100644 --- a/components/type_info.rst +++ b/components/type_info.rst @@ -40,12 +40,24 @@ to the :class:`Symfony\\Component\\TypeInfo\\Type` static methods as following:: // Many others are available and can be // found in Symfony\Component\TypeInfo\TypeFactoryTrait +Resolvers +~~~~~~~~~ + The second way of using the component is to use ``TypeInfo`` to resolve a type -based on reflection or a simple string:: +based on reflection or a simple string, this is aimed towards libraries that wants to +describe a class or anything that has a type easily:: use Symfony\Component\TypeInfo\Type; use Symfony\Component\TypeInfo\TypeResolver\TypeResolver; + class Dummy + { + public function __construct( + public int $id, + ) { + } + } + // Instantiate a new resolver $typeResolver = TypeResolver::create(); @@ -70,6 +82,88 @@ Each of these calls will return you a ``Type`` instance that corresponds to the static method used. You can also resolve types from a string (as shown in the ``bool`` parameter of the previous example) -.. note:: +PHPDoc parsing +~~~~~~~~~~~~~~ - To support raw string resolving, you need to install ``phpstan/phpdoc-parser`` package. +But most times you won't have clean typed properties or you want a more precise type +thank to advanced PHPDoc, to do that you would want a string resolver based on that PHPDoc. +First you will require ``phpstan/phpdoc-parser`` package from composer to support string +revolving. Then you would do as following:: + + use Symfony\Component\TypeInfo\TypeResolver\TypeResolver; + + class Dummy + { + public function __construct( + public int $id, + /** @var string[] $tags */ + public array $tags, + ) { + } + } + + $typeResolver = TypeResolver::create(); + $typeResolver->resolve(new \ReflectionProperty(Dummy::class, 'id')); // returns an "int" Type + $typeResolver->resolve(new \ReflectionProperty(Dummy::class, 'id')); // returns a collection with "int" as key and "string" as values Type + +Advanced usages +~~~~~~~~~~~~~~~ + +There is many methods to manipulate and check types depending on your needs within the TypeInfo components. + +If you need a check a simple Type:: + + // You need to check if a Type + $type = Type::int(); // with a simple int type + // You can check if a given type comply with a given identifier + $type->isIdentifiedBy(TypeIdentifier::INT); // true + $type->isIdentifiedBy(TypeIdentifier::STRING); // false + + $type = Type::union(Type::string(), Type::int()); // with an union of int and string types + // You can now see that the second check will pass to true since we have an union with a string type + $type->isIdentifiedBy(TypeIdentifier::INT); // true + $type->isIdentifiedBy(TypeIdentifier::STRING); // true + + class DummyParent {} + class Dummy extends DummyParent implements DummyInterface {} + $type = Type::object(Dummy::class); // with an object Type + // You can check is the Type is an object, or even if it's a given class + $type->isIdentifiedBy(TypeIdentifier::OBJECT); // true + $type->isIdentifiedBy(Dummy::class); // true + // Or inherits/implements something + $type->isIdentifiedBy(DummyParent::class); // true + $type->isIdentifiedBy(DummyInterface::class); // true + +Sometimes you want to check for more than one thing at a time so a callable may be better to check everything:: + + class Foo + { + private int $integer; + private string $string; + private ?float $float; + } + + $reflClass = new \ReflectionClass(Foo::class); + + $resolver = TypeResolver::create(); + $integerType = $resolver->resolve($reflClass->getProperty('integer')); + $stringType = $resolver->resolve($reflClass->getProperty('string')); + $floatType = $resolver->resolve($reflClass->getProperty('float')); + + // your callable to check whatever you need + // here we want to validate a given type is a non nullable number + $isNonNullableNumber = function (Type $type): bool { + if ($type->isNullable()) { + return false; + } + + if ($type->isIdentifiedBy(TypeIdentifier::INT) || $type->isIdentifiedBy(TypeIdentifier::FLOAT)) { + return true; + } + + return false; + }; + + $integerType->isSatisfiedBy($isNonNullableNumber); // true + $stringType->isSatisfiedBy($isNonNullableNumber); // false + $floatType->isSatisfiedBy($isNonNullableNumber); // false From 03b029b9f3d144573b16f94a56e51aa7666e1342 Mon Sep 17 00:00:00 2001 From: Matthieu Lempereur Date: Wed, 27 Nov 2024 06:36:46 +0100 Subject: [PATCH 417/477] minor cs fix for ci --- serializer/encoders.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/serializer/encoders.rst b/serializer/encoders.rst index 003eb4523fe..e36d8731e48 100644 --- a/serializer/encoders.rst +++ b/serializer/encoders.rst @@ -65,6 +65,7 @@ are available to customize the behavior of the encoder: ``csv_end_of_line`` (default: ``\n``) Sets the character(s) used to mark the end of each line in the CSV file. ``csv_escape_char`` (default: empty string) + .. deprecated:: 7.2 The ``csv_escape_char`` option was deprecated in Symfony 7.2. From e427a6cb7466dba166e17f446b0f5a210757c8b9 Mon Sep 17 00:00:00 2001 From: Matthieu Lempereur Date: Wed, 27 Nov 2024 06:18:03 +0100 Subject: [PATCH 418/477] [Security] Secret with remember me feature --- security/remember_me.rst | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/security/remember_me.rst b/security/remember_me.rst index 8fac6d78849..2fd0f7e8d1e 100644 --- a/security/remember_me.rst +++ b/security/remember_me.rst @@ -19,7 +19,7 @@ the session lasts using a cookie with the ``remember_me`` firewall option: main: # ... remember_me: - secret: '%kernel.secret%' # required + secret: '%kernel.secret%' lifetime: 604800 # 1 week in seconds # by default, the feature is enabled by checking a # checkbox in the login form (see below), uncomment the @@ -44,7 +44,7 @@ the session lasts using a cookie with the ``remember_me`` firewall option: - firewall('main') // ... ->rememberMe() - ->secret('%kernel.secret%') // required + ->secret('%kernel.secret%') ->lifetime(604800) // 1 week in seconds // by default, the feature is enabled by checking a @@ -77,9 +77,11 @@ the session lasts using a cookie with the ``remember_me`` firewall option: ; }; -The ``secret`` option is the only required option and it is used to sign -the remember me cookie. It's common to use the ``kernel.secret`` parameter, -which is defined using the ``APP_SECRET`` environment variable. +.. versionadded:: 7.2 + + The ``secret`` option is no longer required starting from Symfony 7.2. By + default, ``%kernel.secret%`` is used, which is defined using the + ``APP_SECRET`` environment variable. After enabling the ``remember_me`` system in the configuration, there are a couple more things to do before remember me works correctly: @@ -171,7 +173,6 @@ allow users to opt-out. In these cases, you can use the main: # ... remember_me: - secret: '%kernel.secret%' # ... always_remember_me: true @@ -194,7 +195,6 @@ allow users to opt-out. In these cases, you can use the @@ -211,7 +211,6 @@ allow users to opt-out. In these cases, you can use the $security->firewall('main') // ... ->rememberMe() - ->secret('%kernel.secret%') // ... ->alwaysRememberMe(true) ; @@ -335,7 +334,6 @@ are fetched from the user object using the main: # ... remember_me: - secret: '%kernel.secret%' # ... signature_properties: ['password', 'updatedAt'] @@ -357,7 +355,7 @@ are fetched from the user object using the - + password updatedAt @@ -375,7 +373,6 @@ are fetched from the user object using the $security->firewall('main') // ... ->rememberMe() - ->secret('%kernel.secret%') // ... ->signatureProperties(['password', 'updatedAt']) ; @@ -419,7 +416,6 @@ You can enable the doctrine token provider using the ``doctrine`` setting: main: # ... remember_me: - secret: '%kernel.secret%' # ... token_provider: doctrine: true @@ -442,7 +438,7 @@ You can enable the doctrine token provider using the ``doctrine`` setting: - + @@ -459,7 +455,6 @@ You can enable the doctrine token provider using the ``doctrine`` setting: $security->firewall('main') // ... ->rememberMe() - ->secret('%kernel.secret%') // ... ->tokenProvider([ 'doctrine' => true, From c71b9f93795d90f0ae377f17026173f1e1c949a5 Mon Sep 17 00:00:00 2001 From: Matthieu Lempereur Date: Mon, 2 Dec 2024 08:38:44 +0100 Subject: [PATCH 419/477] remove a gc_probability default mention --- session.rst | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/session.rst b/session.rst index 393cd24a898..aa4c3ba381f 100644 --- a/session.rst +++ b/session.rst @@ -494,18 +494,7 @@ deleted. This allows one to expire records based on idle time. However, some operating systems (e.g. Debian) do their own session handling and set the ``session.gc_probability`` variable to ``0`` to stop PHP doing garbage -collection. That's why Symfony now overwrites this value to ``1``. - -If you wish to use the original value set in your ``php.ini``, add the following -configuration: - -.. code-block:: yaml - - # config/packages/framework.yaml - framework: - session: - # ... - gc_probability: null +collection. You can configure these settings by passing ``gc_probability``, ``gc_divisor`` and ``gc_maxlifetime`` in an array to the constructor of @@ -513,6 +502,10 @@ and ``gc_maxlifetime`` in an array to the constructor of or to the :method:`Symfony\\Component\\HttpFoundation\\Session\\Storage\\NativeSessionStorage::setOptions` method. +.. versionadded:: 7.2 + + Starting from Symfony 7.2, ``php.ini``'s directive is used as default for ``gc_probability``. + .. _session-database: Store Sessions in a Database From 2083dc2eb14cc9b7d7213249d4d0437d36b997ce Mon Sep 17 00:00:00 2001 From: Matthieu Lempereur Date: Mon, 2 Dec 2024 10:40:51 +0100 Subject: [PATCH 420/477] Allow integer for the calendar option of DateType --- reference/forms/types/date.rst | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/reference/forms/types/date.rst b/reference/forms/types/date.rst index e88e91d80dd..6b8d21a19bd 100644 --- a/reference/forms/types/date.rst +++ b/reference/forms/types/date.rst @@ -156,11 +156,12 @@ values for the year, month and day fields:: ``calendar`` ~~~~~~~~~~~~ -**type**: ``\IntlCalendar`` **default**: ``null`` +**type**: ``integer`` or ``\IntlCalendar`` **default**: ``null`` The calendar to use for formatting and parsing the date. The value should be -an instance of the :phpclass:`IntlCalendar` to use. By default, the Gregorian -calendar with the application default locale is used. +an ``integer`` from :phpclass:`IntlDateFormatter` calendar constants or an instance +of the :phpclass:`IntlCalendar` to use. By default, the Gregorian calendar +with the application default locale is used. .. versionadded:: 7.2 From a0f7fab6e75ac4b76e21f5f412132f1bebed375a Mon Sep 17 00:00:00 2001 From: Morf <1416936+m0rff@users.noreply.github.com> Date: Mon, 2 Dec 2024 16:10:23 +0100 Subject: [PATCH 421/477] fix: Update micro_kernel_trait.rst --- configuration/micro_kernel_trait.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configuration/micro_kernel_trait.rst b/configuration/micro_kernel_trait.rst index c9739679f69..62e8c2d4128 100644 --- a/configuration/micro_kernel_trait.rst +++ b/configuration/micro_kernel_trait.rst @@ -16,7 +16,7 @@ via Composer: .. code-block:: terminal - $ composer symfony/framework-bundle symfony/runtime + $ composer require symfony/framework-bundle symfony/runtime Next, create an ``index.php`` file that defines the kernel class and runs it: From 646e1995c71abf8b84e75c51cc355b1cc5e258b4 Mon Sep 17 00:00:00 2001 From: Matthieu Lempereur Date: Mon, 2 Dec 2024 10:13:27 +0100 Subject: [PATCH 422/477] [Messenger] Document `getRetryDelay()` --- messenger.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/messenger.rst b/messenger.rst index 74f7d792436..aa46ef9b1d3 100644 --- a/messenger.rst +++ b/messenger.rst @@ -1134,6 +1134,13 @@ and must be retried. If you throw :class:`Symfony\\Component\\Messenger\\Exception\\RecoverableMessageHandlingException`, the message will always be retried infinitely and ``max_retries`` setting will be ignored. +If you want to override retry delay form the retry strategy. You can achieve this +using by providing it in the exception, using the ``getRetryDelay()`` method from :class:`Symfony\\Component\\Messenger\\Exception\\RecoverableExceptionInterface`. + +.. versionadded:: 7.2 + + The method ``getRetryDelay()`` was introduced in Symfony 7.2. + .. _messenger-failure-transport: Saving & Retrying Failed Messages From f99ae716aeb01cc279f4def8386f4d4fa7d7c190 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Mon, 2 Dec 2024 16:21:58 +0100 Subject: [PATCH 423/477] Reword --- messenger.rst | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/messenger.rst b/messenger.rst index 35db17a75b3..053ccfd172e 100644 --- a/messenger.rst +++ b/messenger.rst @@ -1134,12 +1134,14 @@ and must be retried. If you throw :class:`Symfony\\Component\\Messenger\\Exception\\RecoverableMessageHandlingException`, the message will always be retried infinitely and ``max_retries`` setting will be ignored. -If you want to override retry delay form the retry strategy. You can achieve this -using by providing it in the exception, using the ``getRetryDelay()`` method from :class:`Symfony\\Component\\Messenger\\Exception\\RecoverableExceptionInterface`. +You can define a custom retry delay (e.g., to use the value from the ``Retry-After`` +header in an HTTP response) by setting the ``retryDelay`` argument in the +constructor of the ``RecoverableMessageHandlingException``. .. versionadded:: 7.2 - The method ``getRetryDelay()`` was introduced in Symfony 7.2. + The ``retryDelay`` argument and the ``getRetryDelay()`` method were introduced + in Symfony 7.2. .. _messenger-failure-transport: From 977be3230885146769f8304e9aa0a578b4cc372e Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Mon, 2 Dec 2024 16:34:09 +0100 Subject: [PATCH 424/477] Reword --- session.rst | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/session.rst b/session.rst index aa4c3ba381f..e3f2246b6f6 100644 --- a/session.rst +++ b/session.rst @@ -492,19 +492,30 @@ the ``php.ini`` directive ``session.gc_maxlifetime``. The meaning in this contex that any stored session that was saved more than ``gc_maxlifetime`` ago should be deleted. This allows one to expire records based on idle time. -However, some operating systems (e.g. Debian) do their own session handling and set -the ``session.gc_probability`` variable to ``0`` to stop PHP doing garbage -collection. +However, some operating systems (e.g. Debian) manage session handling differently +and set the ``session.gc_probability`` variable to ``0`` to prevent PHP from performing +garbage collection. By default, Symfony uses the value of the ``gc_probability`` +directive set in the ``php.ini`` file. If you can't modify this PHP setting, you +can configure it directly in Symfony: -You can configure these settings by passing ``gc_probability``, ``gc_divisor`` -and ``gc_maxlifetime`` in an array to the constructor of +.. code-block:: yaml + + # config/packages/framework.yaml + framework: + session: + # ... + gc_probability: 1 + +Alternatively, you can configure these settings by passing ``gc_probability``, +``gc_divisor`` and ``gc_maxlifetime`` in an array to the constructor of :class:`Symfony\\Component\\HttpFoundation\\Session\\Storage\\NativeSessionStorage` or to the :method:`Symfony\\Component\\HttpFoundation\\Session\\Storage\\NativeSessionStorage::setOptions` method. .. versionadded:: 7.2 - Starting from Symfony 7.2, ``php.ini``'s directive is used as default for ``gc_probability``. + Using the ``php.ini`` directive as the default value for ``gc_probability`` + was introduced in Symfony 7.2. .. _session-database: From 00a781fdd643e516a6f196e84e765716e5a99e44 Mon Sep 17 00:00:00 2001 From: Thomas Landauer Date: Mon, 2 Dec 2024 17:25:05 +0100 Subject: [PATCH 425/477] Update mailer.rst: Changing order of tips Page: https://symfony.com/doc/current/mailer.html#email-addresses Reason: Bring the 2 IDN-related tips together. --- mailer.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mailer.rst b/mailer.rst index 8ff13c2561a..9cfba6c1a71 100644 --- a/mailer.rst +++ b/mailer.rst @@ -560,17 +560,17 @@ both strings or address objects:: // ... ; -.. versionadded:: 7.2 - - Support for non-ASCII email addresses (e.g. ``jânë.dœ@ëxãmplę.com``) - was introduced in Symfony 7.2. - .. tip:: Instead of calling ``->from()`` *every* time you create a new email, you can :ref:`configure emails globally ` to set the same ``From`` email to all messages. +.. versionadded:: 7.2 + + Support for non-ASCII email addresses (e.g. ``jânë.dœ@ëxãmplę.com``) + was introduced in Symfony 7.2. + .. note:: The local part of the address (what goes before the ``@``) can include UTF-8 From ec2743dd19e580971b8707eff6a66edcdf9f10a2 Mon Sep 17 00:00:00 2001 From: Matthieu Lempereur Date: Tue, 3 Dec 2024 12:05:33 +0100 Subject: [PATCH 426/477] [HttpFoundation] Do not use named parameters in example --- components/http_foundation.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/components/http_foundation.rst b/components/http_foundation.rst index 4dcf3b1e4da..c91ec5ced8f 100644 --- a/components/http_foundation.rst +++ b/components/http_foundation.rst @@ -367,11 +367,13 @@ of the ``anonymize()`` method to specify the number of bytes that should be anonymized depending on the IP address format:: $ipv4 = '123.234.235.236'; - $anonymousIpv4 = IpUtils::anonymize($ipv4, v4Bytes: 3); + $anonymousIpv4 = IpUtils::anonymize($ipv4, 3); // $anonymousIpv4 = '123.0.0.0' $ipv6 = '2a01:198:603:10:396e:4789:8e99:890f'; - $anonymousIpv6 = IpUtils::anonymize($ipv6, v6Bytes: 10); + // (you must define the second argument (bytes to anonymize in IPv4 addresses) + // even when you are only anonymizing IPv6 addresses) + $anonymousIpv6 = IpUtils::anonymize($ipv6, 3, 10); // $anonymousIpv6 = '2a01:198:603::' .. versionadded:: 7.2 From a8841ee2472df97291395786dbdbf68d551db348 Mon Sep 17 00:00:00 2001 From: kl3sk Date: Mon, 28 Oct 2024 12:27:32 +0100 Subject: [PATCH 427/477] Update Expression_language: lint function The lint function doesn't return anything but exception. Second arguments with Flags example is ommitted. Update expression_language.rst Removing `var_dump`, this make no sens here. Update expression_language.rst Sync with last commits Update expression_language.rst Change comment explication for "IGNORE_*" flags --- components/expression_language.rst | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/components/expression_language.rst b/components/expression_language.rst index 785beebd9da..7dacf581b14 100644 --- a/components/expression_language.rst +++ b/components/expression_language.rst @@ -106,6 +106,10 @@ if the expression is not valid:: $expressionLanguage->lint('1 + 2', []); // doesn't throw anything + $expressionLanguage->lint('1 + a', []); + // Throw SyntaxError Exception + // "Variable "a" is not valid around position 5 for expression `1 + a`." + The behavior of these methods can be configured with some flags defined in the :class:`Symfony\\Component\\ExpressionLanguage\\Parser` class: @@ -121,8 +125,8 @@ This is how you can use these flags:: $expressionLanguage = new ExpressionLanguage(); - // this returns true because the unknown variables and functions are ignored - var_dump($expressionLanguage->lint('unknown_var + unknown_function()', Parser::IGNORE_UNKNOWN_VARIABLES | Parser::IGNORE_UNKNOWN_FUNCTIONS)); + // Does not throw a SyntaxError because the unknown variables and functions are ignored + $expressionLanguage->lint('unknown_var + unknown_function()', [], Parser::IGNORE_UNKNOWN_VARIABLES | Parser::IGNORE_UNKNOWN_FUNCTIONS); .. versionadded:: 7.1 From 694cd4c081b693324a303930241ac04beca488d1 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Fri, 6 Dec 2024 09:08:20 +0100 Subject: [PATCH 428/477] Minor tweaks --- components/expression_language.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/expression_language.rst b/components/expression_language.rst index 7dacf581b14..b0dd10b0f42 100644 --- a/components/expression_language.rst +++ b/components/expression_language.rst @@ -107,7 +107,7 @@ if the expression is not valid:: $expressionLanguage->lint('1 + 2', []); // doesn't throw anything $expressionLanguage->lint('1 + a', []); - // Throw SyntaxError Exception + // throws a SyntaxError exception: // "Variable "a" is not valid around position 5 for expression `1 + a`." The behavior of these methods can be configured with some flags defined in the @@ -125,7 +125,7 @@ This is how you can use these flags:: $expressionLanguage = new ExpressionLanguage(); - // Does not throw a SyntaxError because the unknown variables and functions are ignored + // does not throw a SyntaxError because the unknown variables and functions are ignored $expressionLanguage->lint('unknown_var + unknown_function()', [], Parser::IGNORE_UNKNOWN_VARIABLES | Parser::IGNORE_UNKNOWN_FUNCTIONS); .. versionadded:: 7.1 From 85ceb630c6ec51f55f185847dc191d5dad2e712b Mon Sep 17 00:00:00 2001 From: Timo Bakx Date: Sat, 7 Dec 2024 12:13:49 +0100 Subject: [PATCH 429/477] Replaced `caution` directive by `warning` Fixes #20371 --- components/type_info.rst | 2 +- doctrine.rst | 2 +- mailer.rst | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/components/type_info.rst b/components/type_info.rst index 30ae11aa222..2fd64b9bc5d 100644 --- a/components/type_info.rst +++ b/components/type_info.rst @@ -11,7 +11,7 @@ This component provides: * A way to get types from PHP elements such as properties, method arguments, return types, and raw strings. -.. caution:: +.. warning:: This component is :doc:`experimental ` and could be changed at any time without prior notice. diff --git a/doctrine.rst b/doctrine.rst index f9c1d153d82..171f8a3348a 100644 --- a/doctrine.rst +++ b/doctrine.rst @@ -320,7 +320,7 @@ before, execute your migrations: $ php bin/console doctrine:migrations:migrate -.. caution:: +.. warning:: If you are using an SQLite database, you'll see the following error: *PDOException: SQLSTATE[HY000]: General error: 1 Cannot add a NOT NULL diff --git a/mailer.rst b/mailer.rst index 0d3e296ee77..06feb1e5c29 100644 --- a/mailer.rst +++ b/mailer.rst @@ -361,7 +361,7 @@ setting the ``auto_tls`` option to ``false`` in the DSN:: $dsn = 'smtp://user:pass@10.0.0.25?auto_tls=false'; -.. caution:: +.. warning:: It's not recommended to disable TLS while connecting to an SMTP server over the Internet, but it can be useful when both the application and the SMTP From 0a3fb8d716fd0adf21d56762821ce7b19f71b90b Mon Sep 17 00:00:00 2001 From: Timo Bakx Date: Sat, 7 Dec 2024 12:19:15 +0100 Subject: [PATCH 430/477] Replaced `caution` directive by `warning` Fixes #20371 --- reference/forms/types/options/choice_lazy.rst.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reference/forms/types/options/choice_lazy.rst.inc b/reference/forms/types/options/choice_lazy.rst.inc index bdcbf178406..08fbe953e41 100644 --- a/reference/forms/types/options/choice_lazy.rst.inc +++ b/reference/forms/types/options/choice_lazy.rst.inc @@ -24,7 +24,7 @@ will only load and render the choices that are preset as default values or submitted. This defers the loading of the full list of choices, helping to improve your form's performance. -.. caution:: +.. warning:: Keep in mind that when using ``choice_lazy``, you are responsible for providing the user interface for selecting choices, typically through a From b53029a64602d1cde5aa704ae1145532ee875bf3 Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Mon, 22 Apr 2024 18:56:41 +0200 Subject: [PATCH 431/477] [Serializer] Add class/format/context to NameConverterInterface Fix #19683 --- serializer/custom_name_converter.rst | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/serializer/custom_name_converter.rst b/serializer/custom_name_converter.rst index 82247134217..d0ed45bdc0a 100644 --- a/serializer/custom_name_converter.rst +++ b/serializer/custom_name_converter.rst @@ -30,19 +30,26 @@ A custom name converter can handle such cases:: class OrgPrefixNameConverter implements NameConverterInterface { - public function normalize(string $propertyName): string + public function normalize(string $propertyName, string $class = null, ?string $format = null, array $context = []): string { // during normalization, add the prefix return 'org_'.$propertyName; } - public function denormalize(string $propertyName): string + public function denormalize(string $propertyName, ?string $class = null, ?string $format = null, array $context = []): string { // remove the 'org_' prefix on denormalizing return str_starts_with($propertyName, 'org_') ? substr($propertyName, 4) : $propertyName; } } +.. versionadded:: 7.1 + + Accessing the current class name, format and context via + :method:`Symfony\\Component\\Serializer\\NameConverter\\NameConverterInterface::normalize` + and :method:`Symfony\\Component\\Serializer\\NameConverter\\NameConverterInterface::denormalize` + was introduced in Symfony 7.1. + .. note:: You can also implement From d159a4a03e036d7a4664fd02fe07ddf1480850a4 Mon Sep 17 00:00:00 2001 From: Nicolas Appriou Date: Wed, 1 Feb 2023 12:55:17 +0100 Subject: [PATCH 432/477] [HttpFoundation] Update http response test constraint signature --- testing.rst | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/testing.rst b/testing.rst index 2e681c70543..30c0e87ab77 100644 --- a/testing.rst +++ b/testing.rst @@ -961,11 +961,11 @@ However, Symfony provides useful shortcut methods for the most common cases: Response Assertions ................... -``assertResponseIsSuccessful(string $message = '')`` +``assertResponseIsSuccessful(string $message = '', bool $verbose = true)`` Asserts that the response was successful (HTTP status is 2xx). -``assertResponseStatusCodeSame(int $expectedCode, string $message = '')`` +``assertResponseStatusCodeSame(int $expectedCode, string $message = '', bool $verbose = true)`` Asserts a specific HTTP status code. -``assertResponseRedirects(?string $expectedLocation = null, ?int $expectedCode = null, string $message = '')`` +``assertResponseRedirects(?string $expectedLocation = null, ?int $expectedCode = null, string $message = '', bool $verbose = true)`` Asserts the response is a redirect response (optionally, you can check the target location and status code). The excepted location can be either an absolute or a relative path. @@ -983,9 +983,13 @@ Response Assertions Asserts the response format returned by the :method:`Symfony\\Component\\HttpFoundation\\Response::getFormat` method is the same as the expected value. -``assertResponseIsUnprocessable(string $message = '')`` +``assertResponseIsUnprocessable(string $message = '', bool $verbose = true)`` Asserts the response is unprocessable (HTTP status is 422) +.. versionadded:: 7.1 + + The ``$verbose`` parameters were introduced in Symfony 7.1. + Request Assertions .................. From 405f95ef8844382504372d0dc85178505d7cdfed Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Tue, 10 Dec 2024 15:51:38 +0100 Subject: [PATCH 433/477] Minor reword --- components/type_info.rst | 64 ++++++++++++++++++++++------------------ 1 file changed, 35 insertions(+), 29 deletions(-) diff --git a/components/type_info.rst b/components/type_info.rst index 18556e02972..734ac4140ba 100644 --- a/components/type_info.rst +++ b/components/type_info.rst @@ -43,9 +43,9 @@ to the :class:`Symfony\\Component\\TypeInfo\\Type` static methods as following:: Resolvers ~~~~~~~~~ -The second way of using the component is to use ``TypeInfo`` to resolve a type -based on reflection or a simple string, this is aimed towards libraries that wants to -describe a class or anything that has a type easily:: +The second way to use the component is by using ``TypeInfo`` to resolve a type +based on reflection or a simple string. This approach is designed for libraries +that need a simple way to describe a class or anything with a type:: use Symfony\Component\TypeInfo\Type; use Symfony\Component\TypeInfo\TypeResolver\TypeResolver; @@ -82,13 +82,15 @@ Each of these calls will return you a ``Type`` instance that corresponds to the static method used. You can also resolve types from a string (as shown in the ``bool`` parameter of the previous example) -PHPDoc parsing +PHPDoc Parsing ~~~~~~~~~~~~~~ -But most times you won't have clean typed properties or you want a more precise type -thank to advanced PHPDoc, to do that you would want a string resolver based on that PHPDoc. -First you will require ``phpstan/phpdoc-parser`` package from composer to support string -revolving. Then you would do as following:: +In many cases, you may not have cleanly typed properties or may need more precise +type definitions provided by advanced PHPDoc. To achieve this, you can use a string +resolver based on the PHPDoc annotations. + +First, run the command ``composer require phpstan/phpdoc-parser`` to install the +PHP package required for string resolving. Then, follow these steps:: use Symfony\Component\TypeInfo\TypeResolver\TypeResolver; @@ -106,35 +108,40 @@ revolving. Then you would do as following:: $typeResolver->resolve(new \ReflectionProperty(Dummy::class, 'id')); // returns an "int" Type $typeResolver->resolve(new \ReflectionProperty(Dummy::class, 'id')); // returns a collection with "int" as key and "string" as values Type -Advanced usages +Advanced Usages ~~~~~~~~~~~~~~~ -There is many methods to manipulate and check types depending on your needs within the TypeInfo components. +The TypeInfo component provides various methods to manipulate and check types, +depending on your needs. -If you need a check a simple Type:: +Checking a **simple type**:: - // You need to check if a Type - $type = Type::int(); // with a simple int type - // You can check if a given type comply with a given identifier - $type->isIdentifiedBy(TypeIdentifier::INT); // true + // define a simple integer type + $type = Type::int(); + // check if the type matches a specific identifier + $type->isIdentifiedBy(TypeIdentifier::INT); // true $type->isIdentifiedBy(TypeIdentifier::STRING); // false - $type = Type::union(Type::string(), Type::int()); // with an union of int and string types - // You can now see that the second check will pass to true since we have an union with a string type - $type->isIdentifiedBy(TypeIdentifier::INT); // true + // define a union type (equivalent to PHP's int|string) + $type = Type::union(Type::string(), Type::int()); + // now the second check is true because the union type contains the string type + $type->isIdentifiedBy(TypeIdentifier::INT); // true $type->isIdentifiedBy(TypeIdentifier::STRING); // true class DummyParent {} class Dummy extends DummyParent implements DummyInterface {} - $type = Type::object(Dummy::class); // with an object Type - // You can check is the Type is an object, or even if it's a given class + + // define an object type + $type = Type::object(Dummy::class); + + // check if the type is an object or matches a specific class $type->isIdentifiedBy(TypeIdentifier::OBJECT); // true - $type->isIdentifiedBy(Dummy::class); // true - // Or inherits/implements something - $type->isIdentifiedBy(DummyParent::class); // true - $type->isIdentifiedBy(DummyInterface::class); // true + $type->isIdentifiedBy(Dummy::class); // true + // check if it inherits/implements something + $type->isIdentifiedBy(DummyParent::class); // true + $type->isIdentifiedBy(DummyInterface::class); // true -Sometimes you want to check for more than one thing at a time so a callable may be better to check everything:: +Using callables for **complex checks**: class Foo { @@ -150,8 +157,7 @@ Sometimes you want to check for more than one thing at a time so a callable may $stringType = $resolver->resolve($reflClass->getProperty('string')); $floatType = $resolver->resolve($reflClass->getProperty('float')); - // your callable to check whatever you need - // here we want to validate a given type is a non nullable number + // define a callable to validate non-nullable number types $isNonNullableNumber = function (Type $type): bool { if ($type->isNullable()) { return false; @@ -165,5 +171,5 @@ Sometimes you want to check for more than one thing at a time so a callable may }; $integerType->isSatisfiedBy($isNonNullableNumber); // true - $stringType->isSatisfiedBy($isNonNullableNumber); // false - $floatType->isSatisfiedBy($isNonNullableNumber); // false + $stringType->isSatisfiedBy($isNonNullableNumber); // false + $floatType->isSatisfiedBy($isNonNullableNumber); // false From 3e4bcf17aae617ddf5295e53b95bd505b1a1d509 Mon Sep 17 00:00:00 2001 From: Baptiste Leduc Date: Thu, 12 Dec 2024 11:48:47 +0100 Subject: [PATCH 434/477] Fix PHP block in TypeInfo documentation --- components/type_info.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/type_info.rst b/components/type_info.rst index 734ac4140ba..e7062c5f249 100644 --- a/components/type_info.rst +++ b/components/type_info.rst @@ -141,7 +141,7 @@ Checking a **simple type**:: $type->isIdentifiedBy(DummyParent::class); // true $type->isIdentifiedBy(DummyInterface::class); // true -Using callables for **complex checks**: +Using callables for **complex checks**:: class Foo { From b0f09c62f9bfbd876ea954b1a302491fb05473e7 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Tue, 17 Dec 2024 09:34:01 +0100 Subject: [PATCH 435/477] use ? before nullable single type declaration --- serializer/custom_name_converter.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/serializer/custom_name_converter.rst b/serializer/custom_name_converter.rst index d0ed45bdc0a..49dafb02cc4 100644 --- a/serializer/custom_name_converter.rst +++ b/serializer/custom_name_converter.rst @@ -30,7 +30,7 @@ A custom name converter can handle such cases:: class OrgPrefixNameConverter implements NameConverterInterface { - public function normalize(string $propertyName, string $class = null, ?string $format = null, array $context = []): string + public function normalize(string $propertyName, ?string $class = null, ?string $format = null, array $context = []): string { // during normalization, add the prefix return 'org_'.$propertyName; From 8aeceab63ce821c69bb182377ad1c3c0b54bf17e Mon Sep 17 00:00:00 2001 From: Christophe Coevoet Date: Tue, 17 Dec 2024 13:06:15 +0100 Subject: [PATCH 436/477] Fix the configuration for custom password strength estimator --- reference/constraints/PasswordStrength.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/reference/constraints/PasswordStrength.rst b/reference/constraints/PasswordStrength.rst index 671b5f495ef..60125a763a1 100644 --- a/reference/constraints/PasswordStrength.rst +++ b/reference/constraints/PasswordStrength.rst @@ -178,7 +178,7 @@ service to use your own estimator: class: App\Validator\CustomPasswordStrengthEstimator Symfony\Component\Validator\Constraints\PasswordStrengthValidator: - arguments: [!service_closure '@custom_password_strength_estimator'] + arguments: [!closure '@custom_password_strength_estimator'] .. code-block:: xml @@ -192,7 +192,7 @@ service to use your own estimator: - + @@ -210,5 +210,5 @@ service to use your own estimator: $services->set('custom_password_strength_estimator', CustomPasswordStrengthEstimator::class); $services->set(PasswordStrengthValidator::class) - ->args([service_closure('custom_password_strength_estimator')]); + ->args([closure('custom_password_strength_estimator')]); }; From f10c7e9f81e4db9cba84d03027ca7eccf0a9e31f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20PLANUS?= <48881747+leo29plns@users.noreply.github.com> Date: Thu, 19 Dec 2024 08:06:37 +0100 Subject: [PATCH 437/477] Update 7.2.x-dev to 7.2.x --- setup.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/setup.rst b/setup.rst index 1d7081e93b7..853b53f2400 100644 --- a/setup.rst +++ b/setup.rst @@ -48,10 +48,10 @@ application: .. code-block:: terminal # run this if you are building a traditional web application - $ symfony new my_project_directory --version="7.2.x-dev" --webapp + $ symfony new my_project_directory --version="7.2.x" --webapp # run this if you are building a microservice, console application or API - $ symfony new my_project_directory --version="7.2.x-dev" + $ symfony new my_project_directory --version="7.2.x" The only difference between these two commands is the number of packages installed by default. The ``--webapp`` option installs extra packages to give @@ -63,12 +63,12 @@ Symfony application using Composer: .. code-block:: terminal # run this if you are building a traditional web application - $ composer create-project symfony/skeleton:"7.2.x-dev" my_project_directory + $ composer create-project symfony/skeleton:"7.2.x" my_project_directory $ cd my_project_directory $ composer require webapp # run this if you are building a microservice, console application or API - $ composer create-project symfony/skeleton:"7.2.x-dev" my_project_directory + $ composer create-project symfony/skeleton:"7.2.x" my_project_directory No matter which command you run to create the Symfony application. All of them will create a new ``my_project_directory/`` directory, download some dependencies From d99915066523753285953b349f1a9782cc353fd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Andr=C3=A9?= Date: Sun, 22 Dec 2024 14:40:09 +0100 Subject: [PATCH 438/477] [AssetMapper] Update hash examples Since 7.2, hash are shorter. This PR updates the various hashes in code examples, to illustrate more precisely what a user will see on its local install / code. --- frontend/asset_mapper.rst | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/frontend/asset_mapper.rst b/frontend/asset_mapper.rst index decc7827e0d..95b656f043d 100644 --- a/frontend/asset_mapper.rst +++ b/frontend/asset_mapper.rst @@ -12,7 +12,7 @@ The component has two main features: * :ref:`Mapping & Versioning Assets `: All files inside of ``assets/`` are made available publicly and **versioned**. You can reference the file ``assets/images/product.jpg`` in a Twig template with ``{{ asset('images/product.jpg') }}``. - The final URL will include a version hash, like ``/assets/images/product-3c16d9220694c0e56d8648f25e6035e9.jpg``. + The final URL will include a version hash, like ``/assets/images/product-3c16d92m.jpg``. * :ref:`Importmaps `: A native browser feature that makes it easier to use the JavaScript ``import`` statement (e.g. ``import { Modal } from 'bootstrap'``) @@ -70,7 +70,7 @@ The path - ``images/duck.png`` - is relative to your mapped directory (``assets/ This is known as the **logical path** to your asset. If you look at the HTML in your page, the URL will be something -like: ``/assets/images/duck-3c16d9220694c0e56d8648f25e6035e9.png``. If you change +like: ``/assets/images/duck-3c16d92m.png``. If you change the file, the version part of the URL will also change automatically. .. _asset-mapper-compile-assets: @@ -78,7 +78,7 @@ the file, the version part of the URL will also change automatically. Serving Assets in dev vs prod ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -In the ``dev`` environment, the URL ``/assets/images/duck-3c16d9220694c0e56d8648f25e6035e9.png`` +In the ``dev`` environment, the URL ``/assets/images/duck-3c16d92m.png`` is handled and returned by your Symfony app. For the ``prod`` environment, before deploy, you should run: @@ -283,9 +283,9 @@ outputs an `importmap`_: @@ -342,8 +342,8 @@ The ``importmap()`` function also outputs a set of "preloads": .. code-block:: html - - + + This is a performance optimization and you can learn more about below in :ref:`Performance: Add Preloading `. @@ -494,9 +494,9 @@ for ``duck.png``: .. code-block:: css - /* public/assets/styles/app-3c16d9220694c0e56d8648f25e6035e9.css */ + /* public/assets/styles/app-3c16d92m.css */ .quack { - background-image: url('../images/duck-3c16d9220694c0e56d8648f25e6035e9.png'); + background-image: url('../images/duck-3c16d92m.png'); } .. _asset-mapper-tailwind: @@ -573,7 +573,7 @@ Sometimes a JavaScript file you're importing (e.g. ``import './duck.js'``), or a CSS/image file you're referencing won't be found, and you'll see a 404 error in your browser's console. You'll also notice that the 404 URL is missing the version hash in the filename (e.g. a 404 to ``/assets/duck.js`` instead of -a path like ``/assets/duck.1b7a64b3b3d31219c262cf72521a5267.js``). +a path like ``/assets/duck-1b7a64b3.js``). This is usually because the path is wrong. If you're referencing the file directly in a Twig template: @@ -848,7 +848,7 @@ be versioned! It will output something like: .. code-block:: html+twig - + Overriding 3rd-Party Assets ~~~~~~~~~~~~~~~~~~~~~~~~~~~ From 0008e5b1a76566acbdb0e6e4fd5e752a31950eea Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Thu, 2 Jan 2025 13:34:31 +0100 Subject: [PATCH 439/477] Fix build --- security.rst | 1 - 1 file changed, 1 deletion(-) diff --git a/security.rst b/security.rst index 79bad3f2254..d684ba09ba7 100644 --- a/security.rst +++ b/security.rst @@ -2966,4 +2966,3 @@ Authorization (Denying Access) .. _`Login CSRF attacks`: https://en.wikipedia.org/wiki/Cross-site_request_forgery#Forging_login_requests .. _`PHP date relative formats`: https://www.php.net/manual/en/datetime.formats.php#datetime.formats.relative .. _`Oauth2-client`: https://github.com/thephpleague/oauth2-client -.. _`SensitiveParameter PHP attribute`: https://www.php.net/manual/en/class.sensitiveparameter.php From cf53d1914e874def9e39324e6c5ad32e0b441f23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joachim=20L=C3=B8vgaard?= Date: Wed, 8 Jan 2025 12:06:09 +0100 Subject: [PATCH 440/477] Fix typo --- components/type_info.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/type_info.rst b/components/type_info.rst index e7062c5f249..2a92a3db63e 100644 --- a/components/type_info.rst +++ b/components/type_info.rst @@ -106,7 +106,7 @@ PHP package required for string resolving. Then, follow these steps:: $typeResolver = TypeResolver::create(); $typeResolver->resolve(new \ReflectionProperty(Dummy::class, 'id')); // returns an "int" Type - $typeResolver->resolve(new \ReflectionProperty(Dummy::class, 'id')); // returns a collection with "int" as key and "string" as values Type + $typeResolver->resolve(new \ReflectionProperty(Dummy::class, 'tags')); // returns a collection with "int" as key and "string" as values Type Advanced Usages ~~~~~~~~~~~~~~~ From bb76fd9fee26080dfa8795528f472aed5d8fcf64 Mon Sep 17 00:00:00 2001 From: Ninos Ego Date: Wed, 8 Jan 2025 23:52:31 +0100 Subject: [PATCH 441/477] [Validator] Add note to `version` option in `Cidr` constraint --- reference/constraints/Cidr.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/reference/constraints/Cidr.rst b/reference/constraints/Cidr.rst index 24abeb57338..00125c72b39 100644 --- a/reference/constraints/Cidr.rst +++ b/reference/constraints/Cidr.rst @@ -126,6 +126,12 @@ Parameter Description This determines exactly *how* the CIDR notation is validated and can take one of :ref:`IP version ranges `. +.. note:: + + IP range (``*_private``, ``*_reserved``) is only validating against IP, but not the whole + netmask. You need to set the ``{{ min }}`` value for the netmask to harden the validation a bit. + For example, ``9.0.0.0/6`` results to be ``*_public``, but also uses ``10.0.0.0/8`` range (``*_private``). + .. versionadded:: 7.1 The support of all IP version ranges was introduced in Symfony 7.1. From 57739755111fed2beca51857df73a7f59459fb81 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Thu, 9 Jan 2025 13:02:08 +0100 Subject: [PATCH 442/477] Minor reword --- reference/constraints/Cidr.rst | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/reference/constraints/Cidr.rst b/reference/constraints/Cidr.rst index 61233d875ce..78a5b6c7167 100644 --- a/reference/constraints/Cidr.rst +++ b/reference/constraints/Cidr.rst @@ -128,9 +128,11 @@ of :ref:`IP version ranges `. .. note:: - IP range (``*_private``, ``*_reserved``) is only validating against IP, but not the whole - netmask. You need to set the ``{{ min }}`` value for the netmask to harden the validation a bit. - For example, ``9.0.0.0/6`` results to be ``*_public``, but also uses ``10.0.0.0/8`` range (``*_private``). + The IP range checks (e.g., ``*_private``, ``*_reserved``) validate only the + IP address, not the entire netmask. To improve validation, you can set the + ``{{ min }}`` value for the netmask. For example, the range ``9.0.0.0/6`` is + considered ``*_public``, but it also includes the ``10.0.0.0/8`` range, which + is categorized as ``*_private``. .. versionadded:: 7.1 From 1960c77521d526199cc28a07d189d8e4ac2353a0 Mon Sep 17 00:00:00 2001 From: Javier Spagnoletti Date: Sat, 11 Jan 2025 03:10:57 -0300 Subject: [PATCH 443/477] [Doctrine] Use PDO constants in YAML configuration example --- reference/configuration/doctrine.rst | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/reference/configuration/doctrine.rst b/reference/configuration/doctrine.rst index cd1852710e7..272ad6b6804 100644 --- a/reference/configuration/doctrine.rst +++ b/reference/configuration/doctrine.rst @@ -483,12 +483,12 @@ set up the connection using environment variables for the certificate paths: server_version: '8.0.31' driver: 'pdo_mysql' options: - # SSL private key (PDO::MYSQL_ATTR_SSL_KEY) - 1007: '%env(MYSQL_SSL_KEY)%' - # SSL certificate (PDO::MYSQL_ATTR_SSL_CERT) - 1008: '%env(MYSQL_SSL_CERT)%' - # SSL CA authority (PDO::MYSQL_ATTR_SSL_CA) - 1009: '%env(MYSQL_SSL_CA)%' + # SSL private key + !php/const 'PDO::MYSQL_ATTR_SSL_KEY': '%env(MYSQL_SSL_KEY)%' + # SSL certificate + !php/const 'PDO::MYSQL_ATTR_SSL_CERT': '%env(MYSQL_SSL_CERT)%' + # SSL CA authority + !php/const 'PDO::MYSQL_ATTR_SSL_CA': '%env(MYSQL_SSL_CA)%' .. code-block:: xml From c880a8818fa495a6b34188bddd76b946e54e6d3a Mon Sep 17 00:00:00 2001 From: Javier Spagnoletti Date: Sat, 11 Jan 2025 03:14:50 -0300 Subject: [PATCH 444/477] [Doctrine] Use PDO constants in XML configuration example --- reference/configuration/doctrine.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/reference/configuration/doctrine.rst b/reference/configuration/doctrine.rst index cd1852710e7..25621f60493 100644 --- a/reference/configuration/doctrine.rst +++ b/reference/configuration/doctrine.rst @@ -507,9 +507,9 @@ set up the connection using environment variables for the certificate paths: server-version="8.0.31" driver="pdo_mysql"> - %env(MYSQL_SSL_KEY)% - %env(MYSQL_SSL_CERT)% - %env(MYSQL_SSL_CA)% + %env(MYSQL_SSL_KEY)% + %env(MYSQL_SSL_CERT)% + %env(MYSQL_SSL_CA)% From bcbf6f62d5bcc1119d89f5caccf75c73f5b68cf7 Mon Sep 17 00:00:00 2001 From: Wouter de Jong Date: Mon, 13 Jan 2025 16:25:18 +0100 Subject: [PATCH 445/477] [#20566] Add UX team description --- contributing/code/core_team.rst | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/contributing/code/core_team.rst b/contributing/code/core_team.rst index 242f471947a..41e9a6cc3e3 100644 --- a/contributing/code/core_team.rst +++ b/contributing/code/core_team.rst @@ -34,7 +34,9 @@ The Symfony Core groups, in descending order of priority, are as follows: In addition, there are other groups created to manage specific topics: * **Security Team**: manages the whole security process (triaging reported vulnerabilities, - fixing the reported issues, coordinating the release of security fixes, etc.) + fixing the reported issues, coordinating the release of security fixes, etc.); + +* **Symfony UX Team**: manages the `UX repositories`_; * **Documentation Team**: manages the whole `symfony-docs repository`_. @@ -71,7 +73,7 @@ Active Core Members * **Fabien Potencier** (`fabpot`_); * **Jérémy Derussé** (`jderusse`_). -* **Symfony UX** (``@symfony/ux`` on GitHub): +* **Symfony UX Team** (``@symfony/ux`` on GitHub): * **Ryan Weaver** (`weaverryan`_); * **Kevin Bond** (`kbond`_); @@ -188,6 +190,7 @@ discretion of the **Project Leader**. violations, and minor CSS, JavaScript and HTML modifications. .. _`symfony-docs repository`: https://github.com/symfony/symfony-docs +.. _`UX repositories`: https://github.com/symfony/ux .. _`fabpot`: https://github.com/fabpot/ .. _`webmozart`: https://github.com/webmozart/ .. _`Tobion`: https://github.com/Tobion/ From d46522ad4ae49ae8317ad5c762daac0227ed143a Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Tue, 14 Jan 2025 09:53:02 +0100 Subject: [PATCH 446/477] Add more details about the context variable --- reference/constraints/When.rst | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/reference/constraints/When.rst b/reference/constraints/When.rst index 12b43fc7d63..2a05e58ee9c 100644 --- a/reference/constraints/When.rst +++ b/reference/constraints/When.rst @@ -163,7 +163,7 @@ validation of constraints won't be triggered. To learn more about the expression language syntax, see :doc:`/reference/formats/expression_language`. -Depending on how you use the constraint, you have access to 1 or 3 variables +Depending on how you use the constraint, you have access to different variables in your expression: ``this`` @@ -172,7 +172,13 @@ in your expression: The value of the property being validated (only available when the constraint is applied to a property). ``context`` - This is the context that is used in validation + The :class:`Symfony\\Component\\Validator\\Context\\ExecutionContextInterface` + object that provides information such as the currently validated class, the + name of the currently validated property, the list of violations, etc. + +.. versionadded:: 7.2 + + The ``context`` variable in expressions was introduced in Symfony 7.2. The ``value`` variable can be used when you want to execute more complex validation based on its value: From 8ce8f9ba8491d4afd91f8fa0da0cd1196fe826c6 Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Mon, 27 Jan 2025 08:16:36 +0100 Subject: [PATCH 447/477] [Messenger] Describe `--keepalive` option (AmazonSQS & Beanstalkd) --- messenger.rst | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/messenger.rst b/messenger.rst index 0965cbc9170..217061d302c 100644 --- a/messenger.rst +++ b/messenger.rst @@ -543,6 +543,19 @@ command with the ``--all`` option: The ``--all`` option was introduced in Symfony 7.1. +The ``--keepalive`` option can be used to prevent messages from being prematurely +redelivered during long-running processing. It marks the message as "in progress" +and prevents it from being redelivered until the worker finishes processing it. + +.. note:: + + This option is only available for supported transports, which are + the Beanstalkd and AmazonSQS transports. + +.. versionadded:: 7.2 + + The ``--keepalive`` option was introduced in Symfony 7.2. + .. tip:: In a development environment and if you're using the Symfony CLI tool, @@ -1709,6 +1722,10 @@ The transport has a number of options: The message time to run before it is put back in the ready queue - in seconds. +.. versionadded:: 7.2 + + Keepalive support, using the ``--keepalive`` option, was added in Symfony 7.2. + .. _messenger-redis-transport: Redis Transport @@ -2031,6 +2048,10 @@ The transport has a number of options: FIFO queues don't support setting a delay per message, a value of ``delay: 0`` is required in the retry strategy settings. +.. versionadded:: 7.2 + + Keepalive support, using the `--keepalive` option, was added in Symfony 7.2. + Serializing Messages ~~~~~~~~~~~~~~~~~~~~ From 9f26f64863bb81880c0373f0c0efd0126a1a8712 Mon Sep 17 00:00:00 2001 From: Alsciende Date: Sat, 19 Oct 2024 12:48:17 +0200 Subject: [PATCH 448/477] [Messenger] Add a tip about using `make:messenger-middleware` --- messenger.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/messenger.rst b/messenger.rst index 217061d302c..cae1d795891 100644 --- a/messenger.rst +++ b/messenger.rst @@ -2920,6 +2920,11 @@ and a different instance will be created per bus. $bus->middleware()->id('App\Middleware\AnotherMiddleware'); }; +.. tip:: + + If you have installed the Maker bundle, you can use the ``make:messenger-middleware`` command + to bootstrap the creation your own messenger middleware. + .. _middleware-doctrine: Middleware for Doctrine From 2ed9ab1a6206290c5b843eabf9eb0434f7b2b1b9 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Mon, 3 Feb 2025 12:24:21 +0100 Subject: [PATCH 449/477] Minor tweak --- messenger.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/messenger.rst b/messenger.rst index cae1d795891..d01ac3890fb 100644 --- a/messenger.rst +++ b/messenger.rst @@ -2922,8 +2922,8 @@ and a different instance will be created per bus. .. tip:: - If you have installed the Maker bundle, you can use the ``make:messenger-middleware`` command - to bootstrap the creation your own messenger middleware. + If you have installed the MakerBundle, you can use the ``make:messenger-middleware`` + command to bootstrap the creation your own messenger middleware. .. _middleware-doctrine: From 4ac85c1c5521a5933a64cadd591375fbc2b1fda3 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Tue, 4 Feb 2025 09:46:11 +0100 Subject: [PATCH 450/477] [#20337] fix typo --- messenger.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/messenger.rst b/messenger.rst index 5458910d46a..e4f4abf60eb 100644 --- a/messenger.rst +++ b/messenger.rst @@ -2925,7 +2925,7 @@ and a different instance will be created per bus. .. tip:: If you have installed the MakerBundle, you can use the ``make:messenger-middleware`` - command to bootstrap the creation your own messenger middleware. + command to bootstrap the creation of your own messenger middleware. .. _middleware-doctrine: From da9ed9877aecbcb54fc97b61561ec018311ecff0 Mon Sep 17 00:00:00 2001 From: Alexis Urien Date: Thu, 6 Feb 2025 11:54:32 -0800 Subject: [PATCH 451/477] Update tags.rst I think it's the new recommanded way for bundles (as seen here https://symfony.com/doc/current/bundles/extension.html) --- service_container/tags.rst | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/service_container/tags.rst b/service_container/tags.rst index 270d6702f5a..fde9c2640aa 100644 --- a/service_container/tags.rst +++ b/service_container/tags.rst @@ -171,6 +171,25 @@ In a Symfony bundle, call this method in the ``load()`` method of the } } +or if you are following the recommended way for new bundles and for bundles following the +:ref:`recommended directory structure `:: + + // ... + use Symfony\Component\DependencyInjection\ContainerBuilder; + use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; + use Symfony\Component\HttpKernel\Bundle\AbstractBundle; + + class MyBundle extends AbstractBundle + { + public function loadExtension(array $config, ContainerConfigurator $container, ContainerBuilder $builder): void + { + $builder + ->registerForAutoconfiguration(CustomInterface::class) + ->addTag('app.custom_tag') + ; + } + } + Autoconfiguration registering is not limited to interfaces. It is possible to use PHP attributes to autoconfigure services by using the :method:`Symfony\\Component\\DependencyInjection\\ContainerBuilder::registerAttributeForAutoconfiguration` From 3de90f363a446bb0d675c110c7529014e45604c7 Mon Sep 17 00:00:00 2001 From: Hugo Alliaume Date: Tue, 11 Feb 2025 15:52:18 +0100 Subject: [PATCH 452/477] [Cache] Fix "Marshalling (Serializing) Data" code rendering issue --- components/cache.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/cache.rst b/components/cache.rst index 939627b1807..4873fb7abc7 100644 --- a/components/cache.rst +++ b/components/cache.rst @@ -209,11 +209,11 @@ the cache items before storing them. The :class:`Symfony\\Component\\Cache\\Marshaller\\DefaultMarshaller` uses PHP's ``serialize()`` function by default, but you can optionally use the ``igbinary_serialize()`` -function from the `Igbinary extension`_: +function from the `Igbinary extension`_:: use Symfony\Component\Cache\Adapter\RedisAdapter; - use Symfony\Component\Cache\DefaultMarshaller; - use Symfony\Component\Cache\DeflateMarshaller; + use Symfony\Component\Cache\Marshaller\DefaultMarshaller; + use Symfony\Component\Cache\Marshaller\DeflateMarshaller; $marshaller = new DeflateMarshaller(new DefaultMarshaller()); // you can optionally use the Igbinary extension if you have it installed From 2af4cbece3c63074ea77e2a3bae2717b03c89e07 Mon Sep 17 00:00:00 2001 From: Sherin Bloemendaal Date: Mon, 17 Feb 2025 15:27:01 +0100 Subject: [PATCH 453/477] Remove per-property support, dropped in Symfony 7.0 --- components/var_exporter.rst | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/components/var_exporter.rst b/components/var_exporter.rst index 6aa4279788e..fc6b34868db 100644 --- a/components/var_exporter.rst +++ b/components/var_exporter.rst @@ -264,17 +264,6 @@ While you never query ``$processor->hash`` value, heavy methods will never be triggered. But still, the ``$processor`` object exists and can be used in your code, passed to methods, functions, etc. -Additionally and by adding two arguments to the initializer function, it is -possible to initialize properties one-by-one:: - - $processor = LazyHashProcessor::createLazyGhost(initializer: function (HashProcessor $instance, string $propertyName, ?string $propertyScope): mixed { - if (HashProcessor::class === $propertyScope && 'hash' === $propertyName) { - // Return $hash value - } - - // Then you can add more logic for the other properties - }); - Ghost objects unfortunately can't work with abstract classes or internal PHP classes. Nevertheless, the VarExporter component covers this need with the help of :ref:`Virtual Proxies `. From 044c5aa27a5838109efe5572d0cf910bb9dac614 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Tue, 18 Feb 2025 08:22:00 +0100 Subject: [PATCH 454/477] Add a deprecation notice --- components/var_exporter.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/components/var_exporter.rst b/components/var_exporter.rst index fc6b34868db..e4d01ee6ecf 100644 --- a/components/var_exporter.rst +++ b/components/var_exporter.rst @@ -260,6 +260,11 @@ convert non-lazy classes to lazy ones:: $instance->validateHash(); }); +.. deprecated:: 7.0 + + The ``initializer`` function allowed passing two arguments to it to initialize + properties one by one. This feature was removed in Symfony 7.0. + While you never query ``$processor->hash`` value, heavy methods will never be triggered. But still, the ``$processor`` object exists and can be used in your code, passed to methods, functions, etc. From 659937bf44de6b414936d27bebd9f5818fad6b05 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Tue, 18 Feb 2025 17:08:11 +0100 Subject: [PATCH 455/477] [Notifier] Reformat the tables that list the service integrations --- notifier.rst | 110 ++++++++++++++++++++++++++++++++------------------- 1 file changed, 69 insertions(+), 41 deletions(-) diff --git a/notifier.rst b/notifier.rst index 36fbd5ada89..2382dfee284 100644 --- a/notifier.rst +++ b/notifier.rst @@ -350,30 +350,50 @@ The chat channel is used to send chat messages to users by using :class:`Symfony\\Component\\Notifier\\Chatter` classes. Symfony provides integration with these chat services: -======================================= ==================================== ============================================================================= -Service Package DSN -======================================= ==================================== ============================================================================= -`AmazonSns`_ ``symfony/amazon-sns-notifier`` ``sns://ACCESS_KEY:SECRET_KEY@default?region=REGION`` -`Bluesky`_ ``symfony/bluesky-notifier`` ``bluesky://USERNAME:PASSWORD@default`` -`Chatwork`_ ``symfony/chatwork-notifier`` ``chatwork://API_TOKEN@default?room_id=ID`` -`Discord`_ ``symfony/discord-notifier`` ``discord://TOKEN@default?webhook_id=ID`` -`FakeChat`_ ``symfony/fake-chat-notifier`` ``fakechat+email://default?to=TO&from=FROM`` or ``fakechat+logger://default`` -`Firebase`_ ``symfony/firebase-notifier`` ``firebase://USERNAME:PASSWORD@default`` -`GoogleChat`_ ``symfony/google-chat-notifier`` ``googlechat://ACCESS_KEY:ACCESS_TOKEN@default/SPACE?thread_key=THREAD_KEY`` -`LINE Bot`_ ``symfony/line-bot-notifier`` ``linebot://TOKEN@default?receiver=RECEIVER`` -`LINE Notify`_ ``symfony/line-notify-notifier`` ``linenotify://TOKEN@default`` -`LinkedIn`_ ``symfony/linked-in-notifier`` ``linkedin://TOKEN:USER_ID@default`` -`Mastodon`_ ``symfony/mastodon-notifier`` ``mastodon://ACCESS_TOKEN@HOST`` -`Mattermost`_ ``symfony/mattermost-notifier`` ``mattermost://ACCESS_TOKEN@HOST/PATH?channel=CHANNEL`` -`Mercure`_ ``symfony/mercure-notifier`` ``mercure://HUB_ID?topic=TOPIC`` -`MicrosoftTeams`_ ``symfony/microsoft-teams-notifier`` ``microsoftteams://default/PATH`` -`RocketChat`_ ``symfony/rocket-chat-notifier`` ``rocketchat://TOKEN@ENDPOINT?channel=CHANNEL`` -`Slack`_ ``symfony/slack-notifier`` ``slack://TOKEN@default?channel=CHANNEL`` -`Telegram`_ ``symfony/telegram-notifier`` ``telegram://TOKEN@default?channel=CHAT_ID`` -`Twitter`_ ``symfony/twitter-notifier`` ``twitter://API_KEY:API_SECRET:ACCESS_TOKEN:ACCESS_SECRET@default`` -`Zendesk`_ ``symfony/zendesk-notifier`` ``zendesk://EMAIL:TOKEN@SUBDOMAIN`` -`Zulip`_ ``symfony/zulip-notifier`` ``zulip://EMAIL:TOKEN@HOST?channel=CHANNEL`` -====================================== ==================================== ============================================================================= +====================================== ===================================================================================== +Service +====================================== ===================================================================================== +`AmazonSns`_ **Install**: ``composer require symfony/amazon-sns-notifier`` \ + **DSN**: ``sns://ACCESS_KEY:SECRET_KEY@default?region=REGION`` +`Bluesky`_ **Install**: ``composer require symfony/bluesky-notifier`` \ + **DSN**: ``bluesky://USERNAME:PASSWORD@default`` +`Chatwork`_ **Install**: ``composer require symfony/chatwork-notifier`` \ + **DSN**: ``chatwork://API_TOKEN@default?room_id=ID`` +`Discord`_ **Install**: ``composer require symfony/discord-notifier`` \ + **DSN**: ``discord://TOKEN@default?webhook_id=ID`` +`FakeChat`_ **Install**: ``composer require symfony/fake-chat-notifier`` \ + **DSN**: ``fakechat+email://default?to=TO&from=FROM`` or ``fakechat+logger://default`` +`Firebase`_ **Install**: ``composer require symfony/firebase-notifier`` \ + **DSN**: ``firebase://USERNAME:PASSWORD@default`` +`GoogleChat`_ **Install**: ``composer require symfony/google-chat-notifier`` \ + **DSN**: ``googlechat://ACCESS_KEY:ACCESS_TOKEN@default/SPACE?thread_key=THREAD_KEY`` +`LINE Bot`_ **Install**: ``composer require symfony/line-bot-notifier`` \ + **DSN**: ``linebot://TOKEN@default?receiver=RECEIVER`` +`LINE Notify`_ **Install**: ``composer require symfony/line-notify-notifier`` \ + **DSN**: ``linenotify://TOKEN@default`` +`LinkedIn`_ **Install**: ``composer require symfony/linked-in-notifier`` \ + **DSN**: ``linkedin://TOKEN:USER_ID@default`` +`Mastodon`_ **Install**: ``composer require symfony/mastodon-notifier`` \ + **DSN**: ``mastodon://ACCESS_TOKEN@HOST`` +`Mattermost`_ **Install**: ``composer require symfony/mattermost-notifier`` \ + **DSN**: ``mattermost://ACCESS_TOKEN@HOST/PATH?channel=CHANNEL`` +`Mercure`_ **Install**: ``composer require symfony/mercure-notifier`` \ + **DSN**: ``mercure://HUB_ID?topic=TOPIC`` +`MicrosoftTeams`_ **Install**: ``composer require symfony/microsoft-teams-notifier`` \ + **DSN**: ``microsoftteams://default/PATH`` +`RocketChat`_ **Install**: ``composer require symfony/rocket-chat-notifier`` \ + **DSN**: ``rocketchat://TOKEN@ENDPOINT?channel=CHANNEL`` +`Slack`_ **Install**: ``composer require symfony/slack-notifier`` \ + **DSN**: ``slack://TOKEN@default?channel=CHANNEL`` +`Telegram`_ **Install**: ``composer require symfony/telegram-notifier`` \ + **DSN**: ``telegram://TOKEN@default?channel=CHAT_ID`` +`Twitter`_ **Install**: ``composer require symfony/twitter-notifier`` \ + **DSN**: ``twitter://API_KEY:API_SECRET:ACCESS_TOKEN:ACCESS_SECRET@default`` +`Zendesk`_ **Install**: ``composer require symfony/zendesk-notifier`` \ + **DSN**: ``zendesk://EMAIL:TOKEN@SUBDOMAIN`` +`Zulip`_ **Install**: ``composer require symfony/zulip-notifier`` \ + **DSN**: ``zulip://EMAIL:TOKEN@HOST?channel=CHANNEL`` +====================================== ===================================================================================== .. versionadded:: 7.1 @@ -569,18 +589,26 @@ The push channel is used to send notifications to users by using :class:`Symfony\\Component\\Notifier\\Texter` classes. Symfony provides integration with these push services: -=============== ==================================== ============================================================================== -Service Package DSN -=============== ==================================== ============================================================================== -`Engagespot`_ ``symfony/engagespot-notifier`` ``engagespot://API_KEY@default?campaign_name=CAMPAIGN_NAME`` -`Expo`_ ``symfony/expo-notifier`` ``expo://Token@default`` -`Novu`_ ``symfony/novu-notifier`` ``novu://API_KEY@default`` -`Ntfy`_ ``symfony/ntfy-notifier`` ``ntfy://default/TOPIC`` -`OneSignal`_ ``symfony/one-signal-notifier`` ``onesignal://APP_ID:API_KEY@default?defaultRecipientId=DEFAULT_RECIPIENT_ID`` -`PagerDuty`_ ``symfony/pager-duty-notifier`` ``pagerduty://TOKEN@SUBDOMAIN`` -`Pushover`_ ``symfony/pushover-notifier`` ``pushover://USER_KEY:APP_TOKEN@default`` -`Pushy`_ ``symfony/pushy-notifier`` ``pushy://API_KEY@default`` -=============== ==================================== ============================================================================== +=============== ======================================================================================= +Service +=============== ======================================================================================= +`Engagespot`_ **Install**: ``composer require symfony/engagespot-notifier`` \ + **DSN**: ``engagespot://API_KEY@default?campaign_name=CAMPAIGN_NAME`` +`Expo`_ **Install**: ``composer require symfony/expo-notifier`` \ + **DSN**: ``expo://TOKEN@default`` +`Novu`_ **Install**: ``composer require symfony/novu-notifier`` \ + **DSN**: ``novu://API_KEY@default`` +`Ntfy`_ **Install**: ``composer require symfony/ntfy-notifier`` \ + **DSN**: ``ntfy://default/TOPIC`` +`OneSignal`_ **Install**: ``composer require symfony/one-signal-notifier`` \ + **DSN**: ``onesignal://APP_ID:API_KEY@default?defaultRecipientId=DEFAULT_RECIPIENT_ID`` +`PagerDuty`_ **Install**: ``composer require symfony/pager-duty-notifier`` \ + **DSN**: ``pagerduty://TOKEN@SUBDOMAIN`` +`Pushover`_ **Install**: ``composer require symfony/pushover-notifier`` \ + **DSN**: ``pushover://USER_KEY:APP_TOKEN@default`` +`Pushy`_ **Install**: ``composer require symfony/pushy-notifier`` \ + **DSN**: ``pushy://API_KEY@default`` +=============== ======================================================================================= To enable a texter, add the correct DSN in your ``.env`` file and configure the ``texter_transports``: @@ -645,11 +673,11 @@ The desktop channel is used to display local desktop notifications on the same host machine using :class:`Symfony\\Component\\Notifier\\Texter` classes. Currently, Symfony is integrated with the following providers: -=============== ==================================== ============================================================================== -Provider Package DSN -=============== ==================================== ============================================================================== -`JoliNotif`_ ``symfony/joli-notif-notifier`` ``jolinotif://default`` -=============== ==================================== ============================================================================== +=============== ================================================ ============================================================================== +Provider Install DSN +=============== ================================================ ============================================================================== +`JoliNotif`_ ``composer require symfony/joli-notif-notifier`` ``jolinotif://default`` +=============== ================================================ ============================================================================== .. versionadded:: 7.2 From 569f548afe86539b48925fed3e1ba68fe6c3c0e9 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Tue, 4 Mar 2025 08:28:55 +0100 Subject: [PATCH 456/477] [Reference] Sort debug options alphabetically --- reference/configuration/debug.rst | 52 +++++++++++++++---------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/reference/configuration/debug.rst b/reference/configuration/debug.rst index cd42d79d157..6ca05b49bd7 100644 --- a/reference/configuration/debug.rst +++ b/reference/configuration/debug.rst @@ -23,32 +23,6 @@ key in your application configuration. namespace and the related XSD schema is available at: ``https://symfony.com/schema/dic/debug/debug-1.0.xsd`` -max_items -~~~~~~~~~ - -**type**: ``integer`` **default**: ``2500`` - -This is the maximum number of items to dump. Setting this option to ``-1`` -disables the limit. - -min_depth -~~~~~~~~~ - -**type**: ``integer`` **default**: ``1`` - -Configures the minimum tree depth until which all items are guaranteed to -be cloned. After this depth is reached, only ``max_items`` items will be -cloned. The default value is ``1``, which is consistent with older Symfony -versions. - -max_string_length -~~~~~~~~~~~~~~~~~ - -**type**: ``integer`` **default**: ``-1`` - -This option configures the maximum string length before truncating the -string. The default value (``-1``) means that strings are never truncated. - .. _configuration-debug-dump_destination: dump_destination @@ -98,3 +72,29 @@ Typically, you would set this to ``php://stderr``: Configure it to ``"tcp://%env(VAR_DUMPER_SERVER)%"`` in order to use the :ref:`ServerDumper feature `. + +max_items +~~~~~~~~~ + +**type**: ``integer`` **default**: ``2500`` + +This is the maximum number of items to dump. Setting this option to ``-1`` +disables the limit. + +max_string_length +~~~~~~~~~~~~~~~~~ + +**type**: ``integer`` **default**: ``-1`` + +This option configures the maximum string length before truncating the +string. The default value (``-1``) means that strings are never truncated. + +min_depth +~~~~~~~~~ + +**type**: ``integer`` **default**: ``1`` + +Configures the minimum tree depth until which all items are guaranteed to +be cloned. After this depth is reached, only ``max_items`` items will be +cloned. The default value is ``1``, which is consistent with older Symfony +versions. From 96bb798bc1dce7780827dd51cecaafde94b9ae6c Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Tue, 4 Mar 2025 09:40:01 +0100 Subject: [PATCH 457/477] [Reference] Sort all framework options alphabetically --- reference/configuration/framework.rst | 4643 +++++++++++++------------ 1 file changed, 2322 insertions(+), 2321 deletions(-) diff --git a/reference/configuration/framework.rst b/reference/configuration/framework.rst index e58a7ebc80f..0334b918c66 100644 --- a/reference/configuration/framework.rst +++ b/reference/configuration/framework.rst @@ -19,236 +19,355 @@ configured under the ``framework`` key in your application configuration. namespace and the related XSD schema is available at: ``https://symfony.com/schema/dic/symfony/symfony-1.0.xsd`` -.. _configuration-framework-secret: +annotations +~~~~~~~~~~~ -secret -~~~~~~ +.. _reference-annotations-cache: -**type**: ``string`` **required** +cache +..... -This is a string that should be unique to your application and it's commonly -used to add more entropy to security related operations. Its value should -be a series of characters, numbers and symbols chosen randomly and the -recommended length is around 32 characters. +**type**: ``string`` **default**: ``php_array`` -In practice, Symfony uses this value for encrypting the cookies used -in the :doc:`remember me functionality ` and for -creating signed URIs when using :ref:`ESI (Edge Side Includes) `. -That's why you should treat this value as if it were a sensitive credential and -**never make it public**. +This option can be one of the following values: -This option becomes the service container parameter named ``kernel.secret``, -which you can use whenever the application needs an immutable random string -to add more entropy. +php_array + Use a PHP array to cache annotations in memory +file + Use the filesystem to cache annotations +none + Disable the caching of annotations -As with any other security-related parameter, it is a good practice to change -this value from time to time. However, keep in mind that changing this value -will invalidate all signed URIs and Remember Me cookies. That's why, after -changing this value, you should regenerate the application cache and log -out all the application users. +debug +..... -handle_all_throwables -~~~~~~~~~~~~~~~~~~~~~ +**type**: ``boolean`` **default**: ``%kernel.debug%`` -**type**: ``boolean`` **default**: ``true`` +Whether to enable debug mode for caching. If enabled, the cache will +automatically update when the original file is changed (both with code and +annotation changes). For performance reasons, it is recommended to disable +debug mode in production, which will happen automatically if you use the +default value. -When set to ``true``, the Symfony kernel will catch all ``\Throwable`` exceptions -thrown by the application and will turn them into HTTP responses. +file_cache_dir +.............. -.. _configuration-framework-http_cache: +**type**: ``string`` **default**: ``%kernel.cache_dir%/annotations`` -http_cache -~~~~~~~~~~ +The directory to store cache files for annotations, in case +``annotations.cache`` is set to ``'file'``. -enabled -....... +assets +~~~~~~ -**type**: ``boolean`` **default**: ``false`` +.. _reference-assets-base-path: -debug -..... +base_path +......... -**type**: ``boolean`` **default**: ``%kernel.debug%`` +**type**: ``string`` -If true, exceptions are thrown when things go wrong. Otherwise, the cache will -try to carry on and deliver a meaningful response. +This option allows you to define a base path to be used for assets: -trace_level -........... +.. configuration-block:: -**type**: ``string`` **possible values**: ``'none'``, ``'short'`` or ``'full'`` + .. code-block:: yaml -For 'short', a concise trace of the main request will be added as an HTTP header. -'full' will add traces for all requests (including ESI subrequests). -(default: 'full' if in debug; 'none' otherwise) + # config/packages/framework.yaml + framework: + # ... + assets: + base_path: '/images' -trace_header -............ + .. code-block:: xml -**type**: ``string`` + + + -Header name to use for traces. (default: X-Symfony-Cache) + + + + -default_ttl -........... + .. code-block:: php -**type**: ``integer`` + // config/packages/framework.php + use Symfony\Config\FrameworkConfig; -The number of seconds that a cache entry should be considered fresh when no -explicit freshness information is provided in a response. Explicit -Cache-Control or Expires headers override this value. (default: 0) + return static function (FrameworkConfig $framework): void { + // ... + $framework->assets() + ->basePath('/images'); + }; -private_headers -............... +.. _reference-templating-base-urls: +.. _reference-assets-base-urls: + +base_urls +......... **type**: ``array`` -Set of request headers that trigger "private" cache-control behavior on responses -that don't explicitly state whether the response is public or private via a -Cache-Control directive. (default: Authorization and Cookie) +This option allows you to define base URLs to be used for assets. +If multiple base URLs are provided, Symfony will select one from the +collection each time it generates an asset's path: -skip_response_headers -..................... +.. configuration-block:: -**type**: ``array`` **default**: ``Set-Cookie`` + .. code-block:: yaml -Set of response headers that will never be cached even when the response is cacheable -and public. + # config/packages/framework.yaml + framework: + # ... + assets: + base_urls: + - 'http://cdn.example.com/' -allow_reload -............ + .. code-block:: xml -**type**: ``string`` + + + -Specifies whether the client can force a cache reload by including a -Cache-Control "no-cache" directive in the request. Set it to ``true`` -for compliance with RFC 2616. (default: false) + + + + -allow_revalidate -................ + .. code-block:: php -**type**: ``string`` + // config/packages/framework.php + use Symfony\Config\FrameworkConfig; -Specifies whether the client can force a cache revalidate by including a -Cache-Control "max-age=0" directive in the request. Set it to ``true`` -for compliance with RFC 2616. (default: false) + return static function (FrameworkConfig $framework): void { + // ... + $framework->assets() + ->baseUrls(['http://cdn.example.com/']); + }; -stale_while_revalidate -...................... +.. _reference-assets-json-manifest-path: +.. _reference-templating-json-manifest-path: -**type**: ``integer`` +json_manifest_path +.................. -Specifies the default number of seconds (the granularity is the second as the -Response TTL precision is a second) during which the cache can immediately return -a stale response while it revalidates it in the background (default: 2). -This setting is overridden by the stale-while-revalidate HTTP Cache-Control -extension (see RFC 5861). +**type**: ``string`` **default**: ``null`` -stale_if_error -.............. +The file path or absolute URL to a ``manifest.json`` file containing an +associative array of asset names and their respective compiled names. A common +cache-busting technique using a "manifest" file works by writing out assets with +a "hash" appended to their file names (e.g. ``main.ae433f1cb.css``) during a +front-end compilation routine. -**type**: ``integer`` +.. tip:: -Specifies the default number of seconds (the granularity is the second) during -which the cache can serve a stale response when an error is encountered -(default: 60). This setting is overridden by the stale-if-error HTTP -Cache-Control extension (see RFC 5861). + Symfony's :ref:`Webpack Encore ` supports + :ref:`outputting hashed assets `. Moreover, this + can be incorporated into many other workflows, including Webpack and + Gulp using `webpack-manifest-plugin`_ and `gulp-rev`_, respectively. + +This option can be set globally for all assets and individually for each asset +package: + +.. configuration-block:: + + .. code-block:: yaml + + # config/packages/framework.yaml + framework: + assets: + # this manifest is applied to every asset (including packages) + json_manifest_path: "%kernel.project_dir%/public/build/manifest.json" + # you can use absolute URLs too and Symfony will download them automatically + # json_manifest_path: 'https://cdn.example.com/manifest.json' + packages: + foo_package: + # this package uses its own manifest (the default file is ignored) + json_manifest_path: "%kernel.project_dir%/public/build/a_different_manifest.json" + # Throws an exception when an asset is not found in the manifest + strict_mode: %kernel.debug% + bar_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 + use Symfony\Config\FrameworkConfig; + + return static function (FrameworkConfig $framework): void { + // ... + $framework->assets() + // this manifest is applied to every asset (including packages) + ->jsonManifestPath('%kernel.project_dir%/public/build/manifest.json'); + + // you can use absolute URLs too and Symfony will download them automatically + // 'json_manifest_path' => 'https://cdn.example.com/manifest.json', + $framework->assets()->package('foo_package') + // this package uses its own manifest (the default file is ignored) + ->jsonManifestPath('%kernel.project_dir%/public/build/a_different_manifest.json') + // Throws an exception when an asset is not found in the manifest + ->setStrictMode('%kernel.debug%'); + + $framework->assets()->package('bar_package') + // this package uses the global manifest (the default file is used) + ->basePath('/images'); + }; + +.. note:: + + This parameter cannot be set at the same time as ``version`` or ``version_strategy``. + Additionally, this option cannot be nullified at the package scope if a global manifest + file is specified. + +.. tip:: + + If you request an asset that is *not found* in the ``manifest.json`` file, the original - + *unmodified* - asset path will be returned. + You can set ``strict_mode`` to ``true`` to get an exception when an asset is *not found*. - .. _configuration-framework-http_method_override: +.. note:: -http_method_override -~~~~~~~~~~~~~~~~~~~~ + If a URL is set, the JSON manifest is downloaded on each request using the `http_client`_. -**type**: ``boolean`` **default**: ``false`` +.. _reference-framework-assets-packages: -This determines whether the ``_method`` request parameter is used as the -intended HTTP method on POST requests. If enabled, the -:method:`Request::enableHttpMethodParameterOverride ` -method gets called automatically. It becomes the service container parameter -named ``kernel.http_method_override``. +packages +........ -.. seealso:: +You can group assets into packages, to specify different base URLs for them: - :ref:`Changing the Action and HTTP Method ` of - Symfony forms. +.. configuration-block:: -.. warning:: + .. code-block:: yaml - If you're using the :ref:`HttpCache Reverse Proxy ` - with this option, the kernel will ignore the ``_method`` parameter, - which could lead to errors. + # config/packages/framework.yaml + framework: + # ... + assets: + packages: + avatars: + base_urls: 'http://static_cdn.example.com/avatars' - To fix this, invoke the ``enableHttpMethodParameterOverride()`` method - before creating the ``Request`` object:: + .. code-block:: xml - // public/index.php + + + - // ... - $kernel = new CacheKernel($kernel); + + + + + + - Request::enableHttpMethodParameterOverride(); // <-- add this line - $request = Request::createFromGlobals(); - // ... + .. code-block:: php -trust_x_sendfile_type_header -~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // config/packages/framework.php + use Symfony\Config\FrameworkConfig; -**type**: ``boolean`` **default**: ``%env(bool:default::SYMFONY_TRUST_X_SENDFILE_TYPE_HEADER)%`` + return static function (FrameworkConfig $framework): void { + // ... + $framework->assets() + ->package('avatars') + ->baseUrls(['http://static_cdn.example.com/avatars']); + }; -.. versionadded:: 7.2 +Now you can use the ``avatars`` package in your templates: - In Symfony 7.2, the default value of this option was changed from ``false`` to the - value stored in the ``SYMFONY_TRUST_X_SENDFILE_TYPE_HEADER`` environment variable. +.. code-block:: html+twig -``X-Sendfile`` is a special HTTP header that tells web servers to replace the -response contents by the file that is defined in that header. This improves -performance because files are no longer served by your application but directly -by the web server. + -This configuration option determines whether to trust ``x-sendfile`` header for -BinaryFileResponse. If enabled, Symfony calls the -:method:`BinaryFileResponse::trustXSendfileTypeHeader ` -method automatically. It becomes the service container parameter named -``kernel.trust_x_sendfile_type_header``. +Each package can configure the following options: -.. _reference-framework-trusted-headers: +* :ref:`base_path ` +* :ref:`base_urls ` +* :ref:`version_strategy ` +* :ref:`version ` +* :ref:`version_format ` +* :ref:`json_manifest_path ` +* :ref:`strict_mode ` -trusted_headers -~~~~~~~~~~~~~~~ +.. _reference-assets-strict-mode: -The ``trusted_headers`` option is needed to configure which client information -should be trusted (e.g. their host) when running Symfony behind a load balancer -or a reverse proxy. See :doc:`/deployment/proxies`. +strict_mode +........... -.. _reference-framework-trusted-proxies: +**type**: ``boolean`` **default**: ``false`` -trusted_proxies -~~~~~~~~~~~~~~~ +When enabled, the strict mode asserts that all requested assets are in the +manifest file. This option is useful to detect typos or missing assets, the +recommended value is ``%kernel.debug%``. -The ``trusted_proxies`` option is needed to get precise information about the -client (e.g. their IP address) when running Symfony behind a load balancer or a -reverse proxy. See :doc:`/deployment/proxies`. +.. _reference-framework-assets-version: +.. _ref-framework-assets-version: -ide -~~~ +version +....... -**type**: ``string`` **default**: ``%env(default::SYMFONY_IDE)%`` +**type**: ``string`` -Symfony turns file paths seen in variable dumps and exception messages into -links that open those files right inside your browser. If you prefer to open -those files in your favorite IDE or text editor, set this option to any of the -following values: ``phpstorm``, ``sublime``, ``textmate``, ``macvim``, ``emacs``, -``atom`` and ``vscode``. +This option is used to *bust* the cache on assets by globally adding a query +parameter to all rendered asset paths (e.g. ``/images/logo.png?v2``). This +applies only to assets rendered via the Twig ``asset()`` function (or PHP +equivalent). -.. note:: +For example, suppose you have the following: - The ``phpstorm`` option is supported natively by PhpStorm on macOS and - Windows; Linux requires installing `phpstorm-url-handler`_. +.. code-block:: html+twig -If you use another editor, the expected configuration value is a URL template -that contains an ``%f`` placeholder where the file path is expected and ``%l`` -placeholder for the line number (percentage signs (``%``) must be escaped by -doubling them to prevent Symfony from interpreting them as container parameters). + Symfony! + +By default, this will render a path to your image such as ``/images/logo.png``. +Now, activate the ``version`` option: .. configuration-block:: @@ -256,7 +375,9 @@ doubling them to prevent Symfony from interpreting them as container parameters) # config/packages/framework.yaml framework: - ide: 'myide://open?url=file://%%f&line=%%l' + # ... + assets: + version: 'v2' .. code-block:: xml @@ -269,7 +390,9 @@ doubling them to prevent Symfony from interpreting them as container parameters) https://symfony.com/schema/dic/services/services-1.0.xsd http://symfony.com/schema/dic/symfony https://symfony.com/schema/dic/symfony/symfony-1.0.xsd"> - + + + .. code-block:: php @@ -278,203 +401,245 @@ doubling them to prevent Symfony from interpreting them as container parameters) use Symfony\Config\FrameworkConfig; return static function (FrameworkConfig $framework): void { - $framework->ide('myide://open?url=file://%%f&line=%%l'); + // ... + $framework->assets() + ->version('v2'); }; -Since every developer uses a different IDE, the recommended way to enable this -feature is to configure it on a system level. First, you can define this option -in the ``SYMFONY_IDE`` environment variable, which Symfony reads automatically -when ``framework.ide`` config is not set. - -Another alternative is to set the ``xdebug.file_link_format`` option in your -``php.ini`` configuration file. The format to use is the same as for the -``framework.ide`` option, but without the need to escape the percent signs -(``%``) by doubling them: - -.. code-block:: ini - - // example for PhpStorm - xdebug.file_link_format="phpstorm://open?file=%f&line=%l" - - // example for PhpStorm with Jetbrains Toolbox - xdebug.file_link_format="jetbrains://phpstorm/navigate/reference?project=example&path=%f:%l" +Now, the same asset will be rendered as ``/images/logo.png?v2`` If you use +this feature, you **must** manually increment the ``version`` value +before each deployment so that the query parameters change. - // example for Sublime Text - xdebug.file_link_format="subl://open?url=file://%f&line=%l" +You can also control how the query string works via the `version_format`_ +option. .. note:: - If both ``framework.ide`` and ``xdebug.file_link_format`` are defined, - Symfony uses the value of the ``xdebug.file_link_format`` option. - -.. tip:: - - Setting the ``xdebug.file_link_format`` ini option works even if the Xdebug - extension is not enabled. + This parameter cannot be set at the same time as ``version_strategy`` or ``json_manifest_path``. .. tip:: - When running your app in a container or in a virtual machine, you can tell - Symfony to map files from the guest to the host by changing their prefix. - This map should be specified at the end of the URL template, using ``&`` and - ``>`` as guest-to-host separators: - - .. code-block:: text - - // /path/to/guest/.../file will be opened - // as /path/to/host/.../file on the host - // and /var/www/app/ as /projects/my_project/ also - 'myide://%%f:%%l&/path/to/guest/>/path/to/host/&/var/www/app/>/projects/my_project/&...' - - // example for PhpStorm - 'phpstorm://open?file=%%f&line=%%l&/var/www/app/>/projects/my_project/' - -.. _reference-framework-test: - -test -~~~~ + As with all settings, you can use a parameter as value for the + ``version``. This makes it easier to increment the cache on each + deployment. -**type**: ``boolean`` +.. _reference-templating-version-format: +.. _reference-assets-version-format: -If this configuration setting is present (and not ``false``), then the services -related to testing your application (e.g. ``test.client``) are loaded. This -setting should be present in your ``test`` environment (usually via -``config/packages/test/framework.yaml``). +version_format +.............. -.. seealso:: +**type**: ``string`` **default**: ``%%s?%%s`` - For more information, see :doc:`/testing`. +This specifies a :phpfunction:`sprintf` pattern that will be used with the +`version`_ option to construct an asset's path. By default, the pattern +adds the asset's version as a query string. For example, if +``version_format`` is set to ``%%s?version=%%s`` and ``version`` +is set to ``5``, the asset's path would be ``/images/logo.png?version=5``. -.. _config-framework-default_locale: +.. note:: -default_locale -~~~~~~~~~~~~~~ + All percentage signs (``%``) in the format string must be doubled to + escape the character. Without escaping, values might inadvertently be + interpreted as :ref:`service-container-parameters`. -**type**: ``string`` **default**: ``en`` +.. tip:: -The default locale is used if no ``_locale`` routing parameter has been -set. It is available with the -:method:`Request::getDefaultLocale ` -method. + Some CDN's do not support cache-busting via query strings, so injecting + the version into the actual file path is necessary. Thankfully, + ``version_format`` is not limited to producing versioned query + strings. -.. seealso:: + The pattern receives the asset's original path and version as its first + and second parameters, respectively. Since the asset's path is one + parameter, you cannot modify it in-place (e.g. ``/images/logo-v5.png``); + however, you can prefix the asset's path using a pattern of + ``version-%%2$s/%%1$s``, which would result in the path + ``version-5/images/logo.png``. - You can read more information about the default locale in - :ref:`translation-default-locale`. + URL rewrite rules could then be used to disregard the version prefix + before serving the asset. Alternatively, you could copy assets to the + appropriate version path as part of your deployment process and forgot + any URL rewriting. The latter option is useful if you would like older + asset versions to remain accessible at their original URL. -.. _reference-translator-enabled-locales: -.. _reference-enabled-locales: +.. _reference-assets-version-strategy: +.. _reference-templating-version-strategy: -enabled_locales -............... +version_strategy +................ -**type**: ``array`` **default**: ``[]`` (empty array = enable all locales) +**type**: ``string`` **default**: ``null`` -Symfony applications generate by default the translation files for validation -and security messages in all locales. If your application only uses some -locales, use this option to restrict the files generated by Symfony and improve -performance a bit: +The service id of the :doc:`asset version strategy ` +applied to the assets. This option can be set globally for all assets and +individually for each asset package: .. configuration-block:: .. code-block:: yaml - # config/packages/translation.yaml + # config/packages/framework.yaml framework: - enabled_locales: ['en', 'es'] + assets: + # this strategy is applied to every asset (including packages) + version_strategy: 'app.asset.my_versioning_strategy' + packages: + foo_package: + # this package removes any versioning (its assets won't be versioned) + version: ~ + bar_package: + # this package uses its own strategy (the default strategy is ignored) + version_strategy: 'app.asset.another_version_strategy' + baz_package: + # this package inherits the default strategy + base_path: '/images' .. code-block:: xml - + - en - es + + + + + + + + .. code-block:: php - // config/packages/translation.php + // config/packages/framework.php use Symfony\Config\FrameworkConfig; return static function (FrameworkConfig $framework): void { - $framework->enabledLocales(['en', 'es']); + // ... + $framework->assets() + ->versionStrategy('app.asset.my_versioning_strategy'); + + $framework->assets()->package('foo_package') + // this package removes any versioning (its assets won't be versioned) + ->version(null); + + $framework->assets()->package('bar_package') + // this package uses its own strategy (the default strategy is ignored) + ->versionStrategy('app.asset.another_version_strategy'); + + $framework->assets()->package('baz_package') + // this package inherits the default strategy + ->basePath('/images'); }; -An added bonus of defining the enabled locales is that they are automatically -added as a requirement of the :ref:`special _locale parameter `. -For example, if you define this value as ``['ar', 'he', 'ja', 'zh']``, the -``_locale`` routing parameter will have an ``ar|he|ja|zh`` requirement. If some -user makes requests with a locale not included in this option, they'll see a 404 error. +.. note:: -set_content_language_from_locale -................................ + This parameter cannot be set at the same time as ``version`` or ``json_manifest_path``. -**type**: ``boolean`` **default**: ``false`` +.. _reference-cache: -If this option is set to ``true``, the response will have a ``Content-Language`` -HTTP header set with the ``Request`` locale. +cache +~~~~~ -set_locale_from_accept_language -............................... +.. _reference-cache-app: -**type**: ``boolean`` **default**: ``false`` +app +... -If this option is set to ``true``, the ``Request`` locale will automatically be -set to the value of the ``Accept-Language`` HTTP header. +**type**: ``string`` **default**: ``cache.adapter.filesystem`` -When the ``_locale`` request attribute is passed, the ``Accept-Language`` header -is ignored. +The cache adapter used by the ``cache.app`` service. The FrameworkBundle +ships with multiple adapters: ``cache.adapter.apcu``, ``cache.adapter.system``, +``cache.adapter.filesystem``, ``cache.adapter.psr6``, ``cache.adapter.redis``, +``cache.adapter.memcached``, ``cache.adapter.pdo`` and +``cache.adapter.doctrine_dbal``. -disallow_search_engine_index -~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +There's also a special adapter called ``cache.adapter.array`` which stores +contents in memory using a PHP array and it's used to disable caching (mostly on +the ``dev`` environment). -**type**: ``boolean`` **default**: ``true`` when the debug mode is enabled, ``false`` otherwise. +.. tip:: -If ``true``, Symfony adds a ``X-Robots-Tag: noindex`` HTTP tag to all responses -(unless your own app adds that header, in which case it's not modified). This -`X-Robots-Tag HTTP header`_ tells search engines to not index your web site. -This option is a protection measure in case you accidentally publish your site -in debug mode. + It might be tough to understand at the beginning, so to avoid confusion + remember that all pools perform the same actions but on different medium + given the adapter they are based on. Internally, a pool wraps the definition + of an adapter. -.. _configuration-framework-trusted-hosts: +default_doctrine_provider +......................... -trusted_hosts -~~~~~~~~~~~~~ +**type**: ``string`` -**type**: ``array`` | ``string`` **default**: ``['%env(default::SYMFONY_TRUSTED_HOSTS)%']`` +The service name to use as your default Doctrine provider. The provider is +available as the ``cache.default_doctrine_provider`` service. -.. versionadded:: 7.2 +default_memcached_provider +.......................... - In Symfony 7.2, the default value of this option was changed from ``[]`` to the - value stored in the ``SYMFONY_TRUSTED_HOSTS`` environment variable. +**type**: ``string`` **default**: ``memcached://localhost`` -A lot of different attacks have been discovered relying on inconsistencies -in handling the ``Host`` header by various software (web servers, reverse -proxies, web frameworks, etc.). Basically, every time the framework is -generating an absolute URL (when sending an email to reset a password for -instance), the host might have been manipulated by an attacker. +The DSN to use by the Memcached provider. The provider is available as the ``cache.default_memcached_provider`` +service. + +default_pdo_provider +.................... + +**type**: ``string`` **default**: ``doctrine.dbal.default_connection`` + +The service id of the database connection, which should be either a PDO or a +Doctrine DBAL instance. The provider is available as the ``cache.default_pdo_provider`` +service. + +default_psr6_provider +..................... + +**type**: ``string`` + +The service name to use as your default PSR-6 provider. It is available as +the ``cache.default_psr6_provider`` service. + +default_redis_provider +...................... + +**type**: ``string`` **default**: ``redis://localhost`` + +The DSN to use by the Redis provider. The provider is available as the ``cache.default_redis_provider`` +service. + +directory +......... + +**type**: ``string`` **default**: ``%kernel.cache_dir%/pools`` + +The path to the cache directory used by services inheriting from the +``cache.adapter.filesystem`` adapter (including ``cache.app``). + +pools +..... + +**type**: ``array`` + +A list of cache pools to be created by the framework extension. .. seealso:: - You can read `HTTP Host header attacks`_ for more information about - these kinds of attacks. + For more information about how pools work, see :ref:`cache pools `. -The Symfony :method:`Request::getHost() ` -method might be vulnerable to some of these attacks because it depends on -the configuration of your web server. One simple solution to avoid these -attacks is to configure a list of hosts that your Symfony application can respond -to. That's the purpose of this ``trusted_hosts`` option. If the incoming -request's hostname doesn't match one of the regular expressions in this list, -the application won't respond and the user will receive a 400 response. +To configure a Redis cache pool with a default lifetime of 1 hour, do the following: .. configuration-block:: @@ -482,7 +647,11 @@ the application won't respond and the user will receive a 400 response. # config/packages/framework.yaml framework: - trusted_hosts: ['^example\.com$', '^example\.org$'] + cache: + pools: + cache.mycache: + adapter: cache.adapter.redis + default_lifetime: 3600 .. code-block:: xml @@ -496,8 +665,13 @@ the application won't respond and the user will receive a 400 response. http://symfony.com/schema/dic/symfony https://symfony.com/schema/dic/symfony/symfony-1.0.xsd"> - ^example\.com$ - ^example\.org$ + + + @@ -508,60 +682,119 @@ the application won't respond and the user will receive a 400 response. use Symfony\Config\FrameworkConfig; return static function (FrameworkConfig $framework): void { - $framework->trustedHosts(['^example\.com$', '^example\.org$']); + $framework->cache() + ->pool('cache.mycache') + ->adapters(['cache.adapter.redis']) + ->defaultLifetime(3600); }; -Hosts can also be configured to respond to any subdomain, via -``^(.+\.)?example\.com$`` for instance. +adapter +""""""" + +**type**: ``string`` **default**: ``cache.app`` + +The service name of the adapter to use. You can specify one of the default +services that follow the pattern ``cache.adapter.[type]``. Alternatively you +can specify another cache pool as base, which will make this pool inherit the +settings from the base pool as defaults. + +.. note:: + + Your service needs to implement the ``Psr\Cache\CacheItemPoolInterface`` interface. + +clearer +""""""" + +**type**: ``string`` + +The cache clearer used to clear your PSR-6 cache. + +.. seealso:: + + For more information, see :class:`Symfony\\Component\\HttpKernel\\CacheClearer\\Psr6CacheClearer`. + +default_lifetime +"""""""""""""""" + +**type**: ``integer`` | ``string`` + +Default lifetime of your cache items. Give an integer value to set the default +lifetime in seconds. A string value could be ISO 8601 time interval, like ``"PT5M"`` +or a PHP date expression that is accepted by ``strtotime()``, like ``"5 minutes"``. + +If no value is provided, the cache adapter will fallback to the default value on +the actual cache storage. + +.. _reference-cache-pools-name: + +name +"""" + +**type**: ``prototype`` + +Name of the pool you want to create. + +.. note:: -In addition, you can also set the trusted hosts in the front controller -using the ``Request::setTrustedHosts()`` method:: + Your pool name must differ from ``cache.app`` or ``cache.system``. - // public/index.php - Request::setTrustedHosts(['^(.+\.)?example\.com$', '^(.+\.)?example\.org$']); +provider +"""""""" -The default value for this option is an empty array, meaning that the application -can respond to any given host. +**type**: ``string`` -.. seealso:: +Overwrite the default service name or DSN respectively, if you do not want to +use what is configured as ``default_X_provider`` under ``cache``. See the +description of the default provider setting above for information on how to +specify your specific provider. - Read more about this in the `Security Advisory Blog post`_. +public +"""""" -.. _reference-framework-form: +**type**: ``boolean`` **default**: ``false`` -form -~~~~ +Whether your service should be public or not. -.. _reference-form-enabled: +tags +"""" -enabled -....... +**type**: ``boolean`` | ``string`` **default**: ``null`` -**type**: ``boolean`` **default**: ``true`` or ``false`` depending on your installation +Whether your service should be able to handle tags or not. +Can also be the service id of another cache pool where tags will be stored. -Whether to enable the form services or not in the service container. If -you don't use forms, setting this to ``false`` may increase your application's -performance because less services will be loaded into the container. +.. _reference-cache-prefix-seed: -This option will automatically be set to ``true`` when one of the child -settings is configured. +prefix_seed +........... -.. note:: +**type**: ``string`` **default**: ``_%kernel.project_dir%.%kernel.container_class%`` - This will automatically enable the `validation`_. +This value is used as part of the "namespace" generated for the +cache item keys. A common practice is to use the unique name of the application +(e.g. ``symfony.com``) because that prevents naming collisions when deploying +multiple applications into the same path (on different servers) that share the +same cache backend. -.. seealso:: +It's also useful when using `blue/green deployment`_ strategies and more +generally, when you need to abstract out the actual deployment directory (for +example, when warming caches offline). - For more details, see :doc:`/forms`. +.. note:: -.. _reference-form-field-name: + The ``prefix_seed`` option is used at compile time. This means + that any change made to this value after container's compilation + will have no effect. -field_name -.......... +.. _reference-cache-system: -**type**: ``string`` **default**: ``_token`` +system +...... -This is the field name that you should give to the CSRF token field of your forms. +**type**: ``string`` **default**: ``cache.adapter.system`` + +The cache adapter used by the ``cache.system`` service. It supports the same +adapters available for the ``cache.app`` service. .. _reference-framework-csrf-protection: @@ -621,48 +854,47 @@ If you're using forms, but want to avoid starting your session (e.g. using forms in an API-only website), ``csrf_protection`` will need to be set to ``false``. -.. _config-framework-error_controller: - -error_controller -~~~~~~~~~~~~~~~~ +.. _config-framework-default_locale: -**type**: ``string`` **default**: ``error_controller`` +default_locale +~~~~~~~~~~~~~~ -This is the controller that is called when an exception is thrown anywhere in -your application. The default controller -(:class:`Symfony\\Component\\HttpKernel\\Controller\\ErrorController`) -renders specific templates under different error conditions (see -:doc:`/controller/error_pages`). +**type**: ``string`` **default**: ``en`` -esi -~~~ +The default locale is used if no ``_locale`` routing parameter has been +set. It is available with the +:method:`Request::getDefaultLocale ` +method. .. seealso:: - You can read more about Edge Side Includes (ESI) in :ref:`edge-side-includes`. - -.. _reference-esi-enabled: + You can read more information about the default locale in + :ref:`translation-default-locale`. -enabled -....... +.. _reference-translator-enabled-locales: +.. _reference-enabled-locales: -**type**: ``boolean`` **default**: ``false`` +enabled_locales +............... -Whether to enable the edge side includes support in the framework. +**type**: ``array`` **default**: ``[]`` (empty array = enable all locales) -You can also set ``esi`` to ``true`` to enable it: +Symfony applications generate by default the translation files for validation +and security messages in all locales. If your application only uses some +locales, use this option to restrict the files generated by Symfony and improve +performance a bit: .. configuration-block:: .. code-block:: yaml - # config/packages/framework.yaml + # config/packages/translation.yaml framework: - esi: true + enabled_locales: ['en', 'es'] .. code-block:: xml - + - + en + es .. code-block:: php - // config/packages/framework.php + // config/packages/translation.php use Symfony\Config\FrameworkConfig; return static function (FrameworkConfig $framework): void { - $framework->esi()->enabled(true); + $framework->enabledLocales(['en', 'es']); }; -fragments -~~~~~~~~~ +An added bonus of defining the enabled locales is that they are automatically +added as a requirement of the :ref:`special _locale parameter `. +For example, if you define this value as ``['ar', 'he', 'ja', 'zh']``, the +``_locale`` routing parameter will have an ``ar|he|ja|zh`` requirement. If some +user makes requests with a locale not included in this option, they'll see a 404 error. -.. seealso:: +set_content_language_from_locale +................................ - Learn more about fragments in the - :ref:`HTTP Cache article `. +**type**: ``boolean`` **default**: ``false`` -.. _reference-fragments-enabled: +If this option is set to ``true``, the response will have a ``Content-Language`` +HTTP header set with the ``Request`` locale. -enabled -....... +set_locale_from_accept_language +............................... **type**: ``boolean`` **default**: ``false`` -Whether to enable the fragment listener or not. The fragment listener is -used to render ESI fragments independently of the rest of the page. +If this option is set to ``true``, the ``Request`` locale will automatically be +set to the value of the ``Accept-Language`` HTTP header. -This setting is automatically set to ``true`` when one of the child settings -is configured. +When the ``_locale`` request attribute is passed, the ``Accept-Language`` header +is ignored. -hinclude_default_template -......................... +disallow_search_engine_index +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -**type**: ``string`` **default**: ``null`` +**type**: ``boolean`` **default**: ``true`` when the debug mode is enabled, ``false`` otherwise. -Sets the content shown during the loading of the fragment or when JavaScript -is disabled. This can be either a template name or the content itself. +If ``true``, Symfony adds a ``X-Robots-Tag: noindex`` HTTP tag to all responses +(unless your own app adds that header, in which case it's not modified). This +`X-Robots-Tag HTTP header`_ tells search engines to not index your web site. +This option is a protection measure in case you accidentally publish your site +in debug mode. -.. seealso:: +.. _config-framework-error_controller: - See :ref:`templates-hinclude` for more information about hinclude. +error_controller +~~~~~~~~~~~~~~~~ -.. _reference-fragments-path: +**type**: ``string`` **default**: ``error_controller`` -path -.... +This is the controller that is called when an exception is thrown anywhere in +your application. The default controller +(:class:`Symfony\\Component\\HttpKernel\\Controller\\ErrorController`) +renders specific templates under different error conditions (see +:doc:`/controller/error_pages`). -**type**: ``string`` **default**: ``/_fragment`` +esi +~~~ -The path prefix for fragments. The fragment listener will only be executed -when the request starts with this path. +.. seealso:: -.. _reference-http-client: + You can read more about Edge Side Includes (ESI) in :ref:`edge-side-includes`. -http_client -~~~~~~~~~~~ +.. _reference-esi-enabled: -When the HttpClient component is installed, an HTTP client is available -as a service named ``http_client`` or using the autowiring alias -:class:`Symfony\\Contracts\\HttpClient\\HttpClientInterface`. +enabled +....... -.. _reference-http-client-default-options: +**type**: ``boolean`` **default**: ``false`` -This service can be configured using ``framework.http_client.default_options``: +Whether to enable the edge side includes support in the framework. + +You can also set ``esi`` to ``true`` to enable it: .. configuration-block:: @@ -747,12 +991,7 @@ This service can be configured using ``framework.http_client.default_options``: # config/packages/framework.yaml framework: - # ... - http_client: - max_host_connections: 10 - default_options: - headers: { 'X-Powered-By': 'ACME App' } - max_redirects: 7 + esi: true .. code-block:: xml @@ -766,61 +1005,43 @@ This service can be configured using ``framework.http_client.default_options``: http://symfony.com/schema/dic/symfony https://symfony.com/schema/dic/symfony/symfony-1.0.xsd"> - - - ACME App - - + .. code-block:: php // config/packages/framework.php - $container->loadFromExtension('framework', [ - 'http_client' => [ - 'max_host_connections' => 10, - 'default_options' => [ - 'headers' => [ - 'X-Powered-By' => 'ACME App', - ], - 'max_redirects' => 7, - ], - ], - ]); + use Symfony\Config\FrameworkConfig; - .. code-block:: php-standalone + return static function (FrameworkConfig $framework): void { + $framework->esi()->enabled(true); + }; - $client = HttpClient::create([ - 'headers' => [ - 'X-Powered-By' => 'ACME App', - ], - 'max_redirects' => 7, - ], 10); +.. _framework_exceptions: -.. _reference-http-client-scoped-clients: +exceptions +~~~~~~~~~~ -Multiple pre-configured HTTP client services can be defined, each with its -service name defined as a key under ``scoped_clients``. Scoped clients inherit -the default options defined for the ``http_client`` service. You can override -these options and can define a few others: +**type**: ``array`` + +Defines the :ref:`log level ` and HTTP status code applied to the +exceptions that match the given exception class: .. configuration-block:: .. code-block:: yaml - # config/packages/framework.yaml - framework: - # ... - http_client: - scoped_clients: - my_api.client: - auth_bearer: secret_bearer_token - # ... + # config/packages/exceptions.yaml + framework: + exceptions: + Symfony\Component\HttpKernel\Exception\BadRequestHttpException: + log_level: 'debug' + status_code: 422 .. code-block:: xml - + - - - + + .. code-block:: php - // config/packages/framework.php - $container->loadFromExtension('framework', [ - 'http_client' => [ - 'scoped_clients' => [ - 'my_api.client' => [ - 'auth_bearer' => 'secret_bearer_token', - // ... - ], - ], - ], - ]); + // config/packages/exceptions.php + use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; + use Symfony\Config\FrameworkConfig; - .. code-block:: php-standalone + return static function (FrameworkConfig $framework): void { + $framework->exception(BadRequestHttpException::class) + ->logLevel('debug') + ->statusCode(422) + ; + }; - $client = HttpClient::createForBaseUri('https://...', [ - 'auth_bearer' => 'secret_bearer_token', - // ... - ]); +The order in which you configure exceptions is important because Symfony will +use the configuration of the first exception that matches ``instanceof``: -Options defined for scoped clients apply only to URLs that match either their -`base_uri`_ or the `scope`_ option when it is defined. Non-matching URLs always -use default options. +.. code-block:: yaml -Each scoped client also defines a corresponding named autowiring alias. -If you use for example -``Symfony\Contracts\HttpClient\HttpClientInterface $myApiClient`` -as the type and name of an argument, autowiring will inject the ``my_api.client`` -service into your autowired classes. + # config/packages/exceptions.yaml + framework: + exceptions: + Exception: + log_level: 'debug' + status_code: 404 + # The following configuration will never be used because \RuntimeException extends \Exception + RuntimeException: + log_level: 'debug' + status_code: 422 -auth_basic -.......... +You can map a status code and a set of headers to an exception thanks +to the ``#[WithHttpStatus]`` attribute on the exception class:: -**type**: ``string`` + namespace App\Exception; -The username and password used to create the ``Authorization`` HTTP header -used in HTTP Basic authentication. The value of this option must follow the -format ``username:password``. + use Symfony\Component\HttpKernel\Attribute\WithHttpStatus; -auth_bearer -........... + #[WithHttpStatus(422, [ + 'Retry-After' => 10, + 'X-Custom-Header' => 'header-value', + ])] + class CustomException extends \Exception + { + } -**type**: ``string`` +It is also possible to map a log level on a custom exception class using +the ``#[WithLogLevel]`` attribute:: -The token used to create the ``Authorization`` HTTP header used in HTTP Bearer -authentication (also called token authentication). + namespace App\Exception; -auth_ntlm -......... + use Psr\Log\LogLevel; + use Symfony\Component\HttpKernel\Attribute\WithLogLevel; -**type**: ``string`` + #[WithLogLevel(LogLevel::WARNING)] + class CustomException extends \Exception + { + } -The username and password used to create the ``Authorization`` HTTP header used -in the `Microsoft NTLM authentication protocol`_. The value of this option must -follow the format ``username:password``. This authentication mechanism requires -using the cURL-based transport. +The attributes can also be added to interfaces directly:: -.. _reference-http-client-base-uri: + namespace App\Exception; -base_uri -........ + use Symfony\Component\HttpKernel\Attribute\WithHttpStatus; -**type**: ``string`` + #[WithHttpStatus(422)] + interface CustomExceptionInterface + { + } -URI that is merged into relative URIs, following the rules explained in the -`RFC 3986`_ standard. This is useful when all the requests you make share a -common prefix (e.g. ``https://api.github.com/``) so you can avoid adding it to -every request. + class CustomException extends \Exception implements CustomExceptionInterface + { + } -Here are some common examples of how ``base_uri`` merging works in practice: +.. versionadded:: 7.1 -========================== ================== ============================= -``base_uri`` Relative URI Actual Requested URI -========================== ================== ============================= -http://example.org /bar http://example.org/bar -http://example.org/foo /bar http://example.org/bar -http://example.org/foo bar http://example.org/bar -http://example.org/foo/ /bar http://example.org/bar -http://example.org/foo/ bar http://example.org/foo/bar -http://example.org http://symfony.com http://symfony.com -http://example.org/?bar bar http://example.org/bar -http://example.org/api/v4 /bar http://example.org/bar -http://example.org/api/v4/ /bar http://example.org/bar -http://example.org/api/v4 bar http://example.org/api/bar -http://example.org/api/v4/ bar http://example.org/api/v4/bar -========================== ================== ============================= + Support to use ``#[WithHttpStatus]`` and ``#[WithLogLevel]`` attributes + on interfaces was introduced in Symfony 7.1. -bindto -...... +.. _reference-framework-form: -**type**: ``string`` +form +~~~~ -A network interface name, IP address, a host name or a UNIX socket to use as the -outgoing network interface. +.. _reference-form-enabled: -buffer -...... +enabled +....... -**type**: ``boolean`` | ``Closure`` +**type**: ``boolean`` **default**: ``true`` or ``false`` depending on your installation -Buffering the response means that you can access its content multiple times -without performing the request again. Buffering is enabled by default when the -content type of the response is ``text/*``, ``application/json`` or ``application/xml``. +Whether to enable the form services or not in the service container. If +you don't use forms, setting this to ``false`` may increase your application's +performance because less services will be loaded into the container. -If this option is a boolean value, the response is buffered when the value is -``true``. If this option is a closure, the response is buffered when the -returned value is ``true`` (the closure receives as argument an array with the -response headers). +This option will automatically be set to ``true`` when one of the child +settings is configured. -cafile -...... +.. note:: -**type**: ``string`` + This will automatically enable the `validation`_. -The path of the certificate authority file that contains one or more -certificates used to verify the other servers' certificates. +.. seealso:: -capath -...... + For more details, see :doc:`/forms`. -**type**: ``string`` +.. _reference-form-field-name: -The path to a directory that contains one or more certificate authority files. +field_name +.......... -ciphers +**type**: ``string`` **default**: ``_token`` + +This is the field name that you should give to the CSRF token field of your forms. + +fragments +~~~~~~~~~ + +.. seealso:: + + Learn more about fragments in the + :ref:`HTTP Cache article `. + +.. _reference-fragments-enabled: + +enabled ....... -**type**: ``string`` +**type**: ``boolean`` **default**: ``false`` -A list of the names of the ciphers allowed for the TLS connections. They -can be separated by colons, commas or spaces (e.g. ``'RC4-SHA:TLS13-AES-128-GCM-SHA256'``). +Whether to enable the fragment listener or not. The fragment listener is +used to render ESI fragments independently of the rest of the page. -crypto_method -............. +This setting is automatically set to ``true`` when one of the child settings +is configured. -**type**: ``integer`` +hinclude_default_template +......................... -The minimum version of TLS to accept. The value must be one of the -``STREAM_CRYPTO_METHOD_TLSv*_CLIENT`` constants defined by PHP. +**type**: ``string`` **default**: ``null`` -.. _reference-http-client-retry-delay: +Sets the content shown during the loading of the fragment or when JavaScript +is disabled. This can be either a template name or the content itself. -delay -..... +.. seealso:: -**type**: ``integer`` **default**: ``1000`` + See :ref:`templates-hinclude` for more information about hinclude. -The initial delay in milliseconds used to compute the waiting time between retries. +.. _reference-fragments-path: + +path +.... + +**type**: ``string`` **default**: ``/_fragment`` + +The path prefix for fragments. The fragment listener will only be executed +when the request starts with this path. + +handle_all_throwables +~~~~~~~~~~~~~~~~~~~~~ + +**type**: ``boolean`` **default**: ``true`` + +When set to ``true``, the Symfony kernel will catch all ``\Throwable`` exceptions +thrown by the application and will turn them into HTTP responses. + +html_sanitizer +~~~~~~~~~~~~~~ + +The ``html_sanitizer`` option (and its children) are used to configure +custom HTML sanitizers. Read more about the options in the +:ref:`HTML sanitizer documentation `. + +.. _configuration-framework-http_cache: + +http_cache +~~~~~~~~~~ + +allow_reload +............ + +**type**: ``string`` -.. _reference-http-client-retry-enabled: +Specifies whether the client can force a cache reload by including a +Cache-Control "no-cache" directive in the request. Set it to ``true`` +for compliance with RFC 2616. (default: false) -enabled -....... +allow_revalidate +................ -**type**: ``boolean`` **default**: ``false`` +**type**: ``string`` -Whether to enable the support for retry failed HTTP request or not. -This setting is automatically set to true when one of the child settings is configured. +Specifies whether the client can force a cache revalidate by including a +Cache-Control "max-age=0" directive in the request. Set it to ``true`` +for compliance with RFC 2616. (default: false) -extra +debug ..... -**type**: ``array`` - -Arbitrary additional data to pass to the HTTP client for further use. -This can be particularly useful when :ref:`decorating an existing client `. +**type**: ``boolean`` **default**: ``%kernel.debug%`` -.. _http-headers: +If true, exceptions are thrown when things go wrong. Otherwise, the cache will +try to carry on and deliver a meaningful response. -headers -....... +default_ttl +........... -**type**: ``array`` +**type**: ``integer`` -An associative array of the HTTP headers added before making the request. This -value must use the format ``['header-name' => 'value0, value1, ...']``. +The number of seconds that a cache entry should be considered fresh when no +explicit freshness information is provided in a response. Explicit +Cache-Control or Expires headers override this value. (default: 0) -.. _reference-http-client-retry-http-codes: +enabled +....... -http_codes -.......... +**type**: ``boolean`` **default**: ``false`` -**type**: ``array`` **default**: :method:`Symfony\\Component\\HttpClient\\Retry\\GenericRetryStrategy::DEFAULT_RETRY_STATUS_CODES` +private_headers +............... -The list of HTTP status codes that triggers a retry of the request. +**type**: ``array`` -http_version -............ +Set of request headers that trigger "private" cache-control behavior on responses +that don't explicitly state whether the response is public or private via a +Cache-Control directive. (default: Authorization and Cookie) -**type**: ``string`` | ``null`` **default**: ``null`` +skip_response_headers +..................... -The HTTP version to use, typically ``'1.1'`` or ``'2.0'``. Leave it to ``null`` -to let Symfony select the best version automatically. +**type**: ``array`` **default**: ``Set-Cookie`` -.. _reference-http-client-retry-jitter: +Set of response headers that will never be cached even when the response is cacheable +and public. -jitter -...... +stale_if_error +.............. -**type**: ``float`` **default**: ``0.1`` (must be between 0.0 and 1.0) +**type**: ``integer`` -This option adds some randomness to the delay. It's useful to avoid sending -multiple requests to the server at the exact same time. The randomness is -calculated as ``delay * jitter``. For example: if delay is ``1000ms`` and jitter -is ``0.2``, the actual delay will be a number between ``800`` and ``1200`` (1000 +/- 20%). +Specifies the default number of seconds (the granularity is the second) during +which the cache can serve a stale response when an error is encountered +(default: 60). This setting is overridden by the stale-if-error HTTP +Cache-Control extension (see RFC 5861). -local_cert -.......... +stale_while_revalidate +...................... -**type**: ``string`` +**type**: ``integer`` -The path to a file that contains the `PEM formatted`_ certificate used by the -HTTP client. This is often combined with the ``local_pk`` and ``passphrase`` -options. +Specifies the default number of seconds (the granularity is the second as the +Response TTL precision is a second) during which the cache can immediately return +a stale response while it revalidates it in the background (default: 2). +This setting is overridden by the stale-while-revalidate HTTP Cache-Control +extension (see RFC 5861). -local_pk -........ +trace_header +............ **type**: ``string`` -The path of a file that contains the `PEM formatted`_ private key of the -certificate defined in the ``local_cert`` option. +Header name to use for traces. (default: X-Symfony-Cache) -.. _reference-http-client-retry-max-delay: +trace_level +........... -max_delay -......... +**type**: ``string`` **possible values**: ``'none'``, ``'short'`` or ``'full'`` -**type**: ``integer`` **default**: ``0`` +For 'short', a concise trace of the main request will be added as an HTTP header. +'full' will add traces for all requests (including ESI subrequests). +(default: 'full' if in debug; 'none' otherwise) -The maximum amount of milliseconds initial to wait between retries. -Use ``0`` to not limit the duration. +.. _reference-http-client: -max_duration -............ +http_client +~~~~~~~~~~~ -**type**: ``float`` **default**: ``0`` +When the HttpClient component is installed, an HTTP client is available +as a service named ``http_client`` or using the autowiring alias +:class:`Symfony\\Contracts\\HttpClient\\HttpClientInterface`. -The maximum execution time, in seconds, that the request and the response are -allowed to take. A value lower than or equal to 0 means it is unlimited. +.. _reference-http-client-default-options: -max_host_connections -.................... +This service can be configured using ``framework.http_client.default_options``: -**type**: ``integer`` **default**: ``6`` +.. configuration-block:: -Defines the maximum amount of simultaneously open connections to a single host -(considering a "host" the same as a "host name + port number" pair). This limit -also applies for proxy connections, where the proxy is considered to be the host -for which this limit is applied. + .. code-block:: yaml -max_redirects -............. + # config/packages/framework.yaml + framework: + # ... + http_client: + max_host_connections: 10 + default_options: + headers: { 'X-Powered-By': 'ACME App' } + max_redirects: 7 -**type**: ``integer`` **default**: ``20`` + .. code-block:: xml -The maximum number of redirects to follow. Use ``0`` to not follow any -redirection. + + + -.. _reference-http-client-retry-max-retries: + + + + ACME App + + + + -max_retries -........... + .. code-block:: php -**type**: ``integer`` **default**: ``3`` + // config/packages/framework.php + $container->loadFromExtension('framework', [ + 'http_client' => [ + 'max_host_connections' => 10, + 'default_options' => [ + 'headers' => [ + 'X-Powered-By' => 'ACME App', + ], + 'max_redirects' => 7, + ], + ], + ]); -The maximum number of retries for failing requests. When the maximum is reached, -the client returns the last received response. + .. code-block:: php-standalone -.. _reference-http-client-retry-multiplier: + $client = HttpClient::create([ + 'headers' => [ + 'X-Powered-By' => 'ACME App', + ], + 'max_redirects' => 7, + ], 10); -multiplier -.......... +.. _reference-http-client-scoped-clients: -**type**: ``float`` **default**: ``2`` +Multiple pre-configured HTTP client services can be defined, each with its +service name defined as a key under ``scoped_clients``. Scoped clients inherit +the default options defined for the ``http_client`` service. You can override +these options and can define a few others: -This value is multiplied to the delay each time a retry occurs, to distribute -retries in time instead of making all of them sequentially. +.. configuration-block:: -no_proxy -........ + .. code-block:: yaml -**type**: ``string`` | ``null`` **default**: ``null`` + # config/packages/framework.yaml + framework: + # ... + http_client: + scoped_clients: + my_api.client: + auth_bearer: secret_bearer_token + # ... -A comma separated list of hosts that do not require a proxy to be reached, even -if one is configured. Use the ``'*'`` wildcard to match all hosts and an empty -string to match none (disables the proxy). + .. code-block:: xml -passphrase -.......... + + + -**type**: ``string`` + + + + + + -The passphrase used to encrypt the certificate stored in the file defined in the -``local_cert`` option. + .. code-block:: php -peer_fingerprint -................ + // config/packages/framework.php + $container->loadFromExtension('framework', [ + 'http_client' => [ + 'scoped_clients' => [ + 'my_api.client' => [ + 'auth_bearer' => 'secret_bearer_token', + // ... + ], + ], + ], + ]); -**type**: ``array`` + .. code-block:: php-standalone -When negotiating a TLS connection, the server sends a certificate -indicating its identity. A public key is extracted from this certificate and if -it does not exactly match any of the public keys provided in this option, the -connection is aborted before sending or receiving any data. + $client = HttpClient::createForBaseUri('https://...', [ + 'auth_bearer' => 'secret_bearer_token', + // ... + ]); -The value of this option is an associative array of ``algorithm => hash`` -(e.g ``['pin-sha256' => '...']``). +Options defined for scoped clients apply only to URLs that match either their +`base_uri`_ or the `scope`_ option when it is defined. Non-matching URLs always +use default options. -proxy -..... +Each scoped client also defines a corresponding named autowiring alias. +If you use for example +``Symfony\Contracts\HttpClient\HttpClientInterface $myApiClient`` +as the type and name of an argument, autowiring will inject the ``my_api.client`` +service into your autowired classes. -**type**: ``string`` | ``null`` +auth_basic +.......... -The HTTP proxy to use to make the requests. Leave it to ``null`` to detect the -proxy automatically based on your system configuration. +**type**: ``string`` -query -..... +The username and password used to create the ``Authorization`` HTTP header +used in HTTP Basic authentication. The value of this option must follow the +format ``username:password``. -**type**: ``array`` +auth_bearer +........... -An associative array of the query string values added to the URL before making -the request. This value must use the format ``['parameter-name' => parameter-value, ...]``. +**type**: ``string`` -rate_limiter -............ +The token used to create the ``Authorization`` HTTP header used in HTTP Bearer +authentication (also called token authentication). -**type**: ``string`` +auth_ntlm +......... -The service ID of the rate limiter used to limit the number of HTTP requests -within a certain period. The service must implement the -:class:`Symfony\\Component\\RateLimiter\\LimiterInterface`. +**type**: ``string`` -.. versionadded:: 7.1 +The username and password used to create the ``Authorization`` HTTP header used +in the `Microsoft NTLM authentication protocol`_. The value of this option must +follow the format ``username:password``. This authentication mechanism requires +using the cURL-based transport. - The ``rate_limiter`` option was introduced in Symfony 7.1. +.. _reference-http-client-base-uri: -resolve -....... +base_uri +........ -**type**: ``array`` +**type**: ``string`` -A list of hostnames and their IP addresses to pre-populate the DNS cache used by -the HTTP client in order to avoid a DNS lookup for those hosts. This option is -useful to improve security when IPs are checked before the URL is passed to the -client and to make your tests easier. +URI that is merged into relative URIs, following the rules explained in the +`RFC 3986`_ standard. This is useful when all the requests you make share a +common prefix (e.g. ``https://api.github.com/``) so you can avoid adding it to +every request. -The value of this option is an associative array of ``domain => IP address`` -(e.g ``['symfony.com' => '46.137.106.254', ...]``). +Here are some common examples of how ``base_uri`` merging works in practice: -.. _reference-http-client-retry-failed: +========================== ================== ============================= +``base_uri`` Relative URI Actual Requested URI +========================== ================== ============================= +http://example.org /bar http://example.org/bar +http://example.org/foo /bar http://example.org/bar +http://example.org/foo bar http://example.org/bar +http://example.org/foo/ /bar http://example.org/bar +http://example.org/foo/ bar http://example.org/foo/bar +http://example.org http://symfony.com http://symfony.com +http://example.org/?bar bar http://example.org/bar +http://example.org/api/v4 /bar http://example.org/bar +http://example.org/api/v4/ /bar http://example.org/bar +http://example.org/api/v4 bar http://example.org/api/bar +http://example.org/api/v4/ bar http://example.org/api/v4/bar +========================== ================== ============================= -retry_failed -............ +bindto +...... -**type**: ``array`` +**type**: ``string`` -This option configures the behavior of the HTTP client when some request fails, -including which types of requests to retry and how many times. The behavior is -defined with the following options: +A network interface name, IP address, a host name or a UNIX socket to use as the +outgoing network interface. -* :ref:`delay ` -* :ref:`http_codes ` -* :ref:`jitter ` -* :ref:`max_delay ` -* :ref:`max_retries ` -* :ref:`multiplier ` +buffer +...... -.. code-block:: yaml +**type**: ``boolean`` | ``Closure`` - # config/packages/framework.yaml - framework: - # ... - http_client: - # ... - default_options: - retry_failed: - # retry_strategy: app.custom_strategy - http_codes: - 0: ['GET', 'HEAD'] # retry network errors if request method is GET or HEAD - 429: true # retry all responses with 429 status code - 500: ['GET', 'HEAD'] - max_retries: 2 - delay: 1000 - multiplier: 3 - max_delay: 5000 - jitter: 0.3 +Buffering the response means that you can access its content multiple times +without performing the request again. Buffering is enabled by default when the +content type of the response is ``text/*``, ``application/json`` or ``application/xml``. - scoped_clients: - my_api.client: - # ... - retry_failed: - max_retries: 4 +If this option is a boolean value, the response is buffered when the value is +``true``. If this option is a closure, the response is buffered when the +returned value is ``true`` (the closure receives as argument an array with the +response headers). -retry_strategy -.............. +cafile +...... **type**: ``string`` -The service is used to decide if a request should be retried and to compute the -time to wait between retries. By default, it uses an instance of -:class:`Symfony\\Component\\HttpClient\\Retry\\GenericRetryStrategy` configured -with ``http_codes``, ``delay``, ``max_delay``, ``multiplier`` and ``jitter`` -options. This class has to implement -:class:`Symfony\\Component\\HttpClient\\Retry\\RetryStrategyInterface`. +The path of the certificate authority file that contains one or more +certificates used to verify the other servers' certificates. -scope -..... +capath +...... **type**: ``string`` -For scoped clients only: the regular expression that the URL must match before -applying all other non-default options. By default, the scope is derived from -`base_uri`_. +The path to a directory that contains one or more certificate authority files. -timeout +ciphers ....... -**type**: ``float`` **default**: depends on your PHP config - -Time, in seconds, to wait for network activity. If the connection is idle for longer, a -:class:`Symfony\\Component\\HttpClient\\Exception\\TransportException` is thrown. -Its default value is the same as the value of PHP's `default_socket_timeout`_ -config option. - -verify_host -........... +**type**: ``string`` -**type**: ``boolean`` **default**: ``true`` +A list of the names of the ciphers allowed for the TLS connections. They +can be separated by colons, commas or spaces (e.g. ``'RC4-SHA:TLS13-AES-128-GCM-SHA256'``). -If ``true``, the certificate sent by other servers is verified to ensure that -their common name matches the host included in the URL. This is usually -combined with ``verify_peer`` to also verify the certificate authenticity. +crypto_method +............. -verify_peer -........... +**type**: ``integer`` -**type**: ``boolean`` **default**: ``true`` +The minimum version of TLS to accept. The value must be one of the +``STREAM_CRYPTO_METHOD_TLSv*_CLIENT`` constants defined by PHP. -If ``true``, the certificate sent by other servers when negotiating a TLS -connection is verified for authenticity. Authenticating the certificate is not -enough to be sure about the server, so you should combine this with the -``verify_host`` option. +.. _reference-http-client-retry-delay: -html_sanitizer -~~~~~~~~~~~~~~ +delay +..... -The ``html_sanitizer`` option (and its children) are used to configure -custom HTML sanitizers. Read more about the options in the -:ref:`HTML sanitizer documentation `. +**type**: ``integer`` **default**: ``1000`` -profiler -~~~~~~~~ +The initial delay in milliseconds used to compute the waiting time between retries. -.. _reference-profiler-enabled: +.. _reference-http-client-retry-enabled: enabled ....... **type**: ``boolean`` **default**: ``false`` -The profiler can be enabled by setting this option to ``true``. When you -install it using Symfony Flex, the profiler is enabled in the ``dev`` -and ``test`` environments. +Whether to enable the support for retry failed HTTP request or not. +This setting is automatically set to true when one of the child settings is configured. -.. note:: +extra +..... - The profiler works independently from the Web Developer Toolbar, see - the :doc:`WebProfilerBundle configuration ` - on how to disable/enable the toolbar. +**type**: ``array`` -collect -....... +Arbitrary additional data to pass to the HTTP client for further use. +This can be particularly useful when :ref:`decorating an existing client `. -**type**: ``boolean`` **default**: ``true`` +.. _http-headers: -This option configures the way the profiler behaves when it is enabled. If set -to ``true``, the profiler collects data for all requests. If you want to only -collect information on-demand, you can set the ``collect`` flag to ``false`` and -activate the data collectors manually:: +headers +....... - $profiler->enable(); +**type**: ``array`` -collect_parameter -................. +An associative array of the HTTP headers added before making the request. This +value must use the format ``['header-name' => 'value0, value1, ...']``. -**type**: ``string`` **default**: ``null`` +.. _reference-http-client-retry-http-codes: -This specifies name of a query parameter, a body parameter or a request attribute -used to enable or disable collection of data by the profiler for each request. -Combine it with the ``collect`` option to enable/disable the profiler on demand: +http_codes +.......... -* If the ``collect`` option is set to ``true`` but this parameter exists in a - request and has any value other than ``true``, ``yes``, ``on`` or ``1``, the - request data will not be collected; -* If the ``collect`` option is set to ``false``, but this parameter exists in a - request and has value of ``true``, ``yes``, ``on`` or ``1``, the request data - will be collected. +**type**: ``array`` **default**: :method:`Symfony\\Component\\HttpClient\\Retry\\GenericRetryStrategy::DEFAULT_RETRY_STATUS_CODES` -only_exceptions -............... +The list of HTTP status codes that triggers a retry of the request. -**type**: ``boolean`` **default**: ``false`` +http_version +............ -When this is set to ``true``, the profiler will only be enabled when an -exception is thrown during the handling of the request. +**type**: ``string`` | ``null`` **default**: ``null`` -.. _only_master_requests: +The HTTP version to use, typically ``'1.1'`` or ``'2.0'``. Leave it to ``null`` +to let Symfony select the best version automatically. -only_main_requests -.................. +.. _reference-http-client-retry-jitter: + +jitter +...... -**type**: ``boolean`` **default**: ``false`` +**type**: ``float`` **default**: ``0.1`` (must be between 0.0 and 1.0) -When this is set to ``true``, the profiler will only be enabled on the main -requests (and not on the subrequests). +This option adds some randomness to the delay. It's useful to avoid sending +multiple requests to the server at the exact same time. The randomness is +calculated as ``delay * jitter``. For example: if delay is ``1000ms`` and jitter +is ``0.2``, the actual delay will be a number between ``800`` and ``1200`` (1000 +/- 20%). -.. _profiler-dsn: +local_cert +.......... -dsn -... +**type**: ``string`` -**type**: ``string`` **default**: ``file:%kernel.cache_dir%/profiler`` +The path to a file that contains the `PEM formatted`_ certificate used by the +HTTP client. This is often combined with the ``local_pk`` and ``passphrase`` +options. -The DSN where to store the profiling information. +local_pk +........ -.. _collect_serializer_data: +**type**: ``string`` -collect_serializer_data -....................... +The path of a file that contains the `PEM formatted`_ private key of the +certificate defined in the ``local_cert`` option. -**type**: ``boolean`` **default**: ``false`` +.. _reference-http-client-retry-max-delay: -Set this option to ``true`` to enable the serializer data collector and its -profiler panel. When this option is ``true``, all normalizers and encoders are -decorated by traceable implementations that collect profiling information about them. +max_delay +......... -rate_limiter -~~~~~~~~~~~~ +**type**: ``integer`` **default**: ``0`` -.. _reference-rate-limiter-name: +The maximum amount of milliseconds initial to wait between retries. +Use ``0`` to not limit the duration. -name -.... +max_duration +............ -**type**: ``prototype`` +**type**: ``float`` **default**: ``0`` -Name of the rate limiter you want to create. +The maximum execution time, in seconds, that the request and the response are +allowed to take. A value lower than or equal to 0 means it is unlimited. -lock_factory -"""""""""""" +max_host_connections +.................... -**type**: ``string`` **default:** ``lock.factory`` +**type**: ``integer`` **default**: ``6`` -The service that is used to create a lock. The service has to be an instance of -the :class:`Symfony\\Component\\Lock\\LockFactory` class. +Defines the maximum amount of simultaneously open connections to a single host +(considering a "host" the same as a "host name + port number" pair). This limit +also applies for proxy connections, where the proxy is considered to be the host +for which this limit is applied. -policy -"""""" +max_redirects +............. -**type**: ``string`` **required** +**type**: ``integer`` **default**: ``20`` -The name of the rate limiting algorithm to use. Example names are ``fixed_window``, -``sliding_window`` and ``no_limit``. See :ref:`Rate Limiter Policies `) -for more information. +The maximum number of redirects to follow. Use ``0`` to not follow any +redirection. -request -~~~~~~~ +.. _reference-http-client-retry-max-retries: -formats -....... +max_retries +........... -**type**: ``array`` **default**: ``[]`` +**type**: ``integer`` **default**: ``3`` -This setting is used to associate additional request formats (e.g. ``html``) -to one or more mime types (e.g. ``text/html``), which will allow you to use the -format & mime types to call -:method:`Request::getFormat($mimeType) ` or -:method:`Request::getMimeType($format) `. +The maximum number of retries for failing requests. When the maximum is reached, +the client returns the last received response. -In practice, this is important because Symfony uses it to automatically set the -``Content-Type`` header on the ``Response`` (if you don't explicitly set one). -If you pass an array of mime types, the first will be used for the header. +.. _reference-http-client-retry-multiplier: -To configure a ``jsonp`` format: +multiplier +.......... -.. configuration-block:: +**type**: ``float`` **default**: ``2`` - .. code-block:: yaml +This value is multiplied to the delay each time a retry occurs, to distribute +retries in time instead of making all of them sequentially. - # config/packages/framework.yaml - framework: - request: - formats: - jsonp: 'application/javascript' +no_proxy +........ - .. code-block:: xml +**type**: ``string`` | ``null`` **default**: ``null`` - - +A comma separated list of hosts that do not require a proxy to be reached, even +if one is configured. Use the ``'*'`` wildcard to match all hosts and an empty +string to match none (disables the proxy). - +passphrase +.......... - - - - application/javascript - - - - +**type**: ``string`` - .. code-block:: php +The passphrase used to encrypt the certificate stored in the file defined in the +``local_cert`` option. - // config/packages/framework.php - use Symfony\Config\FrameworkConfig; +peer_fingerprint +................ - return static function (FrameworkConfig $framework): void { - $framework->request() - ->format('jsonp', 'application/javascript'); - }; +**type**: ``array`` -router -~~~~~~ +When negotiating a TLS connection, the server sends a certificate +indicating its identity. A public key is extracted from this certificate and if +it does not exactly match any of the public keys provided in this option, the +connection is aborted before sending or receiving any data. -resource -........ +The value of this option is an associative array of ``algorithm => hash`` +(e.g ``['pin-sha256' => '...']``). -**type**: ``string`` **required** +proxy +..... -The path the main routing resource (e.g. a YAML file) that contains the -routes and imports the router should load. +**type**: ``string`` | ``null`` -.. _reference-router-type: +The HTTP proxy to use to make the requests. Leave it to ``null`` to detect the +proxy automatically based on your system configuration. -type -.... +query +..... -**type**: ``string`` +**type**: ``array`` -The type of the resource to hint the loaders about the format. This isn't -needed when you use the default routers with the expected file extensions -(``.xml``, ``.yaml``, ``.php``). +An associative array of the query string values added to the URL before making +the request. This value must use the format ``['parameter-name' => parameter-value, ...]``. -default_uri -........... +rate_limiter +............ **type**: ``string`` -The default URI used to generate URLs in a non-HTTP context (see -:ref:`Generating URLs in Commands `). +The service ID of the rate limiter used to limit the number of HTTP requests +within a certain period. The service must implement the +:class:`Symfony\\Component\\RateLimiter\\LimiterInterface`. -http_port -......... +.. versionadded:: 7.1 -**type**: ``integer`` **default**: ``80`` + The ``rate_limiter`` option was introduced in Symfony 7.1. -The port for normal http requests (this is used when matching the scheme). +resolve +....... -https_port -.......... +**type**: ``array`` -**type**: ``integer`` **default**: ``443`` +A list of hostnames and their IP addresses to pre-populate the DNS cache used by +the HTTP client in order to avoid a DNS lookup for those hosts. This option is +useful to improve security when IPs are checked before the URL is passed to the +client and to make your tests easier. -The port for https requests (this is used when matching the scheme). +The value of this option is an associative array of ``domain => IP address`` +(e.g ``['symfony.com' => '46.137.106.254', ...]``). -strict_requirements -................... +.. _reference-http-client-retry-failed: -**type**: ``mixed`` **default**: ``true`` +retry_failed +............ -Determines the routing generator behavior. When generating a route that -has specific :ref:`parameter requirements `, the generator -can behave differently in case the used parameters do not meet these requirements. +**type**: ``array`` -The value can be one of: +This option configures the behavior of the HTTP client when some request fails, +including which types of requests to retry and how many times. The behavior is +defined with the following options: -``true`` - Throw an exception when the requirements are not met; -``false`` - Disable exceptions when the requirements are not met and return ``''`` - instead; -``null`` - Disable checking the requirements (thus, match the route even when the - requirements don't match). +* :ref:`delay ` +* :ref:`http_codes ` +* :ref:`jitter ` +* :ref:`max_delay ` +* :ref:`max_retries ` +* :ref:`multiplier ` -``true`` is recommended in the development environment, while ``false`` -or ``null`` might be preferred in production. +.. code-block:: yaml -utf8 -.... + # config/packages/framework.yaml + framework: + # ... + http_client: + # ... + default_options: + retry_failed: + # retry_strategy: app.custom_strategy + http_codes: + 0: ['GET', 'HEAD'] # retry network errors if request method is GET or HEAD + 429: true # retry all responses with 429 status code + 500: ['GET', 'HEAD'] + max_retries: 2 + delay: 1000 + multiplier: 3 + max_delay: 5000 + jitter: 0.3 + + scoped_clients: + my_api.client: + # ... + retry_failed: + max_retries: 4 -**type**: ``boolean`` **default**: ``true`` +retry_strategy +.............. -When this option is set to ``true``, the regular expressions used in the -:ref:`requirements of route parameters ` will be run -using the `utf-8 modifier`_. This will for example match any UTF-8 character -when using ``.``, instead of matching only a single byte. +**type**: ``string`` -If the charset of your application is UTF-8 (as defined in the -:ref:`getCharset() method ` of your kernel) it's -recommended setting it to ``true``. This will make non-UTF8 URLs to generate 404 -errors. +The service is used to decide if a request should be retried and to compute the +time to wait between retries. By default, it uses an instance of +:class:`Symfony\\Component\\HttpClient\\Retry\\GenericRetryStrategy` configured +with ``http_codes``, ``delay``, ``max_delay``, ``multiplier`` and ``jitter`` +options. This class has to implement +:class:`Symfony\\Component\\HttpClient\\Retry\\RetryStrategyInterface`. -cache_dir -......... +scope +..... -**type**: ``string`` **default**: ``%kernel.cache_dir%`` +**type**: ``string`` -The directory where routing information will be cached. Can be set to -``~`` (``null``) to disable route caching. +For scoped clients only: the regular expression that the URL must match before +applying all other non-default options. By default, the scope is derived from +`base_uri`_. -.. deprecated:: 7.1 +timeout +....... - Setting the ``cache_dir`` option is deprecated since Symfony 7.1. The routes - are now always cached in the ``%kernel.build_dir%`` directory. +**type**: ``float`` **default**: depends on your PHP config -secrets -~~~~~~~ +Time, in seconds, to wait for network activity. If the connection is idle for longer, a +:class:`Symfony\\Component\\HttpClient\\Exception\\TransportException` is thrown. +Its default value is the same as the value of PHP's `default_socket_timeout`_ +config option. -enabled -....... +verify_host +........... **type**: ``boolean`` **default**: ``true`` -Whether to enable or not secrets managements. - -decryption_env_var -.................. +If ``true``, the certificate sent by other servers is verified to ensure that +their common name matches the host included in the URL. This is usually +combined with ``verify_peer`` to also verify the certificate authenticity. -**type**: ``string`` **default**: ``base64:default::SYMFONY_DECRYPTION_SECRET`` +verify_peer +........... -The env var name that contains the vault decryption secret. By default, this -value will be decoded from base64. +**type**: ``boolean`` **default**: ``true`` -local_dotenv_file -................. +If ``true``, the certificate sent by other servers when negotiating a TLS +connection is verified for authenticity. Authenticating the certificate is not +enough to be sure about the server, so you should combine this with the +``verify_host`` option. -**type**: ``string`` **default**: ``%kernel.project_dir%/.env.%kernel.environment%.local`` + .. _configuration-framework-http_method_override: -The path to the local ``.env`` file. This file must contain the vault -decryption key, given by the ``decryption_env_var`` option. +http_method_override +~~~~~~~~~~~~~~~~~~~~ -vault_directory -............... +**type**: ``boolean`` **default**: ``false`` -**type**: ``string`` **default**: ``%kernel.project_dir%/config/secrets/%kernel.runtime_environment%`` +This determines whether the ``_method`` request parameter is used as the +intended HTTP method on POST requests. If enabled, the +:method:`Request::enableHttpMethodParameterOverride ` +method gets called automatically. It becomes the service container parameter +named ``kernel.http_method_override``. -The directory to store the secret vault. By default, the path includes the value -of the :ref:`kernel.runtime_environment ` -parameter. +.. seealso:: -.. _config-framework-session: + :ref:`Changing the Action and HTTP Method ` of + Symfony forms. -session -~~~~~~~ +.. warning:: -.. _storage_id: + If you're using the :ref:`HttpCache Reverse Proxy ` + with this option, the kernel will ignore the ``_method`` parameter, + which could lead to errors. -storage_factory_id -.................. + To fix this, invoke the ``enableHttpMethodParameterOverride()`` method + before creating the ``Request`` object:: -**type**: ``string`` **default**: ``session.storage.factory.native`` + // public/index.php -The service ID used for creating the ``SessionStorageInterface`` that stores -the session. This service is available in the Symfony application via the -``session.storage.factory`` service alias. The class has to implement -:class:`Symfony\\Component\\HttpFoundation\\Session\\Storage\\SessionStorageFactoryInterface`. -To see a list of all available storages, run: + // ... + $kernel = new CacheKernel($kernel); -.. code-block:: terminal + Request::enableHttpMethodParameterOverride(); // <-- add this line + $request = Request::createFromGlobals(); + // ... - $ php bin/console debug:container session.storage.factory. +ide +~~~ -.. _config-framework-session-handler-id: +**type**: ``string`` **default**: ``%env(default::SYMFONY_IDE)%`` -handler_id -.......... +Symfony turns file paths seen in variable dumps and exception messages into +links that open those files right inside your browser. If you prefer to open +those files in your favorite IDE or text editor, set this option to any of the +following values: ``phpstorm``, ``sublime``, ``textmate``, ``macvim``, ``emacs``, +``atom`` and ``vscode``. -**type**: ``string`` | ``null`` **default**: ``null`` +.. note:: -If ``framework.session.save_path`` is not set, the default value of this option -is ``null``, which means to use the session handler configured in php.ini. If the -``framework.session.save_path`` option is set, then Symfony stores sessions using -the native file session handler. + The ``phpstorm`` option is supported natively by PhpStorm on macOS and + Windows; Linux requires installing `phpstorm-url-handler`_. -It is possible to :ref:`store sessions in a database `, -and also to configure the session handler with a DSN: +If you use another editor, the expected configuration value is a URL template +that contains an ``%f`` placeholder where the file path is expected and ``%l`` +placeholder for the line number (percentage signs (``%``) must be escaped by +doubling them to prevent Symfony from interpreting them as container parameters). .. configuration-block:: @@ -1639,12 +1947,7 @@ and also to configure the session handler with a DSN: # config/packages/framework.yaml framework: - session: - # a few possible examples - handler_id: 'redis://localhost' - handler_id: '%env(REDIS_URL)%' - handler_id: '%env(DATABASE_URL)%' - handler_id: 'file://%kernel.project_dir%/var/sessions' + ide: 'myide://open?url=file://%%f&line=%%l' .. code-block:: xml @@ -1656,268 +1959,290 @@ and also to configure the session handler with a DSN: xsi:schemaLocation="http://symfony.com/schema/dic/services https://symfony.com/schema/dic/services/services-1.0.xsd http://symfony.com/schema/dic/symfony https://symfony.com/schema/dic/symfony/symfony-1.0.xsd"> - - - - + + .. code-block:: php // config/packages/framework.php - use function Symfony\Component\DependencyInjection\Loader\Configurator\env; use Symfony\Config\FrameworkConfig; return static function (FrameworkConfig $framework): void { - // ... - - $framework->session() - // a few possible examples - ->handlerId('redis://localhost') - ->handlerId(env('REDIS_URL')) - ->handlerId(env('DATABASE_URL')) - ->handlerId('file://%kernel.project_dir%/var/sessions'); + $framework->ide('myide://open?url=file://%%f&line=%%l'); }; +Since every developer uses a different IDE, the recommended way to enable this +feature is to configure it on a system level. First, you can define this option +in the ``SYMFONY_IDE`` environment variable, which Symfony reads automatically +when ``framework.ide`` config is not set. + +Another alternative is to set the ``xdebug.file_link_format`` option in your +``php.ini`` configuration file. The format to use is the same as for the +``framework.ide`` option, but without the need to escape the percent signs +(``%``) by doubling them: + +.. code-block:: ini + + // example for PhpStorm + xdebug.file_link_format="phpstorm://open?file=%f&line=%l" + + // example for PhpStorm with Jetbrains Toolbox + xdebug.file_link_format="jetbrains://phpstorm/navigate/reference?project=example&path=%f:%l" + + // example for Sublime Text + xdebug.file_link_format="subl://open?url=file://%f&line=%l" + .. note:: - Supported DSN protocols are the following: + If both ``framework.ide`` and ``xdebug.file_link_format`` are defined, + Symfony uses the value of the ``xdebug.file_link_format`` option. - * ``file`` - * ``redis`` - * ``rediss`` (Redis over TLS) - * ``memcached`` (requires :doc:`symfony/cache `) - * ``pdo_oci`` (requires :doc:`doctrine/dbal `) - * ``mssql`` - * ``mysql`` - * ``mysql2`` - * ``pgsql`` - * ``postgres`` - * ``postgresql`` - * ``sqlsrv`` - * ``sqlite`` - * ``sqlite3`` +.. tip:: -.. _name: + Setting the ``xdebug.file_link_format`` ini option works even if the Xdebug + extension is not enabled. -name -.... +.. tip:: -**type**: ``string`` + When running your app in a container or in a virtual machine, you can tell + Symfony to map files from the guest to the host by changing their prefix. + This map should be specified at the end of the URL template, using ``&`` and + ``>`` as guest-to-host separators: -This specifies the name of the session cookie. + .. code-block:: text -If not set, ``php.ini``'s `session.name`_ directive will be relied on. + // /path/to/guest/.../file will be opened + // as /path/to/host/.../file on the host + // and /var/www/app/ as /projects/my_project/ also + 'myide://%%f:%%l&/path/to/guest/>/path/to/host/&/var/www/app/>/projects/my_project/&...' -cookie_lifetime -............... + // example for PhpStorm + 'phpstorm://open?file=%%f&line=%%l&/var/www/app/>/projects/my_project/' -**type**: ``integer`` +.. _reference-lock: -This determines the lifetime of the session - in seconds. -Setting this value to ``0`` means the cookie is valid for -the length of the browser session. +lock +~~~~ -If not set, ``php.ini``'s `session.cookie_lifetime`_ directive will be relied on. +**type**: ``string`` | ``array`` -cookie_path -........... +The default lock adapter. If not defined, the value is set to ``semaphore`` when +available, or to ``flock`` otherwise. Store's DSN are also allowed. -**type**: ``string`` +.. _reference-lock-enabled: -This determines the path to set in the session cookie. +enabled +....... -If not set, ``php.ini``'s `session.cookie_path`_ directive will be relied on. +**type**: ``boolean`` **default**: ``true`` -cache_limiter -............. +Whether to enable the support for lock or not. This setting is +automatically set to ``true`` when one of the child settings is configured. -**type**: ``string`` **default**: ``0`` +.. _reference-lock-resources: + +resources +......... -If set to ``0``, Symfony won't set any particular header related to the cache -and it will rely on ``php.ini``'s `session.cache_limiter`_ directive. +**type**: ``array`` -Unlike the other session options, ``cache_limiter`` is set as a regular -:ref:`container parameter `: +A map of lock stores to be created by the framework extension, with +the name as key and DSN as value: .. configuration-block:: .. code-block:: yaml - # config/services.yaml - parameters: - session.storage.options: - cache_limiter: 0 + # config/packages/lock.yaml + framework: + lock: '%env(LOCK_DSN)%' .. code-block:: xml - + + https://symfony.com/schema/dic/services/services-1.0.xsd + http://symfony.com/schema/dic/symfony https://symfony.com/schema/dic/symfony/symfony-1.0.xsd"> - - - 0 - - + + + %env(LOCK_DSN)% + + .. code-block:: php - // config/services.php - $container->setParameter('session.storage.options', [ - 'cache_limiter' => 0, - ]); + // config/packages/lock.php + use Symfony\Config\FrameworkConfig; -Be aware that if you configure it, you'll have to set other session-related options -as parameters as well. + return static function (FrameworkConfig $framework): void { + $framework->lock() + ->resource('default', [env('LOCK_DSN')]); + }; -cookie_domain -............. +.. seealso:: -**type**: ``string`` + For more details, see :doc:`/lock`. -This determines the domain to set in the session cookie. +.. _reference-lock-resources-name: -If not set, ``php.ini``'s `session.cookie_domain`_ directive will be relied on. +name +"""" -cookie_samesite -............... +**type**: ``prototype`` -**type**: ``string`` or ``null`` **default**: ``null`` +Name of the lock you want to create. -It controls the way cookies are sent when the HTTP request did not originate -from the same domain that is associated with the cookies. Setting this option is -recommended to mitigate `CSRF security attacks`_. +mailer +~~~~~~ -By default, browsers send all cookies related to the domain of the HTTP request. -This may be a problem for example when you visit a forum and some malicious -comment includes a link like ``https://some-bank.com/?send_money_to=attacker&amount=1000``. -If you were previously logged into your bank website, the browser will send all -those cookies when making that HTTP request. +.. _mailer-dsn: -The possible values for this option are: +dsn +... -* ``null``, use ``php.ini``'s `session.cookie_samesite`_ directive. -* ``'none'`` (or the ``Symfony\Component\HttpFoundation\Cookie::SAMESITE_NONE`` constant), use it to allow - sending of cookies when the HTTP request originated from a different domain - (previously this was the default behavior of null, but in newer browsers ``'lax'`` - would be applied when the header has not been set) -* ``'strict'`` (or the ``Cookie::SAMESITE_STRICT`` constant), use it to never - send any cookie when the HTTP request did not originate from the same domain. -* ``'lax'`` (or the ``Cookie::SAMESITE_LAX`` constant), use it to allow sending - cookies when the request originated from a different domain, but only when the - user consciously made the request (by clicking a link or submitting a form - with the ``GET`` method). +**type**: ``string`` **default**: ``null`` -cookie_secure -............. +The DSN used by the mailer. When several DSN may be used, use +``transports`` option (see below) instead. -**type**: ``boolean`` or ``'auto'`` +envelope +........ -This determines whether cookies should only be sent over secure connections. In -addition to ``true`` and ``false``, there's a special ``'auto'`` value that -means ``true`` for HTTPS requests and ``false`` for HTTP requests. +recipients +"""""""""" -If not set, ``php.ini``'s `session.cookie_secure`_ directive will be relied on. +**type**: ``array`` -cookie_httponly -............... +The "envelope recipient" which is used as the value of ``RCPT TO`` during the +the `SMTP session`_. This value overrides any other recipient set in the code. -**type**: ``boolean`` **default**: ``true`` +.. configuration-block:: -This determines whether cookies should only be accessible through the HTTP -protocol. This means that the cookie won't be accessible by scripting -languages, such as JavaScript. This setting can effectively help to reduce -identity theft through :ref:`XSS attacks `. + .. code-block:: yaml -gc_divisor -.......... + # config/packages/mailer.yaml + framework: + mailer: + dsn: 'smtp://localhost:25' + envelope: + recipients: ['admin@symfony.com', 'lead@symfony.com'] -**type**: ``integer`` + .. code-block:: xml -See `gc_probability`_. + + + + + + + admin@symfony.com + lead@symfony.com + + + + -If not set, ``php.ini``'s `session.gc_divisor`_ directive will be relied on. + .. code-block:: php -gc_probability -.............. + // config/packages/mailer.php + namespace Symfony\Component\DependencyInjection\Loader\Configurator; -**type**: ``integer`` + return static function (ContainerConfigurator $container): void { + $container->extension('framework', [ + 'mailer' => [ + 'dsn' => 'smtp://localhost:25', + 'envelope' => [ + 'recipients' => [ + 'admin@symfony.com', + 'lead@symfony.com', + ], + ], + ], + ]); + }; -This defines the probability that the garbage collector (GC) process is -started on every session initialization. The probability is calculated by -using ``gc_probability`` / ``gc_divisor``, e.g. 1/100 means there is a 1% -chance that the GC process will start on each request. +sender +"""""" -If not set, Symfony will use the value of the `session.gc_probability`_ directive -in the ``php.ini`` configuration file. +**type**: ``string`` -.. versionadded:: 7.2 +The "envelope sender" which is used as the value of ``MAIL FROM`` during the +`SMTP session`_. This value overrides any other sender set in the code. - Relying on ``php.ini``'s directive as default for ``gc_probability`` was - introduced in Symfony 7.2. +.. _mailer-headers: -gc_maxlifetime -.............. +headers +....... -**type**: ``integer`` +**type**: ``array`` -This determines the number of seconds after which data will be seen as "garbage" -and potentially cleaned up. Garbage collection may occur during session -start and depends on `gc_divisor`_ and `gc_probability`_. +Headers to add to emails. The key (``name`` attribute in xml format) is the +header name and value the header value. -If not set, ``php.ini``'s `session.gc_maxlifetime`_ directive will be relied on. +.. seealso:: -sid_length -.......... + For more information, see :ref:`Configuring Emails Globally ` -**type**: ``integer`` +message_bus +........... -This determines the length of session ID string, which can be an integer between -``22`` and ``256`` (both inclusive), ``32`` being the recommended value. Longer -session IDs are harder to guess. +**type**: ``string`` **default**: ``null`` or default bus if Messenger component is installed -If not set, ``php.ini``'s `session.sid_length`_ directive will be relied on. +Service identifier of the message bus to use when using the +:doc:`Messenger component ` (e.g. ``messenger.default_bus``). -.. deprecated:: 7.2 +transports +.......... - The ``sid_length`` option was deprecated in Symfony 7.2. No alternative is - provided as PHP 8.4 has deprecated the related option. +**type**: ``array`` -sid_bits_per_character -...................... +A :ref:`list of DSN ` that can be used by the +mailer. A transport name is the key and the dsn is the value. -**type**: ``integer`` +messenger +~~~~~~~~~ -This determines the number of bits in the encoded session ID character. The possible -values are ``4`` (0-9, a-f), ``5`` (0-9, a-v), and ``6`` (0-9, a-z, A-Z, "-", ","). -The more bits results in stronger session ID. ``5`` is recommended value for -most environments. +enabled +....... -If not set, ``php.ini``'s `session.sid_bits_per_character`_ directive will be relied on. +**type**: ``boolean`` **default**: ``true`` -.. deprecated:: 7.2 +Whether to enable or not Messenger. - The ``sid_bits_per_character`` option was deprecated in Symfony 7.2. No alternative - is provided as PHP 8.4 has deprecated the related option. +.. seealso:: -save_path -......... + For more details, see the :doc:`Messenger component ` + documentation. -**type**: ``string`` | ``null`` **default**: ``%kernel.cache_dir%/sessions`` +php_errors +~~~~~~~~~~ -This determines the argument to be passed to the save handler. If you choose -the default file handler, this is the path where the session files are created. +log +... -If ``null``, ``php.ini``'s `session.save_path`_ directive will be relied on: +**type**: ``boolean`` | ``int`` | ``array`` **default**: ``true`` + +Use the application logger instead of the PHP logger for logging PHP errors. +When an integer value is used, it defines a bitmask of PHP errors that will +be logged. Those integer values must be the same used in the +`error_reporting PHP option`_. The default log levels will be used for each +PHP error. +When a boolean value is used, ``true`` enables logging for all PHP errors +while ``false`` disables logging entirely. + +This option also accepts a map of PHP errors to log levels: .. configuration-block:: @@ -1925,8 +2250,23 @@ If ``null``, ``php.ini``'s `session.save_path`_ directive will be relied on: # config/packages/framework.yaml framework: - session: - save_path: ~ + php_errors: + log: + !php/const \E_DEPRECATED: !php/const Psr\Log\LogLevel::ERROR + !php/const \E_USER_DEPRECATED: !php/const Psr\Log\LogLevel::ERROR + !php/const \E_NOTICE: !php/const Psr\Log\LogLevel::ERROR + !php/const \E_USER_NOTICE: !php/const Psr\Log\LogLevel::ERROR + !php/const \E_STRICT: !php/const Psr\Log\LogLevel::ERROR + !php/const \E_WARNING: !php/const Psr\Log\LogLevel::ERROR + !php/const \E_USER_WARNING: !php/const Psr\Log\LogLevel::ERROR + !php/const \E_COMPILE_WARNING: !php/const Psr\Log\LogLevel::ERROR + !php/const \E_CORE_WARNING: !php/const Psr\Log\LogLevel::ERROR + !php/const \E_USER_ERROR: !php/const Psr\Log\LogLevel::CRITICAL + !php/const \E_RECOVERABLE_ERROR: !php/const Psr\Log\LogLevel::CRITICAL + !php/const \E_COMPILE_ERROR: !php/const Psr\Log\LogLevel::CRITICAL + !php/const \E_PARSE: !php/const Psr\Log\LogLevel::CRITICAL + !php/const \E_ERROR: !php/const Psr\Log\LogLevel::CRITICAL + !php/const \E_CORE_ERROR: !php/const Psr\Log\LogLevel::CRITICAL .. code-block:: xml @@ -1940,282 +2280,225 @@ If ``null``, ``php.ini``'s `session.save_path`_ directive will be relied on: http://symfony.com/schema/dic/symfony https://symfony.com/schema/dic/symfony/symfony-1.0.xsd"> - + + + + .. code-block:: php // config/packages/framework.php + use Psr\Log\LogLevel; use Symfony\Config\FrameworkConfig; return static function (FrameworkConfig $framework): void { - $framework->session() - ->savePath(null); + $framework->phpErrors()->log(\E_DEPRECATED, LogLevel::ERROR); + $framework->phpErrors()->log(\E_USER_DEPRECATED, LogLevel::ERROR); + // ... }; -.. _reference-session-metadata-update-threshold: - -metadata_update_threshold -......................... +throw +..... -**type**: ``integer`` **default**: ``0`` +**type**: ``boolean`` **default**: ``%kernel.debug%`` -This is how many seconds to wait between updating/writing the session metadata. -This can be useful if, for some reason, you want to limit the frequency at which -the session persists, instead of doing that on every request. +Throw PHP errors as ``\ErrorException`` instances. The parameter +``debug.error_handler.throw_at`` controls the threshold. -.. _reference-session-enabled: +profiler +~~~~~~~~ -enabled +collect ....... **type**: ``boolean`` **default**: ``true`` -Whether to enable the session support in the framework. +This option configures the way the profiler behaves when it is enabled. If set +to ``true``, the profiler collects data for all requests. If you want to only +collect information on-demand, you can set the ``collect`` flag to ``false`` and +activate the data collectors manually:: -.. configuration-block:: + $profiler->enable(); - .. code-block:: yaml +collect_parameter +................. - # config/packages/framework.yaml - framework: - session: - enabled: true +**type**: ``string`` **default**: ``null`` - .. code-block:: xml +This specifies name of a query parameter, a body parameter or a request attribute +used to enable or disable collection of data by the profiler for each request. +Combine it with the ``collect`` option to enable/disable the profiler on demand: - - - +* If the ``collect`` option is set to ``true`` but this parameter exists in a + request and has any value other than ``true``, ``yes``, ``on`` or ``1``, the + request data will not be collected; +* If the ``collect`` option is set to ``false``, but this parameter exists in a + request and has value of ``true``, ``yes``, ``on`` or ``1``, the request data + will be collected. - - - - +.. _collect_serializer_data: - .. code-block:: php +collect_serializer_data +....................... - // config/packages/framework.php - use Symfony\Config\FrameworkConfig; +**type**: ``boolean`` **default**: ``false`` - return static function (FrameworkConfig $framework): void { - $framework->session() - ->enabled(true); - }; +Set this option to ``true`` to enable the serializer data collector and its +profiler panel. When this option is ``true``, all normalizers and encoders are +decorated by traceable implementations that collect profiling information about them. -use_cookies -........... +.. _profiler-dsn: -**type**: ``boolean`` +dsn +... -This specifies if the session ID is stored on the client side using cookies or -not. +**type**: ``string`` **default**: ``file:%kernel.cache_dir%/profiler`` -If not set, ``php.ini``'s `session.use_cookies`_ directive will be relied on. +The DSN where to store the profiling information. -ssi -~~~ +.. _reference-profiler-enabled: enabled ....... **type**: ``boolean`` **default**: ``false`` -Whether to enable or not SSI support in your application. - -assets -~~~~~~ - -.. _reference-assets-base-path: +The profiler can be enabled by setting this option to ``true``. When you +install it using Symfony Flex, the profiler is enabled in the ``dev`` +and ``test`` environments. -base_path -......... +.. note:: -**type**: ``string`` + The profiler works independently from the Web Developer Toolbar, see + the :doc:`WebProfilerBundle configuration ` + on how to disable/enable the toolbar. -This option allows you to define a base path to be used for assets: +only_exceptions +............... -.. configuration-block:: +**type**: ``boolean`` **default**: ``false`` - .. code-block:: yaml +When this is set to ``true``, the profiler will only be enabled when an +exception is thrown during the handling of the request. - # config/packages/framework.yaml - framework: - # ... - assets: - base_path: '/images' +.. _only_master_requests: - .. code-block:: xml +only_main_requests +.................. - - - +**type**: ``boolean`` **default**: ``false`` - - - - +When this is set to ``true``, the profiler will only be enabled on the main +requests (and not on the subrequests). - .. code-block:: php +property_access +~~~~~~~~~~~~~~~ - // config/packages/framework.php - use Symfony\Config\FrameworkConfig; +magic_call +.......... - return static function (FrameworkConfig $framework): void { - // ... - $framework->assets() - ->basePath('/images'); - }; +**type**: ``boolean`` **default**: ``false`` -.. _reference-templating-base-urls: -.. _reference-assets-base-urls: +When enabled, the ``property_accessor`` service uses PHP's +:ref:`magic __call() method ` when +its ``getValue()`` method is called. -base_urls +magic_get ......... -**type**: ``array`` - -This option allows you to define base URLs to be used for assets. -If multiple base URLs are provided, Symfony will select one from the -collection each time it generates an asset's path: - -.. configuration-block:: - - .. code-block:: yaml - - # config/packages/framework.yaml - framework: - # ... - assets: - base_urls: - - 'http://cdn.example.com/' - - .. code-block:: xml - - - - - - - - - +**type**: ``boolean`` **default**: ``true`` - .. code-block:: php +When enabled, the ``property_accessor`` service uses PHP's +:ref:`magic __get() method ` when +its ``getValue()`` method is called. - // config/packages/framework.php - use Symfony\Config\FrameworkConfig; +magic_set +......... - return static function (FrameworkConfig $framework): void { - // ... - $framework->assets() - ->baseUrls(['http://cdn.example.com/']); - }; +**type**: ``boolean`` **default**: ``true`` -.. _reference-framework-assets-packages: +When enabled, the ``property_accessor`` service uses PHP's +:ref:`magic __set() method ` when +its ``setValue()`` method is called. -packages -........ +throw_exception_on_invalid_index +................................ -You can group assets into packages, to specify different base URLs for them: +**type**: ``boolean`` **default**: ``false`` -.. configuration-block:: +When enabled, the ``property_accessor`` service throws an exception when you +try to access an invalid index of an array. - .. code-block:: yaml +throw_exception_on_invalid_property_path +........................................ - # config/packages/framework.yaml - framework: - # ... - assets: - packages: - avatars: - base_urls: 'http://static_cdn.example.com/avatars' +**type**: ``boolean`` **default**: ``true`` - .. code-block:: xml +When enabled, the ``property_accessor`` service throws an exception when you +try to access an invalid property path of an object. - - - +property_info +~~~~~~~~~~~~~ - - - - - - +.. _reference-property-info-enabled: - .. code-block:: php +enabled +....... - // config/packages/framework.php - use Symfony\Config\FrameworkConfig; +**type**: ``boolean`` **default**: ``true`` or ``false`` depending on your installation - return static function (FrameworkConfig $framework): void { - // ... - $framework->assets() - ->package('avatars') - ->baseUrls(['http://static_cdn.example.com/avatars']); - }; +rate_limiter +~~~~~~~~~~~~ -Now you can use the ``avatars`` package in your templates: +.. _reference-rate-limiter-name: -.. code-block:: html+twig +name +.... - +**type**: ``prototype`` -Each package can configure the following options: +Name of the rate limiter you want to create. -* :ref:`base_path ` -* :ref:`base_urls ` -* :ref:`version_strategy ` -* :ref:`version ` -* :ref:`version_format ` -* :ref:`json_manifest_path ` -* :ref:`strict_mode ` +lock_factory +"""""""""""" -.. _reference-framework-assets-version: -.. _ref-framework-assets-version: +**type**: ``string`` **default:** ``lock.factory`` -version -....... +The service that is used to create a lock. The service has to be an instance of +the :class:`Symfony\\Component\\Lock\\LockFactory` class. -**type**: ``string`` +policy +"""""" -This option is used to *bust* the cache on assets by globally adding a query -parameter to all rendered asset paths (e.g. ``/images/logo.png?v2``). This -applies only to assets rendered via the Twig ``asset()`` function (or PHP -equivalent). +**type**: ``string`` **required** -For example, suppose you have the following: +The name of the rate limiting algorithm to use. Example names are ``fixed_window``, +``sliding_window`` and ``no_limit``. See :ref:`Rate Limiter Policies `) +for more information. -.. code-block:: html+twig +request +~~~~~~~ - Symfony! +formats +....... -By default, this will render a path to your image such as ``/images/logo.png``. -Now, activate the ``version`` option: +**type**: ``array`` **default**: ``[]`` + +This setting is used to associate additional request formats (e.g. ``html``) +to one or more mime types (e.g. ``text/html``), which will allow you to use the +format & mime types to call +:method:`Request::getFormat($mimeType) ` or +:method:`Request::getMimeType($format) `. + +In practice, this is important because Symfony uses it to automatically set the +``Content-Type`` header on the ``Response`` (if you don't explicitly set one). +If you pass an array of mime types, the first will be used for the header. + +To configure a ``jsonp`` format: .. configuration-block:: @@ -2223,23 +2506,29 @@ Now, activate the ``version`` option: # config/packages/framework.yaml framework: - # ... - assets: - version: 'v2' + request: + formats: + jsonp: 'application/javascript' .. code-block:: xml + + http://symfony.com/schema/dic/symfony + https://symfony.com/schema/dic/symfony/symfony-1.0.xsd"> - + + + application/javascript + + @@ -2249,583 +2538,464 @@ Now, activate the ``version`` option: use Symfony\Config\FrameworkConfig; return static function (FrameworkConfig $framework): void { - // ... - $framework->assets() - ->version('v2'); + $framework->request() + ->format('jsonp', 'application/javascript'); }; -Now, the same asset will be rendered as ``/images/logo.png?v2`` If you use -this feature, you **must** manually increment the ``version`` value -before each deployment so that the query parameters change. - -You can also control how the query string works via the `version_format`_ -option. - -.. note:: - - This parameter cannot be set at the same time as ``version_strategy`` or ``json_manifest_path``. - -.. tip:: - - As with all settings, you can use a parameter as value for the - ``version``. This makes it easier to increment the cache on each - deployment. - -.. _reference-templating-version-format: -.. _reference-assets-version-format: - -version_format -.............. - -**type**: ``string`` **default**: ``%%s?%%s`` - -This specifies a :phpfunction:`sprintf` pattern that will be used with the -`version`_ option to construct an asset's path. By default, the pattern -adds the asset's version as a query string. For example, if -``version_format`` is set to ``%%s?version=%%s`` and ``version`` -is set to ``5``, the asset's path would be ``/images/logo.png?version=5``. - -.. note:: - - All percentage signs (``%``) in the format string must be doubled to - escape the character. Without escaping, values might inadvertently be - interpreted as :ref:`service-container-parameters`. +router +~~~~~~ -.. tip:: +cache_dir +......... - Some CDN's do not support cache-busting via query strings, so injecting - the version into the actual file path is necessary. Thankfully, - ``version_format`` is not limited to producing versioned query - strings. +**type**: ``string`` **default**: ``%kernel.cache_dir%`` - The pattern receives the asset's original path and version as its first - and second parameters, respectively. Since the asset's path is one - parameter, you cannot modify it in-place (e.g. ``/images/logo-v5.png``); - however, you can prefix the asset's path using a pattern of - ``version-%%2$s/%%1$s``, which would result in the path - ``version-5/images/logo.png``. +The directory where routing information will be cached. Can be set to +``~`` (``null``) to disable route caching. - URL rewrite rules could then be used to disregard the version prefix - before serving the asset. Alternatively, you could copy assets to the - appropriate version path as part of your deployment process and forgot - any URL rewriting. The latter option is useful if you would like older - asset versions to remain accessible at their original URL. +.. deprecated:: 7.1 -.. _reference-assets-version-strategy: -.. _reference-templating-version-strategy: + Setting the ``cache_dir`` option is deprecated since Symfony 7.1. The routes + are now always cached in the ``%kernel.build_dir%`` directory. -version_strategy -................ +default_uri +........... -**type**: ``string`` **default**: ``null`` +**type**: ``string`` -The service id of the :doc:`asset version strategy ` -applied to the assets. This option can be set globally for all assets and -individually for each asset package: +The default URI used to generate URLs in a non-HTTP context (see +:ref:`Generating URLs in Commands `). -.. configuration-block:: +http_port +......... - .. code-block:: yaml +**type**: ``integer`` **default**: ``80`` - # config/packages/framework.yaml - framework: - assets: - # this strategy is applied to every asset (including packages) - version_strategy: 'app.asset.my_versioning_strategy' - packages: - foo_package: - # this package removes any versioning (its assets won't be versioned) - version: ~ - bar_package: - # this package uses its own strategy (the default strategy is ignored) - version_strategy: 'app.asset.another_version_strategy' - baz_package: - # this package inherits the default strategy - base_path: '/images' +The port for normal http requests (this is used when matching the scheme). - .. code-block:: xml +https_port +.......... - - - +**type**: ``integer`` **default**: ``443`` - - - - - - - - - - - +The port for https requests (this is used when matching the scheme). - .. code-block:: php +resource +........ - // config/packages/framework.php - use Symfony\Config\FrameworkConfig; +**type**: ``string`` **required** - return static function (FrameworkConfig $framework): void { - // ... - $framework->assets() - ->versionStrategy('app.asset.my_versioning_strategy'); +The path the main routing resource (e.g. a YAML file) that contains the +routes and imports the router should load. - $framework->assets()->package('foo_package') - // this package removes any versioning (its assets won't be versioned) - ->version(null); +strict_requirements +................... - $framework->assets()->package('bar_package') - // this package uses its own strategy (the default strategy is ignored) - ->versionStrategy('app.asset.another_version_strategy'); +**type**: ``mixed`` **default**: ``true`` - $framework->assets()->package('baz_package') - // this package inherits the default strategy - ->basePath('/images'); - }; +Determines the routing generator behavior. When generating a route that +has specific :ref:`parameter requirements `, the generator +can behave differently in case the used parameters do not meet these requirements. -.. note:: +The value can be one of: - This parameter cannot be set at the same time as ``version`` or ``json_manifest_path``. +``true`` + Throw an exception when the requirements are not met; +``false`` + Disable exceptions when the requirements are not met and return ``''`` + instead; +``null`` + Disable checking the requirements (thus, match the route even when the + requirements don't match). -.. _reference-assets-json-manifest-path: -.. _reference-templating-json-manifest-path: +``true`` is recommended in the development environment, while ``false`` +or ``null`` might be preferred in production. -json_manifest_path -.................. +.. _reference-router-type: -**type**: ``string`` **default**: ``null`` +type +.... -The file path or absolute URL to a ``manifest.json`` file containing an -associative array of asset names and their respective compiled names. A common -cache-busting technique using a "manifest" file works by writing out assets with -a "hash" appended to their file names (e.g. ``main.ae433f1cb.css``) during a -front-end compilation routine. +**type**: ``string`` -.. tip:: +The type of the resource to hint the loaders about the format. This isn't +needed when you use the default routers with the expected file extensions +(``.xml``, ``.yaml``, ``.php``). - Symfony's :ref:`Webpack Encore ` supports - :ref:`outputting hashed assets `. Moreover, this - can be incorporated into many other workflows, including Webpack and - Gulp using `webpack-manifest-plugin`_ and `gulp-rev`_, respectively. +utf8 +.... -This option can be set globally for all assets and individually for each asset -package: +**type**: ``boolean`` **default**: ``true`` -.. configuration-block:: +When this option is set to ``true``, the regular expressions used in the +:ref:`requirements of route parameters ` will be run +using the `utf-8 modifier`_. This will for example match any UTF-8 character +when using ``.``, instead of matching only a single byte. - .. code-block:: yaml +If the charset of your application is UTF-8 (as defined in the +:ref:`getCharset() method ` of your kernel) it's +recommended setting it to ``true``. This will make non-UTF8 URLs to generate 404 +errors. - # config/packages/framework.yaml - framework: - assets: - # this manifest is applied to every asset (including packages) - json_manifest_path: "%kernel.project_dir%/public/build/manifest.json" - # you can use absolute URLs too and Symfony will download them automatically - # json_manifest_path: 'https://cdn.example.com/manifest.json' - packages: - foo_package: - # this package uses its own manifest (the default file is ignored) - json_manifest_path: "%kernel.project_dir%/public/build/a_different_manifest.json" - # Throws an exception when an asset is not found in the manifest - strict_mode: %kernel.debug% - bar_package: - # this package uses the global manifest (the default file is used) - base_path: '/images' +.. _configuration-framework-secret: - .. code-block:: xml +secret +~~~~~~ - - - +**type**: ``string`` **required** - - - - - - - - - - - - - +This is a string that should be unique to your application and it's commonly +used to add more entropy to security related operations. Its value should +be a series of characters, numbers and symbols chosen randomly and the +recommended length is around 32 characters. - .. code-block:: php +In practice, Symfony uses this value for encrypting the cookies used +in the :doc:`remember me functionality ` and for +creating signed URIs when using :ref:`ESI (Edge Side Includes) `. +That's why you should treat this value as if it were a sensitive credential and +**never make it public**. - // config/packages/framework.php - use Symfony\Config\FrameworkConfig; +This option becomes the service container parameter named ``kernel.secret``, +which you can use whenever the application needs an immutable random string +to add more entropy. - return static function (FrameworkConfig $framework): void { - // ... - $framework->assets() - // this manifest is applied to every asset (including packages) - ->jsonManifestPath('%kernel.project_dir%/public/build/manifest.json'); +As with any other security-related parameter, it is a good practice to change +this value from time to time. However, keep in mind that changing this value +will invalidate all signed URIs and Remember Me cookies. That's why, after +changing this value, you should regenerate the application cache and log +out all the application users. - // you can use absolute URLs too and Symfony will download them automatically - // 'json_manifest_path' => 'https://cdn.example.com/manifest.json', - $framework->assets()->package('foo_package') - // this package uses its own manifest (the default file is ignored) - ->jsonManifestPath('%kernel.project_dir%/public/build/a_different_manifest.json') - // Throws an exception when an asset is not found in the manifest - ->setStrictMode('%kernel.debug%'); +secrets +~~~~~~~ - $framework->assets()->package('bar_package') - // this package uses the global manifest (the default file is used) - ->basePath('/images'); - }; +decryption_env_var +.................. -.. note:: +**type**: ``string`` **default**: ``base64:default::SYMFONY_DECRYPTION_SECRET`` - This parameter cannot be set at the same time as ``version`` or ``version_strategy``. - Additionally, this option cannot be nullified at the package scope if a global manifest - file is specified. +The env var name that contains the vault decryption secret. By default, this +value will be decoded from base64. -.. tip:: +enabled +....... - If you request an asset that is *not found* in the ``manifest.json`` file, the original - - *unmodified* - asset path will be returned. - You can set ``strict_mode`` to ``true`` to get an exception when an asset is *not found*. +**type**: ``boolean`` **default**: ``true`` -.. note:: +Whether to enable or not secrets managements. - If a URL is set, the JSON manifest is downloaded on each request using the `http_client`_. +local_dotenv_file +................. -.. _reference-assets-strict-mode: +**type**: ``string`` **default**: ``%kernel.project_dir%/.env.%kernel.environment%.local`` -strict_mode -........... +The path to the local ``.env`` file. This file must contain the vault +decryption key, given by the ``decryption_env_var`` option. -**type**: ``boolean`` **default**: ``false`` +vault_directory +............... -When enabled, the strict mode asserts that all requested assets are in the -manifest file. This option is useful to detect typos or missing assets, the -recommended value is ``%kernel.debug%``. +**type**: ``string`` **default**: ``%kernel.project_dir%/config/secrets/%kernel.runtime_environment%`` -translator -~~~~~~~~~~ +The directory to store the secret vault. By default, the path includes the value +of the :ref:`kernel.runtime_environment ` +parameter. -cache_dir -......... +semaphore +~~~~~~~~~ -**type**: ``string`` | ``null`` **default**: ``%kernel.cache_dir%/translations`` +**type**: ``string`` | ``array`` -Defines the directory where the translation cache is stored. Use ``null`` to -disable this cache. +The default semaphore adapter. Store's DSN are also allowed. -.. _reference-translator-enabled: +.. _reference-semaphore-enabled: enabled ....... -**type**: ``boolean`` **default**: ``true`` or ``false`` depending on your installation +**type**: ``boolean`` **default**: ``true`` -Whether or not to enable the ``translator`` service in the service container. +Whether to enable the support for semaphore or not. This setting is +automatically set to ``true`` when one of the child settings is configured. -.. _fallback: +.. _reference-semaphore-resources: -fallbacks +resources ......... -**type**: ``string|array`` **default**: value of `default_locale`_ +**type**: ``array`` -This option is used when the translation key for the current locale wasn't -found. +A map of semaphore stores to be created by the framework extension, with +the name as key and DSN as value: -.. seealso:: +.. configuration-block:: - For more details, see :doc:`/translation`. + .. code-block:: yaml -.. _reference-framework-translator-logging: + # config/packages/semaphore.yaml + framework: + semaphore: '%env(SEMAPHORE_DSN)%' -logging -....... + .. code-block:: xml -**default**: ``true`` when the debug mode is enabled, ``false`` otherwise. + + + -When ``true``, a log entry is made whenever the translator cannot find a translation -for a given key. The logs are made to the ``translation`` channel at the -``debug`` level for keys where there is a translation in the fallback -locale, and the ``warning`` level if there is no translation to use at all. + + + %env(SEMAPHORE_DSN)% + + + -.. _reference-framework-translator-formatter: + .. code-block:: php -formatter -......... + // config/packages/semaphore.php + use Symfony\Config\FrameworkConfig; -**type**: ``string`` **default**: ``translator.formatter.default`` + return static function (FrameworkConfig $framework): void { + $framework->semaphore() + ->resource('default', ['%env(SEMAPHORE_DSN)%']); + }; -The ID of the service used to format translation messages. The service class -must implement the :class:`Symfony\\Component\\Translation\\Formatter\\MessageFormatterInterface`. +.. _reference-semaphore-resources-name: -.. _reference-translator-paths: +name +"""" + +**type**: ``prototype`` + +Name of the semaphore you want to create. + +.. _configuration-framework-serializer: + +serializer +~~~~~~~~~~ + +.. _reference-serializer-circular_reference_handler: -paths -..... +circular_reference_handler +.......................... -**type**: ``array`` **default**: ``[]`` +**type** ``string`` -This option allows to define an array of paths where the component will look -for translation files. The later a path is added, the more priority it has -(translations from later paths overwrite earlier ones). Translations from the -:ref:`default_path ` have more priority than -translations from all these paths. +The service id that is used as the circular reference handler of the default +serializer. The service has to implement the magic ``__invoke($object)`` +method. -.. _reference-translator-default_path: +.. seealso:: -default_path -............ + For more information, see + :ref:`component-serializer-handling-circular-references`. -**type**: ``string`` **default**: ``%kernel.project_dir%/translations`` +default_context +............... -This option allows to define the path where the application translations files -are stored. +**type**: ``array`` **default**: ``[]`` -.. _reference-translator-providers: +A map with default context options that will be used with each ``serialize`` and ``deserialize`` +call. This can be used for example to set the json encoding behavior by setting ``json_encode_options`` +to a `json_encode flags bitmask`_. -providers -......... +You can inspect the :ref:`serializer context builders ` +to discover the available settings. -**type**: ``array`` **default**: ``[]`` +.. _reference-serializer-enable_annotations: -This option enables and configures :ref:`translation providers ` -to push and pull your translations to/from third party translation services. +enable_attributes +................. -property_access -~~~~~~~~~~~~~~~ +**type**: ``boolean`` **default**: ``true`` -magic_call -.......... +Enables support for `PHP attributes`_ in the serializer component. -**type**: ``boolean`` **default**: ``false`` +.. seealso:: -When enabled, the ``property_accessor`` service uses PHP's -:ref:`magic __call() method ` when -its ``getValue()`` method is called. + See :ref:`the reference ` for a list of supported annotations. -magic_get -......... +.. _reference-serializer-enabled: -**type**: ``boolean`` **default**: ``true`` +enabled +....... -When enabled, the ``property_accessor`` service uses PHP's -:ref:`magic __get() method ` when -its ``getValue()`` method is called. +**type**: ``boolean`` **default**: ``true`` or ``false`` depending on your installation -magic_set -......... +Whether to enable the ``serializer`` service or not in the service container. -**type**: ``boolean`` **default**: ``true`` +.. _reference-serializer-mapping: -When enabled, the ``property_accessor`` service uses PHP's -:ref:`magic __set() method ` when -its ``setValue()`` method is called. +mapping +....... -throw_exception_on_invalid_index -................................ +.. _reference-serializer-mapping-paths: -**type**: ``boolean`` **default**: ``false`` +paths +""""" -When enabled, the ``property_accessor`` service throws an exception when you -try to access an invalid index of an array. +**type**: ``array`` **default**: ``[]`` -throw_exception_on_invalid_property_path -........................................ +This option allows to define an array of paths with files or directories where +the component will look for additional serialization files. -**type**: ``boolean`` **default**: ``true`` +.. _reference-serializer-name_converter: -When enabled, the ``property_accessor`` service throws an exception when you -try to access an invalid property path of an object. +name_converter +.............. -property_info -~~~~~~~~~~~~~ +**type**: ``string`` -.. _reference-property-info-enabled: +The name converter to use. +The :class:`Symfony\\Component\\Serializer\\NameConverter\\CamelCaseToSnakeCaseNameConverter` +name converter can enabled by using the ``serializer.name_converter.camel_case_to_snake_case`` +value. -enabled -....... +.. seealso:: -**type**: ``boolean`` **default**: ``true`` or ``false`` depending on your installation + For more information, see :ref:`serializer-name-conversion`. -.. _reference-validation: +.. _config-framework-session: -validation -~~~~~~~~~~ +session +~~~~~~~ -.. _reference-validation-auto-mapping: +cache_limiter +............. -auto_mapping -............ +**type**: ``string`` **default**: ``0`` -**type**: ``array`` **default**: ``[]`` +If set to ``0``, Symfony won't set any particular header related to the cache +and it will rely on ``php.ini``'s `session.cache_limiter`_ directive. -Defines the Doctrine entities that will be introspected to add -:ref:`automatic validation constraints ` to them: +Unlike the other session options, ``cache_limiter`` is set as a regular +:ref:`container parameter `: .. configuration-block:: .. code-block:: yaml - framework: - validation: - auto_mapping: - # an empty array means that all entities that belong to that - # namespace will add automatic validation - 'App\Entity\': [] - 'Foo\': ['Foo\Some\Entity', 'Foo\Another\Entity'] + # config/services.yaml + parameters: + session.storage.options: + cache_limiter: 0 .. code-block:: xml - + - - - - - + https://symfony.com/schema/dic/services/services-1.0.xsd"> - Foo\Some\Entity - Foo\Another\Entity - - - + + + 0 + + .. code-block:: php - // config/packages/framework.php - use Symfony\Config\FrameworkConfig; - - return static function (FrameworkConfig $framework): void { - $framework->validation() - ->autoMapping() - ->paths([ - 'App\\Entity\\' => [], - 'Foo\\' => ['Foo\\Some\\Entity', 'Foo\\Another\\Entity'], - ]); - }; - -.. _reference-validation-enabled: + // config/services.php + $container->setParameter('session.storage.options', [ + 'cache_limiter' => 0, + ]); -enabled -....... +Be aware that if you configure it, you'll have to set other session-related options +as parameters as well. -**type**: ``boolean`` **default**: ``true`` or ``false`` depending on your installation +cookie_domain +............. -Whether or not to enable validation support. +**type**: ``string`` -This option will automatically be set to ``true`` when one of the child -settings is configured. +This determines the domain to set in the session cookie. -.. _reference-validation-enable_annotations: +If not set, ``php.ini``'s `session.cookie_domain`_ directive will be relied on. -enable_attributes -................. +cookie_httponly +............... **type**: ``boolean`` **default**: ``true`` -If this option is enabled, validation constraints can be defined using `PHP attributes`_. +This determines whether cookies should only be accessible through the HTTP +protocol. This means that the cookie won't be accessible by scripting +languages, such as JavaScript. This setting can effectively help to reduce +identity theft through :ref:`XSS attacks `. -translation_domain -.................. +cookie_lifetime +............... -**type**: ``string | false`` **default**: ``validators`` +**type**: ``integer`` -The translation domain that is used when translating validation constraint -error messages. Use false to disable translations. +This determines the lifetime of the session - in seconds. +Setting this value to ``0`` means the cookie is valid for +the length of the browser session. -.. _reference-validation-not-compromised-password: +If not set, ``php.ini``'s `session.cookie_lifetime`_ directive will be relied on. -not_compromised_password -........................ +cookie_path +........... -The :doc:`NotCompromisedPassword ` -constraint makes HTTP requests to a public API to check if the given password -has been compromised in a data breach. +**type**: ``string`` -.. _reference-validation-not-compromised-password-enabled: +This determines the path to set in the session cookie. -enabled -""""""" +If not set, ``php.ini``'s `session.cookie_path`_ directive will be relied on. -**type**: ``boolean`` **default**: ``true`` +cookie_samesite +............... -If you set this option to ``false``, no HTTP requests will be made and the given -password will be considered valid. This is useful when you don't want or can't -make HTTP requests, such as in ``dev`` and ``test`` environments or in -continuous integration servers. +**type**: ``string`` or ``null`` **default**: ``null`` -endpoint -"""""""" +It controls the way cookies are sent when the HTTP request did not originate +from the same domain that is associated with the cookies. Setting this option is +recommended to mitigate `CSRF security attacks`_. -**type**: ``string`` **default**: ``null`` +By default, browsers send all cookies related to the domain of the HTTP request. +This may be a problem for example when you visit a forum and some malicious +comment includes a link like ``https://some-bank.com/?send_money_to=attacker&amount=1000``. +If you were previously logged into your bank website, the browser will send all +those cookies when making that HTTP request. -By default, the :doc:`NotCompromisedPassword ` -constraint uses the public API provided by `haveibeenpwned.com`_. This option -allows to define a different, but compatible, API endpoint to make the password -checks. It's useful for example when the Symfony application is run in an -intranet without public access to the internet. +The possible values for this option are: + +* ``null``, use ``php.ini``'s `session.cookie_samesite`_ directive. +* ``'none'`` (or the ``Symfony\Component\HttpFoundation\Cookie::SAMESITE_NONE`` constant), use it to allow + sending of cookies when the HTTP request originated from a different domain + (previously this was the default behavior of null, but in newer browsers ``'lax'`` + would be applied when the header has not been set) +* ``'strict'`` (or the ``Cookie::SAMESITE_STRICT`` constant), use it to never + send any cookie when the HTTP request did not originate from the same domain. +* ``'lax'`` (or the ``Cookie::SAMESITE_LAX`` constant), use it to allow sending + cookies when the request originated from a different domain, but only when the + user consciously made the request (by clicking a link or submitting a form + with the ``GET`` method). -static_method +cookie_secure ............. -**type**: ``string | array`` **default**: ``['loadValidatorMetadata']`` - -Defines the name of the static method which is called to load the validation -metadata of the class. You can define an array of strings with the names of -several methods. In that case, all of them will be called in that order to load -the metadata. - -.. _reference-validation-email_validation_mode: - -email_validation_mode -..................... +**type**: ``boolean`` or ``'auto'`` -**type**: ``string`` **default**: ``html5`` +This determines whether cookies should only be sent over secure connections. In +addition to ``true`` and ``false``, there's a special ``'auto'`` value that +means ``true`` for HTTPS requests and ``false`` for HTTP requests. -Sets the default value for the -:ref:`"mode" option of the Email validator `. +If not set, ``php.ini``'s `session.cookie_secure`_ directive will be relied on. -.. _reference-validation-mapping: +.. _reference-session-enabled: -mapping +enabled ....... -.. _reference-validation-mapping-paths: - -paths -""""" - -**type**: ``array`` **default**: ``['config/validation/']`` +**type**: ``boolean`` **default**: ``true`` -This option allows to define an array of paths with files or directories where -the component will look for additional validation files: +Whether to enable the session support in the framework. .. configuration-block:: @@ -2833,10 +3003,8 @@ the component will look for additional validation files: # config/packages/framework.yaml framework: - validation: - mapping: - paths: - - "%kernel.project_dir%/config/validation/" + session: + enabled: true .. code-block:: xml @@ -2850,11 +3018,7 @@ the component will look for additional validation files: http://symfony.com/schema/dic/symfony https://symfony.com/schema/dic/symfony/symfony-1.0.xsd"> - - - %kernel.project_dir%/config/validation/ - - + @@ -2864,152 +3028,163 @@ the component will look for additional validation files: use Symfony\Config\FrameworkConfig; return static function (FrameworkConfig $framework): void { - $framework->validation() - ->mapping() - ->paths(['%kernel.project_dir%/config/validation/']); + $framework->session() + ->enabled(true); }; -annotations -~~~~~~~~~~~ - -.. _reference-annotations-cache: - -cache -..... +gc_divisor +.......... -**type**: ``string`` **default**: ``php_array`` +**type**: ``integer`` -This option can be one of the following values: +See `gc_probability`_. -php_array - Use a PHP array to cache annotations in memory -file - Use the filesystem to cache annotations -none - Disable the caching of annotations +If not set, ``php.ini``'s `session.gc_divisor`_ directive will be relied on. -file_cache_dir +gc_maxlifetime .............. -**type**: ``string`` **default**: ``%kernel.cache_dir%/annotations`` - -The directory to store cache files for annotations, in case -``annotations.cache`` is set to ``'file'``. - -debug -..... - -**type**: ``boolean`` **default**: ``%kernel.debug%`` - -Whether to enable debug mode for caching. If enabled, the cache will -automatically update when the original file is changed (both with code and -annotation changes). For performance reasons, it is recommended to disable -debug mode in production, which will happen automatically if you use the -default value. - -.. _configuration-framework-serializer: - -serializer -~~~~~~~~~~ - -.. _reference-serializer-enabled: +**type**: ``integer`` -enabled -....... +This determines the number of seconds after which data will be seen as "garbage" +and potentially cleaned up. Garbage collection may occur during session +start and depends on `gc_divisor`_ and `gc_probability`_. -**type**: ``boolean`` **default**: ``true`` or ``false`` depending on your installation +If not set, ``php.ini``'s `session.gc_maxlifetime`_ directive will be relied on. -Whether to enable the ``serializer`` service or not in the service container. +gc_probability +.............. -.. _reference-serializer-enable_annotations: +**type**: ``integer`` -enable_attributes -................. +This defines the probability that the garbage collector (GC) process is +started on every session initialization. The probability is calculated by +using ``gc_probability`` / ``gc_divisor``, e.g. 1/100 means there is a 1% +chance that the GC process will start on each request. -**type**: ``boolean`` **default**: ``true`` +If not set, Symfony will use the value of the `session.gc_probability`_ directive +in the ``php.ini`` configuration file. -Enables support for `PHP attributes`_ in the serializer component. +.. versionadded:: 7.2 -.. seealso:: + Relying on ``php.ini``'s directive as default for ``gc_probability`` was + introduced in Symfony 7.2. - See :ref:`the reference ` for a list of supported annotations. +.. _config-framework-session-handler-id: -.. _reference-serializer-name_converter: +handler_id +.......... -name_converter -.............. +**type**: ``string`` | ``null`` **default**: ``null`` -**type**: ``string`` +If ``framework.session.save_path`` is not set, the default value of this option +is ``null``, which means to use the session handler configured in php.ini. If the +``framework.session.save_path`` option is set, then Symfony stores sessions using +the native file session handler. -The name converter to use. -The :class:`Symfony\\Component\\Serializer\\NameConverter\\CamelCaseToSnakeCaseNameConverter` -name converter can enabled by using the ``serializer.name_converter.camel_case_to_snake_case`` -value. +It is possible to :ref:`store sessions in a database `, +and also to configure the session handler with a DSN: -.. seealso:: +.. configuration-block:: - For more information, see :ref:`serializer-name-conversion`. + .. code-block:: yaml -.. _reference-serializer-circular_reference_handler: + # config/packages/framework.yaml + framework: + session: + # a few possible examples + handler_id: 'redis://localhost' + handler_id: '%env(REDIS_URL)%' + handler_id: '%env(DATABASE_URL)%' + handler_id: 'file://%kernel.project_dir%/var/sessions' -circular_reference_handler -.......................... + .. code-block:: xml -**type** ``string`` + + + + + + + + -The service id that is used as the circular reference handler of the default -serializer. The service has to implement the magic ``__invoke($object)`` -method. + .. code-block:: php -.. seealso:: + // config/packages/framework.php + use function Symfony\Component\DependencyInjection\Loader\Configurator\env; + use Symfony\Config\FrameworkConfig; - For more information, see - :ref:`component-serializer-handling-circular-references`. + return static function (FrameworkConfig $framework): void { + // ... -.. _reference-serializer-mapping: + $framework->session() + // a few possible examples + ->handlerId('redis://localhost') + ->handlerId(env('REDIS_URL')) + ->handlerId(env('DATABASE_URL')) + ->handlerId('file://%kernel.project_dir%/var/sessions'); + }; -mapping -....... +.. note:: -.. _reference-serializer-mapping-paths: + Supported DSN protocols are the following: -paths -""""" + * ``file`` + * ``redis`` + * ``rediss`` (Redis over TLS) + * ``memcached`` (requires :doc:`symfony/cache `) + * ``pdo_oci`` (requires :doc:`doctrine/dbal `) + * ``mssql`` + * ``mysql`` + * ``mysql2`` + * ``pgsql`` + * ``postgres`` + * ``postgresql`` + * ``sqlsrv`` + * ``sqlite`` + * ``sqlite3`` -**type**: ``array`` **default**: ``[]`` +.. _reference-session-metadata-update-threshold: -This option allows to define an array of paths with files or directories where -the component will look for additional serialization files. +metadata_update_threshold +......................... -default_context -............... +**type**: ``integer`` **default**: ``0`` -**type**: ``array`` **default**: ``[]`` +This is how many seconds to wait between updating/writing the session metadata. +This can be useful if, for some reason, you want to limit the frequency at which +the session persists, instead of doing that on every request. -A map with default context options that will be used with each ``serialize`` and ``deserialize`` -call. This can be used for example to set the json encoding behavior by setting ``json_encode_options`` -to a `json_encode flags bitmask`_. +.. _name: -You can inspect the :ref:`serializer context builders ` -to discover the available settings. +name +.... -php_errors -~~~~~~~~~~ +**type**: ``string`` -log -... +This specifies the name of the session cookie. -**type**: ``boolean`` | ``int`` | ``array`` **default**: ``true`` +If not set, ``php.ini``'s `session.name`_ directive will be relied on. -Use the application logger instead of the PHP logger for logging PHP errors. -When an integer value is used, it defines a bitmask of PHP errors that will -be logged. Those integer values must be the same used in the -`error_reporting PHP option`_. The default log levels will be used for each -PHP error. -When a boolean value is used, ``true`` enables logging for all PHP errors -while ``false`` disables logging entirely. +save_path +......... -This option also accepts a map of PHP errors to log levels: +**type**: ``string`` | ``null`` **default**: ``%kernel.cache_dir%/sessions`` + +This determines the argument to be passed to the save handler. If you choose +the default file handler, this is the path where the session files are created. + +If ``null``, ``php.ini``'s `session.save_path`_ directive will be relied on: .. configuration-block:: @@ -3017,23 +3192,8 @@ This option also accepts a map of PHP errors to log levels: # config/packages/framework.yaml framework: - php_errors: - log: - !php/const \E_DEPRECATED: !php/const Psr\Log\LogLevel::ERROR - !php/const \E_USER_DEPRECATED: !php/const Psr\Log\LogLevel::ERROR - !php/const \E_NOTICE: !php/const Psr\Log\LogLevel::ERROR - !php/const \E_USER_NOTICE: !php/const Psr\Log\LogLevel::ERROR - !php/const \E_STRICT: !php/const Psr\Log\LogLevel::ERROR - !php/const \E_WARNING: !php/const Psr\Log\LogLevel::ERROR - !php/const \E_USER_WARNING: !php/const Psr\Log\LogLevel::ERROR - !php/const \E_COMPILE_WARNING: !php/const Psr\Log\LogLevel::ERROR - !php/const \E_CORE_WARNING: !php/const Psr\Log\LogLevel::ERROR - !php/const \E_USER_ERROR: !php/const Psr\Log\LogLevel::CRITICAL - !php/const \E_RECOVERABLE_ERROR: !php/const Psr\Log\LogLevel::CRITICAL - !php/const \E_COMPILE_ERROR: !php/const Psr\Log\LogLevel::CRITICAL - !php/const \E_PARSE: !php/const Psr\Log\LogLevel::CRITICAL - !php/const \E_ERROR: !php/const Psr\Log\LogLevel::CRITICAL - !php/const \E_CORE_ERROR: !php/const Psr\Log\LogLevel::CRITICAL + session: + save_path: ~ .. code-block:: xml @@ -3047,322 +3207,267 @@ This option also accepts a map of PHP errors to log levels: http://symfony.com/schema/dic/symfony https://symfony.com/schema/dic/symfony/symfony-1.0.xsd"> - - - - + .. code-block:: php // config/packages/framework.php - use Psr\Log\LogLevel; use Symfony\Config\FrameworkConfig; return static function (FrameworkConfig $framework): void { - $framework->phpErrors()->log(\E_DEPRECATED, LogLevel::ERROR); - $framework->phpErrors()->log(\E_USER_DEPRECATED, LogLevel::ERROR); - // ... + $framework->session() + ->savePath(null); }; -throw -..... - -**type**: ``boolean`` **default**: ``%kernel.debug%`` - -Throw PHP errors as ``\ErrorException`` instances. The parameter -``debug.error_handler.throw_at`` controls the threshold. - -.. _reference-cache: - -cache -~~~~~ - -.. _reference-cache-app: - -app -... - -**type**: ``string`` **default**: ``cache.adapter.filesystem`` +sid_bits_per_character +...................... -The cache adapter used by the ``cache.app`` service. The FrameworkBundle -ships with multiple adapters: ``cache.adapter.apcu``, ``cache.adapter.system``, -``cache.adapter.filesystem``, ``cache.adapter.psr6``, ``cache.adapter.redis``, -``cache.adapter.memcached``, ``cache.adapter.pdo`` and -``cache.adapter.doctrine_dbal``. +**type**: ``integer`` -There's also a special adapter called ``cache.adapter.array`` which stores -contents in memory using a PHP array and it's used to disable caching (mostly on -the ``dev`` environment). +This determines the number of bits in the encoded session ID character. The possible +values are ``4`` (0-9, a-f), ``5`` (0-9, a-v), and ``6`` (0-9, a-z, A-Z, "-", ","). +The more bits results in stronger session ID. ``5`` is recommended value for +most environments. -.. tip:: +If not set, ``php.ini``'s `session.sid_bits_per_character`_ directive will be relied on. - It might be tough to understand at the beginning, so to avoid confusion - remember that all pools perform the same actions but on different medium - given the adapter they are based on. Internally, a pool wraps the definition - of an adapter. +.. deprecated:: 7.2 -.. _reference-cache-system: + The ``sid_bits_per_character`` option was deprecated in Symfony 7.2. No alternative + is provided as PHP 8.4 has deprecated the related option. -system -...... +sid_length +.......... -**type**: ``string`` **default**: ``cache.adapter.system`` +**type**: ``integer`` -The cache adapter used by the ``cache.system`` service. It supports the same -adapters available for the ``cache.app`` service. +This determines the length of session ID string, which can be an integer between +``22`` and ``256`` (both inclusive), ``32`` being the recommended value. Longer +session IDs are harder to guess. -directory -......... +If not set, ``php.ini``'s `session.sid_length`_ directive will be relied on. -**type**: ``string`` **default**: ``%kernel.cache_dir%/pools`` +.. deprecated:: 7.2 -The path to the cache directory used by services inheriting from the -``cache.adapter.filesystem`` adapter (including ``cache.app``). + The ``sid_length`` option was deprecated in Symfony 7.2. No alternative is + provided as PHP 8.4 has deprecated the related option. -default_doctrine_provider -......................... +.. _storage_id: -**type**: ``string`` +storage_factory_id +.................. -The service name to use as your default Doctrine provider. The provider is -available as the ``cache.default_doctrine_provider`` service. +**type**: ``string`` **default**: ``session.storage.factory.native`` -default_psr6_provider -..................... +The service ID used for creating the ``SessionStorageInterface`` that stores +the session. This service is available in the Symfony application via the +``session.storage.factory`` service alias. The class has to implement +:class:`Symfony\\Component\\HttpFoundation\\Session\\Storage\\SessionStorageFactoryInterface`. +To see a list of all available storages, run: -**type**: ``string`` +.. code-block:: terminal -The service name to use as your default PSR-6 provider. It is available as -the ``cache.default_psr6_provider`` service. + $ php bin/console debug:container session.storage.factory. -default_redis_provider -...................... +use_cookies +........... -**type**: ``string`` **default**: ``redis://localhost`` +**type**: ``boolean`` -The DSN to use by the Redis provider. The provider is available as the ``cache.default_redis_provider`` -service. +This specifies if the session ID is stored on the client side using cookies or +not. -default_memcached_provider -.......................... +If not set, ``php.ini``'s `session.use_cookies`_ directive will be relied on. -**type**: ``string`` **default**: ``memcached://localhost`` +ssi +~~~ -The DSN to use by the Memcached provider. The provider is available as the ``cache.default_memcached_provider`` -service. +enabled +....... -default_pdo_provider -.................... +**type**: ``boolean`` **default**: ``false`` -**type**: ``string`` **default**: ``doctrine.dbal.default_connection`` +Whether to enable or not SSI support in your application. -The service id of the database connection, which should be either a PDO or a -Doctrine DBAL instance. The provider is available as the ``cache.default_pdo_provider`` -service. +.. _reference-framework-test: -pools -..... +test +~~~~ -**type**: ``array`` +**type**: ``boolean`` -A list of cache pools to be created by the framework extension. +If this configuration setting is present (and not ``false``), then the services +related to testing your application (e.g. ``test.client``) are loaded. This +setting should be present in your ``test`` environment (usually via +``config/packages/test/framework.yaml``). .. seealso:: - For more information about how pools work, see :ref:`cache pools `. - -To configure a Redis cache pool with a default lifetime of 1 hour, do the following: - -.. configuration-block:: - - .. code-block:: yaml - - # config/packages/framework.yaml - framework: - cache: - pools: - cache.mycache: - adapter: cache.adapter.redis - default_lifetime: 3600 - - .. code-block:: xml - - - - + For more information, see :doc:`/testing`. - - - - - - - +translator +~~~~~~~~~~ - .. code-block:: php +cache_dir +......... - // config/packages/framework.php - use Symfony\Config\FrameworkConfig; +**type**: ``string`` | ``null`` **default**: ``%kernel.cache_dir%/translations`` - return static function (FrameworkConfig $framework): void { - $framework->cache() - ->pool('cache.mycache') - ->adapters(['cache.adapter.redis']) - ->defaultLifetime(3600); - }; +Defines the directory where the translation cache is stored. Use ``null`` to +disable this cache. -.. _reference-cache-pools-name: +.. _reference-translator-default_path: -name -"""" +default_path +............ -**type**: ``prototype`` +**type**: ``string`` **default**: ``%kernel.project_dir%/translations`` -Name of the pool you want to create. +This option allows to define the path where the application translations files +are stored. -.. note:: +.. _reference-translator-enabled: - Your pool name must differ from ``cache.app`` or ``cache.system``. +enabled +....... -adapter -""""""" +**type**: ``boolean`` **default**: ``true`` or ``false`` depending on your installation -**type**: ``string`` **default**: ``cache.app`` +Whether or not to enable the ``translator`` service in the service container. -The service name of the adapter to use. You can specify one of the default -services that follow the pattern ``cache.adapter.[type]``. Alternatively you -can specify another cache pool as base, which will make this pool inherit the -settings from the base pool as defaults. +.. _fallback: -.. note:: +fallbacks +......... - Your service needs to implement the ``Psr\Cache\CacheItemPoolInterface`` interface. +**type**: ``string|array`` **default**: value of `default_locale`_ -public -"""""" +This option is used when the translation key for the current locale wasn't +found. -**type**: ``boolean`` **default**: ``false`` +.. seealso:: -Whether your service should be public or not. + For more details, see :doc:`/translation`. -tags -"""" +.. _reference-framework-translator-formatter: -**type**: ``boolean`` | ``string`` **default**: ``null`` +formatter +......... -Whether your service should be able to handle tags or not. -Can also be the service id of another cache pool where tags will be stored. +**type**: ``string`` **default**: ``translator.formatter.default`` -default_lifetime -"""""""""""""""" +The ID of the service used to format translation messages. The service class +must implement the :class:`Symfony\\Component\\Translation\\Formatter\\MessageFormatterInterface`. -**type**: ``integer`` | ``string`` +.. _reference-framework-translator-logging: -Default lifetime of your cache items. Give an integer value to set the default -lifetime in seconds. A string value could be ISO 8601 time interval, like ``"PT5M"`` -or a PHP date expression that is accepted by ``strtotime()``, like ``"5 minutes"``. +logging +....... -If no value is provided, the cache adapter will fallback to the default value on -the actual cache storage. +**default**: ``true`` when the debug mode is enabled, ``false`` otherwise. -provider -"""""""" +When ``true``, a log entry is made whenever the translator cannot find a translation +for a given key. The logs are made to the ``translation`` channel at the +``debug`` level for keys where there is a translation in the fallback +locale, and the ``warning`` level if there is no translation to use at all. -**type**: ``string`` +.. _reference-translator-paths: -Overwrite the default service name or DSN respectively, if you do not want to -use what is configured as ``default_X_provider`` under ``cache``. See the -description of the default provider setting above for information on how to -specify your specific provider. +paths +..... -clearer -""""""" +**type**: ``array`` **default**: ``[]`` -**type**: ``string`` +This option allows to define an array of paths where the component will look +for translation files. The later a path is added, the more priority it has +(translations from later paths overwrite earlier ones). Translations from the +:ref:`default_path ` have more priority than +translations from all these paths. -The cache clearer used to clear your PSR-6 cache. +.. _reference-translator-providers: -.. seealso:: +providers +......... - For more information, see :class:`Symfony\\Component\\HttpKernel\\CacheClearer\\Psr6CacheClearer`. +**type**: ``array`` **default**: ``[]`` -.. _reference-cache-prefix-seed: +This option enables and configures :ref:`translation providers ` +to push and pull your translations to/from third party translation services. -prefix_seed -........... +trust_x_sendfile_type_header +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -**type**: ``string`` **default**: ``_%kernel.project_dir%.%kernel.container_class%`` +**type**: ``boolean`` **default**: ``%env(bool:default::SYMFONY_TRUST_X_SENDFILE_TYPE_HEADER)%`` -This value is used as part of the "namespace" generated for the -cache item keys. A common practice is to use the unique name of the application -(e.g. ``symfony.com``) because that prevents naming collisions when deploying -multiple applications into the same path (on different servers) that share the -same cache backend. +.. versionadded:: 7.2 -It's also useful when using `blue/green deployment`_ strategies and more -generally, when you need to abstract out the actual deployment directory (for -example, when warming caches offline). + In Symfony 7.2, the default value of this option was changed from ``false`` to the + value stored in the ``SYMFONY_TRUST_X_SENDFILE_TYPE_HEADER`` environment variable. -.. note:: +``X-Sendfile`` is a special HTTP header that tells web servers to replace the +response contents by the file that is defined in that header. This improves +performance because files are no longer served by your application but directly +by the web server. - The ``prefix_seed`` option is used at compile time. This means - that any change made to this value after container's compilation - will have no effect. +This configuration option determines whether to trust ``x-sendfile`` header for +BinaryFileResponse. If enabled, Symfony calls the +:method:`BinaryFileResponse::trustXSendfileTypeHeader ` +method automatically. It becomes the service container parameter named +``kernel.trust_x_sendfile_type_header``. -.. _reference-lock: +.. _reference-framework-trusted-headers: -lock -~~~~ +trusted_headers +~~~~~~~~~~~~~~~ -**type**: ``string`` | ``array`` +The ``trusted_headers`` option is needed to configure which client information +should be trusted (e.g. their host) when running Symfony behind a load balancer +or a reverse proxy. See :doc:`/deployment/proxies`. -The default lock adapter. If not defined, the value is set to ``semaphore`` when -available, or to ``flock`` otherwise. Store's DSN are also allowed. +.. _configuration-framework-trusted-hosts: -.. _reference-lock-enabled: +trusted_hosts +~~~~~~~~~~~~~ -enabled -....... +**type**: ``array`` | ``string`` **default**: ``['%env(default::SYMFONY_TRUSTED_HOSTS)%']`` -**type**: ``boolean`` **default**: ``true`` +.. versionadded:: 7.2 -Whether to enable the support for lock or not. This setting is -automatically set to ``true`` when one of the child settings is configured. + In Symfony 7.2, the default value of this option was changed from ``[]`` to the + value stored in the ``SYMFONY_TRUSTED_HOSTS`` environment variable. -.. _reference-lock-resources: +A lot of different attacks have been discovered relying on inconsistencies +in handling the ``Host`` header by various software (web servers, reverse +proxies, web frameworks, etc.). Basically, every time the framework is +generating an absolute URL (when sending an email to reset a password for +instance), the host might have been manipulated by an attacker. -resources -......... +.. seealso:: -**type**: ``array`` + You can read `HTTP Host header attacks`_ for more information about + these kinds of attacks. -A map of lock stores to be created by the framework extension, with -the name as key and DSN as value: +The Symfony :method:`Request::getHost() ` +method might be vulnerable to some of these attacks because it depends on +the configuration of your web server. One simple solution to avoid these +attacks is to configure a list of hosts that your Symfony application can respond +to. That's the purpose of this ``trusted_hosts`` option. If the incoming +request's hostname doesn't match one of the regular expressions in this list, +the application won't respond and the user will receive a 400 response. .. configuration-block:: .. code-block:: yaml - # config/packages/lock.yaml + # config/packages/framework.yaml framework: - lock: '%env(LOCK_DSN)%' + trusted_hosts: ['^example\.com$', '^example\.org$'] .. code-block:: xml - + - - %env(LOCK_DSN)% - + ^example\.com$ + ^example\.org$ + .. code-block:: php - // config/packages/lock.php + // config/packages/framework.php use Symfony\Config\FrameworkConfig; return static function (FrameworkConfig $framework): void { - $framework->lock() - ->resource('default', [env('LOCK_DSN')]); + $framework->trustedHosts(['^example\.com$', '^example\.org$']); }; -.. seealso:: - - For more details, see :doc:`/lock`. - -.. _reference-lock-resources-name: +Hosts can also be configured to respond to any subdomain, via +``^(.+\.)?example\.com$`` for instance. -name -"""" +In addition, you can also set the trusted hosts in the front controller +using the ``Request::setTrustedHosts()`` method:: -**type**: ``prototype`` + // public/index.php + Request::setTrustedHosts(['^(.+\.)?example\.com$', '^(.+\.)?example\.org$']); -Name of the lock you want to create. +The default value for this option is an empty array, meaning that the application +can respond to any given host. -semaphore -~~~~~~~~~ +.. seealso:: -**type**: ``string`` | ``array`` + Read more about this in the `Security Advisory Blog post`_. -The default semaphore adapter. Store's DSN are also allowed. +.. _reference-framework-trusted-proxies: -.. _reference-semaphore-enabled: +trusted_proxies +~~~~~~~~~~~~~~~ -enabled -....... +The ``trusted_proxies`` option is needed to get precise information about the +client (e.g. their IP address) when running Symfony behind a load balancer or a +reverse proxy. See :doc:`/deployment/proxies`. -**type**: ``boolean`` **default**: ``true`` +.. _reference-validation: -Whether to enable the support for semaphore or not. This setting is -automatically set to ``true`` when one of the child settings is configured. +validation +~~~~~~~~~~ -.. _reference-semaphore-resources: +.. _reference-validation-auto-mapping: -resources -......... +auto_mapping +............ -**type**: ``array`` +**type**: ``array`` **default**: ``[]`` -A map of semaphore stores to be created by the framework extension, with -the name as key and DSN as value: +Defines the Doctrine entities that will be introspected to add +:ref:`automatic validation constraints ` to them: .. configuration-block:: .. code-block:: yaml - # config/packages/semaphore.yaml framework: - semaphore: '%env(SEMAPHORE_DSN)%' + validation: + auto_mapping: + # an empty array means that all entities that belong to that + # namespace will add automatic validation + 'App\Entity\': [] + 'Foo\': ['Foo\Some\Entity', 'Foo\Another\Entity'] .. code-block:: xml - + - - %env(SEMAPHORE_DSN)% - + + + + + Foo\Some\Entity + Foo\Another\Entity + + .. code-block:: php - // config/packages/semaphore.php + // config/packages/framework.php use Symfony\Config\FrameworkConfig; return static function (FrameworkConfig $framework): void { - $framework->semaphore() - ->resource('default', ['%env(SEMAPHORE_DSN)%']); + $framework->validation() + ->autoMapping() + ->paths([ + 'App\\Entity\\' => [], + 'Foo\\' => ['Foo\\Some\\Entity', 'Foo\\Another\\Entity'], + ]); }; -.. _reference-semaphore-resources-name: - -name -"""" - -**type**: ``prototype`` - -Name of the semaphore you want to create. +.. _reference-validation-email_validation_mode: -mailer -~~~~~~ +email_validation_mode +..................... -.. _mailer-dsn: +**type**: ``string`` **default**: ``html5`` -dsn -... +Sets the default value for the +:ref:`"mode" option of the Email validator `. -**type**: ``string`` **default**: ``null`` +.. _reference-validation-enable_annotations: -The DSN used by the mailer. When several DSN may be used, use -``transports`` option (see below) instead. +enable_attributes +................. -transports -.......... +**type**: ``boolean`` **default**: ``true`` -**type**: ``array`` +If this option is enabled, validation constraints can be defined using `PHP attributes`_. -A :ref:`list of DSN ` that can be used by the -mailer. A transport name is the key and the dsn is the value. +.. _reference-validation-enabled: -message_bus -........... +enabled +....... -**type**: ``string`` **default**: ``null`` or default bus if Messenger component is installed +**type**: ``boolean`` **default**: ``true`` or ``false`` depending on your installation -Service identifier of the message bus to use when using the -:doc:`Messenger component ` (e.g. ``messenger.default_bus``). +Whether or not to enable validation support. -envelope -........ +This option will automatically be set to ``true`` when one of the child +settings is configured. -sender -"""""" +.. _reference-validation-mapping: -**type**: ``string`` +mapping +....... -The "envelope sender" which is used as the value of ``MAIL FROM`` during the -`SMTP session`_. This value overrides any other sender set in the code. +.. _reference-validation-mapping-paths: -recipients -"""""""""" +paths +""""" -**type**: ``array`` +**type**: ``array`` **default**: ``['config/validation/']`` -The "envelope recipient" which is used as the value of ``RCPT TO`` during the -the `SMTP session`_. This value overrides any other recipient set in the code. +This option allows to define an array of paths with files or directories where +the component will look for additional validation files: .. configuration-block:: .. code-block:: yaml - # config/packages/mailer.yaml + # config/packages/framework.yaml framework: - mailer: - dsn: 'smtp://localhost:25' - envelope: - recipients: ['admin@symfony.com', 'lead@symfony.com'] + validation: + mapping: + paths: + - "%kernel.project_dir%/config/validation/" .. code-block:: xml - + + - - - admin@symfony.com - lead@symfony.com - - + + + %kernel.project_dir%/config/validation/ + + .. code-block:: php - // config/packages/mailer.php - namespace Symfony\Component\DependencyInjection\Loader\Configurator; + // config/packages/framework.php + use Symfony\Config\FrameworkConfig; - return static function (ContainerConfigurator $container): void { - $container->extension('framework', [ - 'mailer' => [ - 'dsn' => 'smtp://localhost:25', - 'envelope' => [ - 'recipients' => [ - 'admin@symfony.com', - 'lead@symfony.com', - ], - ], - ], - ]); + return static function (FrameworkConfig $framework): void { + $framework->validation() + ->mapping() + ->paths(['%kernel.project_dir%/config/validation/']); }; -.. _mailer-headers: +.. _reference-validation-not-compromised-password: -headers -....... +not_compromised_password +........................ -**type**: ``array`` +The :doc:`NotCompromisedPassword ` +constraint makes HTTP requests to a public API to check if the given password +has been compromised in a data breach. -Headers to add to emails. The key (``name`` attribute in xml format) is the -header name and value the header value. +static_method +............. -.. seealso:: +**type**: ``string | array`` **default**: ``['loadValidatorMetadata']`` - For more information, see :ref:`Configuring Emails Globally ` +Defines the name of the static method which is called to load the validation +metadata of the class. You can define an array of strings with the names of +several methods. In that case, all of them will be called in that order to load +the metadata. -messenger -~~~~~~~~~ +translation_domain +.................. + +**type**: ``string | false`` **default**: ``validators`` + +The translation domain that is used when translating validation constraint +error messages. Use false to disable translations. + + +.. _reference-validation-not-compromised-password-enabled: enabled -....... +""""""" **type**: ``boolean`` **default**: ``true`` -Whether to enable or not Messenger. +If you set this option to ``false``, no HTTP requests will be made and the given +password will be considered valid. This is useful when you don't want or can't +make HTTP requests, such as in ``dev`` and ``test`` environments or in +continuous integration servers. -.. seealso:: +endpoint +"""""""" - For more details, see the :doc:`Messenger component ` - documentation. +**type**: ``string`` **default**: ``null`` + +By default, the :doc:`NotCompromisedPassword ` +constraint uses the public API provided by `haveibeenpwned.com`_. This option +allows to define a different, but compatible, API endpoint to make the password +checks. It's useful for example when the Symfony application is run in an +intranet without public access to the internet. web_link ~~~~~~~~ @@ -3770,125 +3890,6 @@ Defines the kind of workflow that is going to be created, which can be either a normal workflow or a state machine. Read :doc:`this article ` to know their differences. -.. _framework_exceptions: - -exceptions -~~~~~~~~~~ - -**type**: ``array`` - -Defines the :ref:`log level ` and HTTP status code applied to the -exceptions that match the given exception class: - -.. configuration-block:: - - .. code-block:: yaml - - # config/packages/exceptions.yaml - framework: - exceptions: - Symfony\Component\HttpKernel\Exception\BadRequestHttpException: - log_level: 'debug' - status_code: 422 - - .. code-block:: xml - - - - - - - - - - - - .. code-block:: php - - // config/packages/exceptions.php - use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; - use Symfony\Config\FrameworkConfig; - - return static function (FrameworkConfig $framework): void { - $framework->exception(BadRequestHttpException::class) - ->logLevel('debug') - ->statusCode(422) - ; - }; - -The order in which you configure exceptions is important because Symfony will -use the configuration of the first exception that matches ``instanceof``: - -.. code-block:: yaml - - # config/packages/exceptions.yaml - framework: - exceptions: - Exception: - log_level: 'debug' - status_code: 404 - # The following configuration will never be used because \RuntimeException extends \Exception - RuntimeException: - log_level: 'debug' - status_code: 422 - -You can map a status code and a set of headers to an exception thanks -to the ``#[WithHttpStatus]`` attribute on the exception class:: - - namespace App\Exception; - - use Symfony\Component\HttpKernel\Attribute\WithHttpStatus; - - #[WithHttpStatus(422, [ - 'Retry-After' => 10, - 'X-Custom-Header' => 'header-value', - ])] - class CustomException extends \Exception - { - } - -It is also possible to map a log level on a custom exception class using -the ``#[WithLogLevel]`` attribute:: - - namespace App\Exception; - - use Psr\Log\LogLevel; - use Symfony\Component\HttpKernel\Attribute\WithLogLevel; - - #[WithLogLevel(LogLevel::WARNING)] - class CustomException extends \Exception - { - } - -The attributes can also be added to interfaces directly:: - - namespace App\Exception; - - use Symfony\Component\HttpKernel\Attribute\WithHttpStatus; - - #[WithHttpStatus(422)] - interface CustomExceptionInterface - { - } - - class CustomException extends \Exception implements CustomExceptionInterface - { - } - -.. versionadded:: 7.1 - - Support to use ``#[WithHttpStatus]`` and ``#[WithLogLevel]`` attributes - on interfaces was introduced in Symfony 7.1. - .. _`HTTP Host header attacks`: https://www.skeletonscribe.net/2013/05/practical-http-host-header-attacks.html .. _`Security Advisory Blog post`: https://symfony.com/blog/security-releases-symfony-2-0-24-2-1-12-2-2-5-and-2-3-3-released#cve-2013-4752-request-gethost-poisoning .. _`phpstorm-url-handler`: https://github.com/sanduhrs/phpstorm-url-handler From 7c70485deecc094e84dc36d99f4eb86fc1e8fff3 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Mon, 24 Feb 2025 16:33:11 +0100 Subject: [PATCH 458/477] [Messenger] Fix some syntax issue --- messenger.rst | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/messenger.rst b/messenger.rst index e4f4abf60eb..d76e2170c09 100644 --- a/messenger.rst +++ b/messenger.rst @@ -543,14 +543,19 @@ command with the ``--all`` option: The ``--all`` option was introduced in Symfony 7.1. -The ``--keepalive`` option can be used to prevent messages from being prematurely -redelivered during long-running processing. It marks the message as "in progress" -and prevents it from being redelivered until the worker finishes processing it. +Messages that take a long time to process may be redelivered prematurely because +some transports assume that an unacknowledged message is lost. To prevent this +issue, use the ``--keepalive`` command option to specify an interval (in seconds; +default value = ``5``) at which the message is marked as "in progress". This prevents +the message from being redelivered until the worker completes processing it: + +.. code-block:: terminal + + $ php bin/console messenger:consume --keepalive .. note:: - This option is only available for supported transports, which are - the Beanstalkd and AmazonSQS transports. + This option is only available for the following transports: Beanstalkd and AmazonSQS. .. versionadded:: 7.2 @@ -1724,10 +1729,6 @@ The transport has a number of options: The message time to run before it is put back in the ready queue - in seconds. -.. versionadded:: 7.2 - - Keepalive support, using the ``--keepalive`` option, was added in Symfony 7.2. - .. _messenger-redis-transport: Redis Transport @@ -2050,10 +2051,6 @@ The transport has a number of options: FIFO queues don't support setting a delay per message, a value of ``delay: 0`` is required in the retry strategy settings. -.. versionadded:: 7.2 - - Keepalive support, using the `--keepalive` option, was added in Symfony 7.2. - Serializing Messages ~~~~~~~~~~~~~~~~~~~~ From d49a86aba3ab1fc59ff58e98b50a7f6df318df23 Mon Sep 17 00:00:00 2001 From: HypeMC Date: Sat, 8 Mar 2025 21:34:23 +0100 Subject: [PATCH 459/477] [Messenger] Clarify keepalive implementation for each transport --- messenger.rst | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/messenger.rst b/messenger.rst index d76e2170c09..9a5f7017097 100644 --- a/messenger.rst +++ b/messenger.rst @@ -1729,6 +1729,13 @@ The transport has a number of options: The message time to run before it is put back in the ready queue - in seconds. +The Beanstalkd transport supports the ``--keepalive`` option by using Beanstalkd's +``touch`` command to periodically reset the job's ``ttr``. + +.. versionadded:: 7.2 + + Keepalive support was introduced in Symfony 7.2. + .. _messenger-redis-transport: Redis Transport @@ -2051,6 +2058,13 @@ The transport has a number of options: FIFO queues don't support setting a delay per message, a value of ``delay: 0`` is required in the retry strategy settings. +The SQS transport supports the ``--keepalive`` option by using the ``ChangeMessageVisibility`` +action to periodically update the ``VisibilityTimeout`` of the message. + +.. versionadded:: 7.2 + + Keepalive support was introduced in Symfony 7.2. + Serializing Messages ~~~~~~~~~~~~~~~~~~~~ From 8b245b252fe6fd1088ea4dfe106b39786359758e Mon Sep 17 00:00:00 2001 From: HypeMC Date: Sat, 8 Mar 2025 23:32:42 +0100 Subject: [PATCH 460/477] [FrameworkBundle] Using existing services as lock/semaphore resources --- lock.rst | 8 ++++++++ reference/configuration/framework.rst | 7 ++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/lock.rst b/lock.rst index 82ec48db572..1f149466216 100644 --- a/lock.rst +++ b/lock.rst @@ -62,6 +62,8 @@ this behavior by using the ``lock`` key like: lock: 'oci:host=127.0.0.1;dbname=app' lock: 'mongodb://127.0.0.1/app?collection=lock' lock: '%env(LOCK_DSN)%' + # using an existing service + lock: 'snc_redis.default' # named locks lock: @@ -119,6 +121,9 @@ this behavior by using the ``lock`` key like: %env(LOCK_DSN)% + + snc_redis.default + semaphore redis://r2.docker @@ -130,6 +135,7 @@ this behavior by using the ``lock`` key like: .. code-block:: php // config/packages/lock.php + use function Symfony\Component\DependencyInjection\Loader\Configurator\env; use Symfony\Config\FrameworkConfig; return static function (FrameworkConfig $framework): void { @@ -152,6 +158,8 @@ this behavior by using the ``lock`` key like: ->resource('default', ['oci:host=127.0.0.1;dbname=app']) ->resource('default', ['mongodb://127.0.0.1/app?collection=lock']) ->resource('default', [env('LOCK_DSN')]) + // using an existing service + ->resource('default', ['snc_redis.default']) // named locks ->resource('invoice', ['semaphore', 'redis://r2.docker']) diff --git a/reference/configuration/framework.rst b/reference/configuration/framework.rst index 0334b918c66..f6a275067dc 100644 --- a/reference/configuration/framework.rst +++ b/reference/configuration/framework.rst @@ -2048,7 +2048,7 @@ resources **type**: ``array`` A map of lock stores to be created by the framework extension, with -the name as key and DSN as value: +the name as key and DSN or service id as value: .. configuration-block:: @@ -2725,7 +2725,7 @@ resources **type**: ``array`` A map of semaphore stores to be created by the framework extension, with -the name as key and DSN as value: +the name as key and DSN or service id as value: .. configuration-block:: @@ -2756,11 +2756,12 @@ the name as key and DSN as value: .. code-block:: php // config/packages/semaphore.php + use function Symfony\Component\DependencyInjection\Loader\Configurator\env; use Symfony\Config\FrameworkConfig; return static function (FrameworkConfig $framework): void { $framework->semaphore() - ->resource('default', ['%env(SEMAPHORE_DSN)%']); + ->resource('default', [env('SEMAPHORE_DSN')]); }; .. _reference-semaphore-resources-name: From 16a923591094502c41be1fdd742bf20baf3c7ebf Mon Sep 17 00:00:00 2001 From: "Cadot.eu & Co." <97225403+cadot-eu@users.noreply.github.com> Date: Sun, 9 Mar 2025 14:37:35 +0100 Subject: [PATCH 461/477] Error: Undefined Variable $texter The variable $texter is not defined inside the method, so PHP will throw an "Undefined variable" error. --- notifier.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/notifier.rst b/notifier.rst index 2382dfee284..d2dc225f4f0 100644 --- a/notifier.rst +++ b/notifier.rst @@ -759,7 +759,7 @@ Now you can send notifications to your desktop as follows:: sprintf('%s is a new subscriber', $user->getFullName()) ); - $texter->send($message); + $this->texter->send($message); } } From 9f396ee8cca51673b9a4b049c4709040431aedfe Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Mon, 10 Mar 2025 09:40:43 +0100 Subject: [PATCH 462/477] Added the missing versionadded directive --- lock.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lock.rst b/lock.rst index 1f149466216..d9d57481f3d 100644 --- a/lock.rst +++ b/lock.rst @@ -167,6 +167,10 @@ this behavior by using the ``lock`` key like: ; }; +.. versionadded:: 7.2 + + The option to use an existing service as the lock/semaphore was introduced in Symfony 7.2. + Locking a Resource ------------------ From 26c429efc1e8c4c5d0e3a6bb48c027f9b14bce26 Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Mon, 10 Mar 2025 17:54:29 +0100 Subject: [PATCH 463/477] Fix build --- serializer/encoders.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/serializer/encoders.rst b/serializer/encoders.rst index d5a98356156..a11daaa7bad 100644 --- a/serializer/encoders.rst +++ b/serializer/encoders.rst @@ -202,7 +202,7 @@ These are the options available on the :ref:`serializer context ``, ``&``) in `a CDATA section`_ like following: ````. -``cdata_wrapping_pattern`` (default: ````/[<>&]/````) +``cdata_wrapping_pattern`` (default: ``/[<>&]/``) A regular expression pattern to determine if a value should be wrapped in a CDATA section. From d51154b75f4e8934d4997f06a0f1e18de6871a8c Mon Sep 17 00:00:00 2001 From: HypeMC Date: Mon, 17 Mar 2025 01:27:35 +0100 Subject: [PATCH 464/477] [Serializer] Fix `defaultContext` example --- serializer.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/serializer.rst b/serializer.rst index d541310aa15..cd181787763 100644 --- a/serializer.rst +++ b/serializer.rst @@ -344,7 +344,7 @@ instance to disallow extra fields while deserializing: return static function (FrameworkConfig $framework): void { $framework->serializer() - ->defaultContext('', [ + ->defaultContext([ 'allow_extra_attributes' => false, ]) ; From 4213bb57c7f139451d8df44c1f6a91d07559ec5f Mon Sep 17 00:00:00 2001 From: Antoine Lamirault Date: Tue, 18 Mar 2025 22:26:31 +0100 Subject: [PATCH 465/477] [Serializer] Add SnakeCaseToCamelCaseNameConverter --- serializer.rst | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/serializer.rst b/serializer.rst index cd181787763..bd8506cbbe3 100644 --- a/serializer.rst +++ b/serializer.rst @@ -1239,6 +1239,67 @@ setting the ``name_converter`` setting to ]; $serializer = new Serializer($normalizers, $encoders); +snake_case to CamelCase +~~~~~~~~~~~~~~~~~~~~~~~ + +In Symfony applications is common to use camelCase to name properties. However +some packages can use snake_case as convention. + +Symfony provides a built-in name converter designed to transform between +CamelCase and snake_cased styles during serialization and deserialization +processes. You can use it instead of the metadata aware name converter by +setting the ``name_converter`` setting to +``serializer.name_converter.snake_case_to_camel_case``: + +.. configuration-block:: + + .. code-block:: yaml + + # config/packages/serializer.yaml + framework: + serializer: + name_converter: 'serializer.name_converter.snake_case_to_camel_case' + + .. code-block:: xml + + + + + + + + + + + .. code-block:: php + + // config/packages/serializer.php + use Symfony\Config\FrameworkConfig; + + return static function (FrameworkConfig $framework): void { + $framework->serializer() + ->nameConverter('serializer.name_converter.snake_case_to_camel_case') + ; + }; + + .. code-block:: php-standalone + + use Symfony\Component\Serializer\NameConverter\SnakeCaseToCamelCaseNameConverter; + use Symfony\Component\Serializer\Normalizer\ObjectNormalizer; + + // ... + $normalizers = [ + new ObjectNormalizer(null, new SnakeCaseToCamelCaseNameConverter()), + ]; + $serializer = new Serializer($normalizers, $encoders); + .. _serializer-built-in-normalizers: Serializer Normalizers From 020ef3a702bb8b173d164d40d73626dc449d559a Mon Sep 17 00:00:00 2001 From: Antoine Lamirault Date: Tue, 18 Mar 2025 22:56:19 +0100 Subject: [PATCH 466/477] Replace TaggedIterator and TaggedLocator by Au*towireIterator and AutowireLocator --- .../service_subscribers_locators.rst | 20 +++++++++---------- service_container/tags.rst | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/service_container/service_subscribers_locators.rst b/service_container/service_subscribers_locators.rst index 9c6451931d1..a2aabb48901 100644 --- a/service_container/service_subscribers_locators.rst +++ b/service_container/service_subscribers_locators.rst @@ -270,8 +270,8 @@ the following dependency injection attributes in the ``getSubscribedServices()`` method directly: * :class:`Symfony\\Component\\DependencyInjection\\Attribute\\Autowire` -* :class:`Symfony\\Component\\DependencyInjection\\Attribute\\TaggedIterator` -* :class:`Symfony\\Component\\DependencyInjection\\Attribute\\TaggedLocator` +* :class:`Symfony\\Component\\DependencyInjection\\Attribute\\AutowireIterator` +* :class:`Symfony\\Component\\DependencyInjection\\Attribute\\AutowireLocator` * :class:`Symfony\\Component\\DependencyInjection\\Attribute\\Target` * :class:`Symfony\\Component\\DependencyInjection\\Attribute\\AutowireDecorated` @@ -282,8 +282,8 @@ This is done by having ``getSubscribedServices()`` return an array of use Psr\Container\ContainerInterface; use Psr\Log\LoggerInterface; use Symfony\Component\DependencyInjection\Attribute\Autowire; - use Symfony\Component\DependencyInjection\Attribute\TaggedIterator; - use Symfony\Component\DependencyInjection\Attribute\TaggedLocator; + use Symfony\Component\DependencyInjection\Attribute\AutowireIterator; + use Symfony\Component\DependencyInjection\Attribute\AutowireLocator; use Symfony\Component\DependencyInjection\Attribute\Target; use Symfony\Contracts\Service\Attribute\SubscribedService; @@ -299,11 +299,11 @@ This is done by having ``getSubscribedServices()`` return an array of // Target new SubscribedService('event.logger', LoggerInterface::class, attributes: new Target('eventLogger')), - // TaggedIterator - new SubscribedService('loggers', 'iterable', attributes: new TaggedIterator('logger.tag')), + // AutowireIterator + new SubscribedService('loggers', 'iterable', attributes: new AutowireIterator('logger.tag')), - // TaggedLocator - new SubscribedService('handlers', ContainerInterface::class, attributes: new TaggedLocator('handler.tag')), + // AutowireLocator + new SubscribedService('handlers', ContainerInterface::class, attributes: new AutowireLocator('handler.tag')), ]; } @@ -975,8 +975,8 @@ You can use the ``attributes`` argument of ``SubscribedService`` to add any of the following dependency injection attributes: * :class:`Symfony\\Component\\DependencyInjection\\Attribute\\Autowire` -* :class:`Symfony\\Component\\DependencyInjection\\Attribute\\TaggedIterator` -* :class:`Symfony\\Component\\DependencyInjection\\Attribute\\TaggedLocator` +* :class:`Symfony\\Component\\DependencyInjection\\Attribute\\AutowireIterator` +* :class:`Symfony\\Component\\DependencyInjection\\Attribute\\AutowireLocator` * :class:`Symfony\\Component\\DependencyInjection\\Attribute\\Target` * :class:`Symfony\\Component\\DependencyInjection\\Attribute\\AutowireDecorated` diff --git a/service_container/tags.rst b/service_container/tags.rst index 270d6702f5a..39262fa51be 100644 --- a/service_container/tags.rst +++ b/service_container/tags.rst @@ -750,7 +750,7 @@ directly via PHP attributes: .. note:: - Some IDEs will show an error when using ``#[TaggedIterator]`` together + Some IDEs will show an error when using ``#[AutowireIterator]`` together with the `PHP constructor promotion`_: *"Attribute cannot be applied to a property because it does not contain the 'Attribute::TARGET_PROPERTY' flag"*. The reason is that those constructor arguments are both parameters and class From 10565283d5234c46b8ed4510d79d2d75310b2f9c Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 19 Mar 2025 08:35:26 +0100 Subject: [PATCH 467/477] Tweaks --- serializer.rst | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/serializer.rst b/serializer.rst index bd8506cbbe3..54555d7b340 100644 --- a/serializer.rst +++ b/serializer.rst @@ -1242,12 +1242,12 @@ setting the ``name_converter`` setting to snake_case to CamelCase ~~~~~~~~~~~~~~~~~~~~~~~ -In Symfony applications is common to use camelCase to name properties. However -some packages can use snake_case as convention. +In Symfony applications, it is common to use camelCase for naming properties. +However some packages may follow a snake_case convention. Symfony provides a built-in name converter designed to transform between -CamelCase and snake_cased styles during serialization and deserialization -processes. You can use it instead of the metadata aware name converter by +CamelCase and snake_case styles during serialization and deserialization +processes. You can use it instead of the metadata-aware name converter by setting the ``name_converter`` setting to ``serializer.name_converter.snake_case_to_camel_case``: @@ -1300,6 +1300,10 @@ setting the ``name_converter`` setting to ]; $serializer = new Serializer($normalizers, $encoders); +.. versionadded:: 7.2 + + The snake_case to CamelCase converter was introduced in Symfony 7.2. + .. _serializer-built-in-normalizers: Serializer Normalizers From 1b09d4c56c5d47cc928a49c249c5abc97457b282 Mon Sep 17 00:00:00 2001 From: HypeMC Date: Wed, 19 Mar 2025 01:49:32 +0100 Subject: [PATCH 468/477] [Serializer] Document named serializers --- serializer.rst | 249 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 249 insertions(+) diff --git a/serializer.rst b/serializer.rst index 605946956ac..5f9144abae0 100644 --- a/serializer.rst +++ b/serializer.rst @@ -1537,6 +1537,255 @@ like: PropertyNormalizer::NORMALIZE_VISIBILITY => PropertyNormalizer::NORMALIZE_PUBLIC | PropertyNormalizer::NORMALIZE_PROTECTED, ]); +Named Serializers +----------------- + +.. versionadded:: 7.2 + + Named serializers were introduced in Symfony 7.2. + +Sometimes, you may need multiple configurations for the serializer, such +as different default contexts, name converters, or sets of normalizers and +encoders, depending on the use case. For example, when your application +communicates with multiple APIs, each with its own set of rules. + +This can be achieved by configuring multiple instances of the serializer +using the ``named_serializers`` option: + +.. configuration-block:: + + .. code-block:: yaml + + # config/packages/serializer.yaml + framework: + serializer: + named_serializers: + api_client1: + name_converter: 'serializer.name_converter.camel_case_to_snake_case' + default_context: + enable_max_depth: true + api_client2: + default_context: + enable_max_depth: false + + .. code-block:: xml + + + + + + + + + + + true + + + + + + false + + + + + + + + .. code-block:: php + + // config/packages/serializer.php + use Symfony\Config\FrameworkConfig; + + return static function (FrameworkConfig $framework): void { + $framework->serializer() + ->namedSerializer('api_client1') + ->nameConverter('serializer.name_converter.camel_case_to_snake_case') + ->defaultContext([ + 'enable_max_depth' => true, + ]) + ; + $framework->serializer() + ->namedSerializer('api_client2') + ->defaultContext([ + 'enable_max_depth' => false, + ]) + ; + }; + +You can inject these different serializer instances +using :ref:`named aliases `:: + + namespace App\Controller; + + // ... + use Symfony\Component\DependencyInjection\Attribute\Target; + + class PersonController extends AbstractController + { + public function index( + SerializerInterface $serializer, // Default serializer + SerializerInterface $apiClient1Serializer, // api_client1 serializer + #[Target('apiClient2.serializer')] // api_client2 serializer + SerializerInterface $customName, + ) { + // ... + } + } + +Named serializers are configured with the default set of normalizers and encoders. + +You can register additional normalizers and encoders with a specific named +serializer by adding a ``serializer`` attribute to +the :ref:`serializer.normalizer ` +or :ref:`serializer.encoder ` tags: + +.. configuration-block:: + + .. code-block:: yaml + + # config/services.yaml + services: + # ... + + Symfony\Component\Serializer\Normalizer\CustomNormalizer: + # Prevent this normalizer from automatically being included in the default serializer + autoconfigure: false + tags: + # Include this normalizer in a single serializer + - serializer.normalizer: { serializer: 'api_client1' } + # Include this normalizer in multiple serializers + - serializer.normalizer: { serializer: [ 'api_client1', 'api_client2' ] } + # Include this normalizer in all serializers (including the default one) + - serializer.normalizer: { serializer: '*' } + + .. code-block:: xml + + + + + + + + + + + + + + + + + + + + + + + + + .. code-block:: php + + // config/services.php + namespace Symfony\Component\DependencyInjection\Loader\Configurator; + + use Symfony\Component\Serializer\Normalizer\CustomNormalizer; + + return function(ContainerConfigurator $container) { + // ... + + $services->set(CustomNormalizer::class) + // Prevent this normalizer from automatically being included in the default serializer + ->autoconfigure(false) + + // Include this normalizer in a single serializer + ->tag('serializer.normalizer', ['serializer' => 'api_client1']) + // Include this normalizer in multiple serializers + ->tag('serializer.normalizer', ['serializer' => ['api_client1', 'api_client2']]) + // Include this normalizer in all serializers (including the default one) + ->tag('serializer.normalizer', ['serializer' => '*']) + ; + }; + +When the ``serializer`` attribute is not set, the service is registered with +the default serializer. + +Each normalizer and encoder used in a named serializer is tagged with +a ``serializer.normalizer.`` or ``serializer.encoder.`` tag, +which can be used to list their priorities using the following command: + +.. code-block:: terminal + + $ php bin/console debug:container --tag serializer.. + +Additionally, you can exclude the default set of normalizers and encoders by +setting the ``include_built_in_normalizers`` and ``include_built_in_encoders`` +options to ``false``: + +.. configuration-block:: + + .. code-block:: yaml + + # config/packages/serializer.yaml + framework: + serializer: + named_serializers: + api_client1: + include_built_in_normalizers: false + include_built_in_encoders: true + + .. code-block:: xml + + + + + + + + + + + + + + + .. code-block:: php + + // config/packages/serializer.php + use Symfony\Config\FrameworkConfig; + + return static function (FrameworkConfig $framework): void { + $framework->serializer() + ->namedSerializer('api_client1') + ->includeBuiltInNormalizers(false) + ->includeBuiltInEncoders(true) + ; + }; + Debugging the Serializer ------------------------ From 005ad0266ce29494e1fa89df0b5fdb3596fb459f Mon Sep 17 00:00:00 2001 From: MrYamous Date: Fri, 21 Mar 2025 07:01:55 +0100 Subject: [PATCH 469/477] refer TypeFactoryTrait to github file --- components/type_info.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/type_info.rst b/components/type_info.rst index 2a92a3db63e..3d1aa569fec 100644 --- a/components/type_info.rst +++ b/components/type_info.rst @@ -37,8 +37,8 @@ to the :class:`Symfony\\Component\\TypeInfo\\Type` static methods as following:: Type::list(Type::bool()); Type::intersection(Type::object(\Stringable::class), Type::object(\Iterator::class)); - // Many others are available and can be - // found in Symfony\Component\TypeInfo\TypeFactoryTrait +Many others methods are available and can be found +in :class:`Symfony\\Component\\TypeInfo\\TypeFactoryTrait`. Resolvers ~~~~~~~~~ From 78eaf0d0715259cdc4c212b277861296ba552c0e Mon Sep 17 00:00:00 2001 From: Lucas Mlsna Date: Sat, 22 Mar 2025 23:33:16 -0500 Subject: [PATCH 470/477] Update micro_kernel_trait.rst Yielded classes in registerBundles() function example code require "new" keyword to work. Also removed getLogDir() and getCacheDir() functions in example code (these functions are already defined in an identical way by the parent class). --- configuration/micro_kernel_trait.rst | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/configuration/micro_kernel_trait.rst b/configuration/micro_kernel_trait.rst index 62e8c2d4128..dbe8d1b27b9 100644 --- a/configuration/micro_kernel_trait.rst +++ b/configuration/micro_kernel_trait.rst @@ -260,11 +260,11 @@ Now it looks like this:: public function registerBundles(): iterable { - yield FrameworkBundle(); - yield TwigBundle(); + yield new FrameworkBundle(); + yield new TwigBundle(); if ('dev' === $this->getEnvironment()) { - yield WebProfilerBundle(); + yield new WebProfilerBundle(); } } @@ -305,18 +305,6 @@ Now it looks like this:: // (use 'annotation' as the second argument if you define routes as annotations) $routes->import(__DIR__.'/Controller/', 'attribute'); } - - // optional, to use the standard Symfony cache directory - public function getCacheDir(): string - { - return __DIR__.'/../var/cache/'.$this->getEnvironment(); - } - - // optional, to use the standard Symfony logs directory - public function getLogDir(): string - { - return __DIR__.'/../var/log'; - } } Before continuing, run this command to add support for the new dependencies: From b67e277663beeb002583b470cd01670d4292621c Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Mon, 24 Mar 2025 09:19:44 +0100 Subject: [PATCH 471/477] Minor tweak --- configuration/micro_kernel_trait.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/configuration/micro_kernel_trait.rst b/configuration/micro_kernel_trait.rst index dbe8d1b27b9..f919b1f7a74 100644 --- a/configuration/micro_kernel_trait.rst +++ b/configuration/micro_kernel_trait.rst @@ -305,6 +305,9 @@ Now it looks like this:: // (use 'annotation' as the second argument if you define routes as annotations) $routes->import(__DIR__.'/Controller/', 'attribute'); } + + // optionally, you can define the getCacheDir() and getLogDir() methods + // to override the default locations for these directories } Before continuing, run this command to add support for the new dependencies: From bffad6daf493a377863a6389799623defd92de52 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Tue, 1 Apr 2025 09:05:00 +0200 Subject: [PATCH 472/477] Minor tweaks --- serializer.rst | 61 +++++++++++++++++++++++++------------------------- 1 file changed, 30 insertions(+), 31 deletions(-) diff --git a/serializer.rst b/serializer.rst index 5f9144abae0..1fca42a3572 100644 --- a/serializer.rst +++ b/serializer.rst @@ -1544,13 +1544,13 @@ Named Serializers Named serializers were introduced in Symfony 7.2. -Sometimes, you may need multiple configurations for the serializer, such -as different default contexts, name converters, or sets of normalizers and -encoders, depending on the use case. For example, when your application -communicates with multiple APIs, each with its own set of rules. +Sometimes, you may need multiple configurations for the serializer, such as +different default contexts, name converters, or sets of normalizers and encoders, +depending on the use case. For example, when your application communicates with +multiple APIs, each of which follows its own set of serialization rules. -This can be achieved by configuring multiple instances of the serializer -using the ``named_serializers`` option: +You can achieve this by configuring multiple serializer instances using +the ``named_serializers`` option: .. configuration-block:: @@ -1633,7 +1633,7 @@ using :ref:`named aliases `:: class PersonController extends AbstractController { public function index( - SerializerInterface $serializer, // Default serializer + SerializerInterface $serializer, // default serializer SerializerInterface $apiClient1Serializer, // api_client1 serializer #[Target('apiClient2.serializer')] // api_client2 serializer SerializerInterface $customName, @@ -1642,10 +1642,10 @@ using :ref:`named aliases `:: } } -Named serializers are configured with the default set of normalizers and encoders. - -You can register additional normalizers and encoders with a specific named -serializer by adding a ``serializer`` attribute to +By default, named serializers use the built-in set of normalizers and encoders, +just like the main serializer service. However, you can customize them by +registering additional normalizers or encoders for a specific named serializer. +To do that, add a ``serializer`` attribute to the :ref:`serializer.normalizer ` or :ref:`serializer.encoder ` tags: @@ -1658,14 +1658,14 @@ or :ref:`serializer.encoder ` tags: # ... Symfony\Component\Serializer\Normalizer\CustomNormalizer: - # Prevent this normalizer from automatically being included in the default serializer + # prevent this normalizer from being automatically added to the default serializer autoconfigure: false tags: - # Include this normalizer in a single serializer + # add this normalizer only to a specific named serializer - serializer.normalizer: { serializer: 'api_client1' } - # Include this normalizer in multiple serializers + # add this normalizer to several named serializers - serializer.normalizer: { serializer: [ 'api_client1', 'api_client2' ] } - # Include this normalizer in all serializers (including the default one) + # add this normalizer to all serializers, including the default one - serializer.normalizer: { serializer: '*' } .. code-block:: xml @@ -1680,20 +1680,19 @@ or :ref:`serializer.encoder ` tags: - - + - + - + - + @@ -1710,32 +1709,32 @@ or :ref:`serializer.encoder ` tags: // ... $services->set(CustomNormalizer::class) - // Prevent this normalizer from automatically being included in the default serializer + // prevent this normalizer from being automatically added to the default serializer ->autoconfigure(false) - // Include this normalizer in a single serializer + // add this normalizer only to a specific named serializer ->tag('serializer.normalizer', ['serializer' => 'api_client1']) - // Include this normalizer in multiple serializers + // add this normalizer to several named serializers ->tag('serializer.normalizer', ['serializer' => ['api_client1', 'api_client2']]) - // Include this normalizer in all serializers (including the default one) + // add this normalizer to all serializers, including the default one ->tag('serializer.normalizer', ['serializer' => '*']) ; }; -When the ``serializer`` attribute is not set, the service is registered with +When the ``serializer`` attribute is not set, the service is registered only with the default serializer. -Each normalizer and encoder used in a named serializer is tagged with -a ``serializer.normalizer.`` or ``serializer.encoder.`` tag, -which can be used to list their priorities using the following command: +Each normalizer or encoder used in a named serializer is tagged with a +``serializer.normalizer.`` or ``serializer.encoder.`` tag. +You can inspect their priorities using the following command: .. code-block:: terminal $ php bin/console debug:container --tag serializer.. -Additionally, you can exclude the default set of normalizers and encoders by -setting the ``include_built_in_normalizers`` and ``include_built_in_encoders`` -options to ``false``: +Additionally, you can exclude the default set of normalizers and encoders from a +named serializer by setting the ``include_built_in_normalizers`` and +``include_built_in_encoders`` options to ``false``: .. configuration-block:: From 7b9ffb28b276674ae330e113c07e578b87055200 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 2 Apr 2025 17:00:44 +0200 Subject: [PATCH 473/477] Tweaks --- service_container/tags.rst | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/service_container/tags.rst b/service_container/tags.rst index ae10f8ef51a..fab25ea910a 100644 --- a/service_container/tags.rst +++ b/service_container/tags.rst @@ -155,24 +155,8 @@ In a Symfony application, call this method in your kernel class:: } } -In a Symfony bundle, call this method in the ``load()`` method of the -:doc:`bundle extension class `:: - - // src/DependencyInjection/MyBundleExtension.php - class MyBundleExtension extends Extension - { - // ... - - public function load(array $configs, ContainerBuilder $container): void - { - $container->registerForAutoconfiguration(CustomInterface::class) - ->addTag('app.custom_tag') - ; - } - } - -or if you are following the recommended way for new bundles and for bundles following the -:ref:`recommended directory structure `:: +In bundles extending the :class:`Symfony\\Component\\HttpKernel\\Bundle\\AbstractBundle` +class, call this method in the ``loadExtension()`` method of the main bundle class:: // ... use Symfony\Component\DependencyInjection\ContainerBuilder; @@ -190,6 +174,11 @@ or if you are following the recommended way for new bundles and for bundles foll } } +.. note:: + + For bundles not extending the ``AbstractBundle`` class, call this method in + the ``load()`` method of the :doc:`bundle extension class `. + Autoconfiguration registering is not limited to interfaces. It is possible to use PHP attributes to autoconfigure services by using the :method:`Symfony\\Component\\DependencyInjection\\ContainerBuilder::registerAttributeForAutoconfiguration` From a7a6c1d23db3430752cbdf59354aad47aaa4ef32 Mon Sep 17 00:00:00 2001 From: Kevin Bond Date: Tue, 8 Apr 2025 07:13:46 -0400 Subject: [PATCH 474/477] [Scheduler][Webhook] add screencast links --- scheduler.rst | 6 ++++++ webhook.rst | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/scheduler.rst b/scheduler.rst index a09fabfc4ca..1630fd8dada 100644 --- a/scheduler.rst +++ b/scheduler.rst @@ -1,6 +1,11 @@ Scheduler ========= +.. admonition:: Screencast + :class: screencast + + Like video tutorials? Check out this `Scheduler quick-start screencast`_. + The scheduler component manages task scheduling within your PHP application, like running a task each night at 3 AM, every two weeks except for holidays or any other custom schedule you might need. @@ -1008,3 +1013,4 @@ helping you identify those messages when needed. .. _`cron command-line utility`: https://en.wikipedia.org/wiki/Cron .. _`crontab.guru website`: https://crontab.guru/ .. _`relative formats`: https://www.php.net/manual/en/datetime.formats.php#datetime.formats.relative +.. _`Scheduler quick-start screencast`: https://symfonycasts.com/screencast/mailtrap/bonus-symfony-scheduler diff --git a/webhook.rst b/webhook.rst index aba95cffb04..9d6b56c7ef0 100644 --- a/webhook.rst +++ b/webhook.rst @@ -15,6 +15,11 @@ Installation Usage in Combination with the Mailer Component ---------------------------------------------- +.. admonition:: Screencast + :class: screencast + + Like video tutorials? Check out the `Webhook Component for Email Events screencast`_. + When using a third-party mailer provider, you can use the Webhook component to receive webhook calls from this provider. @@ -207,3 +212,4 @@ Creating a Custom Webhook Webhook. .. _`MakerBundle`: https://symfony.com/doc/current/bundles/SymfonyMakerBundle/index.html +.. _`Webhook Component for Email Events screencast`: https://symfonycasts.com/screencast/mailtrap/email-event-webhook From 76f452fb0b645a8c2e79b9c8379ca2eb90734bd1 Mon Sep 17 00:00:00 2001 From: bkb_bkb <39589466+foybkaa@users.noreply.github.com> Date: Thu, 24 Apr 2025 15:01:47 +0200 Subject: [PATCH 475/477] Use #[Autowire] attribute in FileUploader service example Replaced the YAML-based injection of the uploads_directory parameter with the #[Autowire] attribute directly in the FileUploader constructor. This avoids service configuration issues and ensures the example works out of the box with modern Symfony versions. --- controller/upload_file.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/controller/upload_file.rst b/controller/upload_file.rst index b3dc2d6ffd0..5da7274f239 100644 --- a/controller/upload_file.rst +++ b/controller/upload_file.rst @@ -240,7 +240,7 @@ logic to a separate service:: class FileUploader { public function __construct( - private string $targetDirectory, + #[Autowire('%brochures_directory%')] private string $targetDirectory, private SluggerInterface $slugger, ) { } From a499cc7b881f1ce507520b3f88df835c02df9b88 Mon Sep 17 00:00:00 2001 From: bkb_bkb <39589466+foybkaa@users.noreply.github.com> Date: Thu, 24 Apr 2025 16:55:28 +0200 Subject: [PATCH 476/477] Update controller/upload_file.rst Co-authored-by: Oskar Stark --- controller/upload_file.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/controller/upload_file.rst b/controller/upload_file.rst index 5da7274f239..7e55d25a8bc 100644 --- a/controller/upload_file.rst +++ b/controller/upload_file.rst @@ -240,7 +240,8 @@ logic to a separate service:: class FileUploader { public function __construct( - #[Autowire('%brochures_directory%')] private string $targetDirectory, + #[Autowire('%brochures_directory%')] +private string $targetDirectory, private SluggerInterface $slugger, ) { } From 376adaf19b389041a7511ffc16e1ffb1550c265e Mon Sep 17 00:00:00 2001 From: bkb_bkb <39589466+foybkaa@users.noreply.github.com> Date: Thu, 24 Apr 2025 17:06:36 +0200 Subject: [PATCH 477/477] Update upload_file.rst --- controller/upload_file.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/controller/upload_file.rst b/controller/upload_file.rst index 7e55d25a8bc..8c2c7512494 100644 --- a/controller/upload_file.rst +++ b/controller/upload_file.rst @@ -241,7 +241,7 @@ logic to a separate service:: { public function __construct( #[Autowire('%brochures_directory%')] -private string $targetDirectory, + private string $targetDirectory, private SluggerInterface $slugger, ) { }