From fc90d8335327ab9f3a4989e6a16349c794a500a2 Mon Sep 17 00:00:00 2001 From: W0rma Date: Tue, 1 Oct 2024 08:07:25 +0200 Subject: [PATCH 01/38] [Scheduler] Add example about how to pass arguments to a Symfony command --- scheduler.rst | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/scheduler.rst b/scheduler.rst index 160ba26e0cb..a77d2239259 100644 --- a/scheduler.rst +++ b/scheduler.rst @@ -473,6 +473,20 @@ The attribute takes more parameters to customize the trigger:: // defines the timezone to use #[AsCronTask('0 0 * * *', timezone: 'Africa/Malabo')] +Arguments/options for Symfony commands are passed as plain string:: + + use Symfony\Component\Console\Command\Command; + + #[AsCronTask('0 0 * * *', arguments: 'arg --my-option')] + class MyCommand extends Command + { + protected function configure(): void + { + $this->addArgument('my-arg'); + $this->addOption('my-option'); + } + } + .. versionadded:: 6.4 The :class:`Symfony\\Component\\Scheduler\\Attribute\\AsCronTask` attribute @@ -522,6 +536,20 @@ The ``#[AsPeriodicTask]`` attribute takes many parameters to customize the trigg } } +Arguments/options for Symfony commands are passed as plain string:: + + use Symfony\Component\Console\Command\Command; + + #[AsPeriodicTask(frequency: '1 day', arguments: 'arg --my-option')] + class MyCommand extends Command + { + protected function configure(): void + { + $this->addArgument('my-arg'); + $this->addOption('my-option'); + } + } + .. versionadded:: 6.4 The :class:`Symfony\\Component\\Scheduler\\Attribute\\AsPeriodicTask` attribute From e818e1261943048b09487f2fb624adbf4d8f1730 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Mon, 6 Jan 2025 15:40:44 +0100 Subject: [PATCH 02/38] Add data-controller="csrf-protection" to CSRF fields --- security.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security.rst b/security.rst index ab4f48d6559..b725672dd5f 100644 --- a/security.rst +++ b/security.rst @@ -1028,7 +1028,7 @@ be ``authenticate``:
{# ... the login fields #} - +
From 357a3e95c51192beb465e899114a1c161a12df22 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Tue, 7 Jan 2025 08:56:55 +0100 Subject: [PATCH 03/38] [HttpFoundation] Mention issues with generated URL hashes --- routing.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/routing.rst b/routing.rst index 47fcfe8cb8f..a41b9bba6a6 100644 --- a/routing.rst +++ b/routing.rst @@ -2805,6 +2805,12 @@ service, which you can inject in your services or controllers:: ``Symfony\Component\HttpKernel\UriSigner`` to ``Symfony\Component\HttpFoundation\UriSigner``. +.. note:: + + The generated URI hashes may include the ``/`` and ``+`` characters, which + can cause issues with certain clients. If you encounter this problem, replace + them using the following: ``strtr($hash, ['/' => '_', '+' => '-'])``. + Troubleshooting --------------- From 5e338ab13a5dc60f5256d904a38f959567716863 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Wed, 8 Jan 2025 08:35:59 +0100 Subject: [PATCH 04/38] remove outdated timezone warning --- messenger.rst | 6 ------ 1 file changed, 6 deletions(-) diff --git a/messenger.rst b/messenger.rst index 9d5ab5d35c8..d1f215f16a3 100644 --- a/messenger.rst +++ b/messenger.rst @@ -1583,12 +1583,6 @@ DSN by using the ``table_name`` option: Or, to create the table yourself, set the ``auto_setup`` option to ``false`` and :ref:`generate a migration `. -.. warning:: - - The datetime property of the messages stored in the database uses the - timezone of the current system. This may cause issues if multiple machines - with different timezone configuration use the same storage. - The transport has a number of options: ``table_name`` (default: ``messenger_messages``) From 6e71ed0d5ca3f3f48fbd750979be3b59e8194da9 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Wed, 8 Jan 2025 14:50:30 +0100 Subject: [PATCH 05/38] wrap multiple constraints in a Collection constraint to validate array-like data --- form/without_class.rst | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/form/without_class.rst b/form/without_class.rst index 436976bdfcc..8b0af7cf23f 100644 --- a/form/without_class.rst +++ b/form/without_class.rst @@ -137,6 +137,7 @@ This can be done by setting the ``constraints`` option in the use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; + use Symfony\Component\Validator\Constraints\Collection; use Symfony\Component\Validator\Constraints\Length; use Symfony\Component\Validator\Constraints\NotBlank; @@ -149,17 +150,15 @@ This can be done by setting the ``constraints`` option in the public function configureOptions(OptionsResolver $resolver): void { - $constraints = [ - 'firstName' => new Length(['min' => 3]), - 'lastName' => [ - new NotBlank(), - new Length(['min' => 3]), - ], - ]; - $resolver->setDefaults([ 'data_class' => null, - 'constraints' => $constraints, + 'constraints' => new Collection([ + 'firstName' => new Length(['min' => 3]), + 'lastName' => [ + new NotBlank(), + new Length(['min' => 3]), + ], + ]), ]); } From bb76fd9fee26080dfa8795528f472aed5d8fcf64 Mon Sep 17 00:00:00 2001 From: Ninos Ego Date: Wed, 8 Jan 2025 23:52:31 +0100 Subject: [PATCH 06/38] [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 07/38] 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 cf778c0d7991170dc4dec1392c3ad290de7e3cf7 Mon Sep 17 00:00:00 2001 From: Florian CAVASIN Date: Thu, 9 Jan 2025 15:54:44 +0100 Subject: [PATCH 08/38] Update custom_constraint.rst --- validation/custom_constraint.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/validation/custom_constraint.rst b/validation/custom_constraint.rst index c2b4eff130a..8fcb0c5c10e 100644 --- a/validation/custom_constraint.rst +++ b/validation/custom_constraint.rst @@ -499,7 +499,7 @@ A class constraint validator must be applied to the class itself: use App\Validator as AcmeAssert; - #[AcmeAssert\ProtocolClass] + #[AcmeAssert\ConfirmedPaymentReceipt] class AcmeEntity { // ... From 56c035a3c3f85299d29b56a96a52d502c2268187 Mon Sep 17 00:00:00 2001 From: Marko Kaznovac Date: Thu, 9 Jan 2025 22:04:34 +0100 Subject: [PATCH 09/38] serializer[custom_normalizer]: fix reference to built-in normalizers --- serializer/custom_normalizer.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/serializer/custom_normalizer.rst b/serializer/custom_normalizer.rst index 276c618b8ac..d6ba66f89b6 100644 --- a/serializer/custom_normalizer.rst +++ b/serializer/custom_normalizer.rst @@ -3,7 +3,7 @@ How to Create your Custom Normalizer The :doc:`Serializer component ` uses normalizers to transform any data into an array. The component provides several -ref:`built-in normalizers ` but you may +:ref:`built-in normalizers ` but you may need to create your own normalizer to transform an unsupported data structure. From 1960c77521d526199cc28a07d189d8e4ac2353a0 Mon Sep 17 00:00:00 2001 From: Javier Spagnoletti Date: Sat, 11 Jan 2025 03:10:57 -0300 Subject: [PATCH 10/38] [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 d32dd55878be38c1afc2a47704fe219e22b1a734 Mon Sep 17 00:00:00 2001 From: Antoine Lamirault Date: Sun, 12 Jan 2025 21:17:27 +0100 Subject: [PATCH 11/38] Remove build spelling world list --- _build/spelling_word_list.txt | 344 ---------------------------------- 1 file changed, 344 deletions(-) delete mode 100644 _build/spelling_word_list.txt diff --git a/_build/spelling_word_list.txt b/_build/spelling_word_list.txt deleted file mode 100644 index fa05ce9430e..00000000000 --- a/_build/spelling_word_list.txt +++ /dev/null @@ -1,344 +0,0 @@ -accessor -Akamai -analytics -Ansi -Ansible -async -authenticator -authenticators -autocompleted -autocompletion -autoconfiguration -autoconfigure -autoconfigured -autoconfigures -autoconfiguring -autoload -autoloaded -autoloader -autoloaders -autoloading -autoprefixing -autowire -autowireable -autowired -autowiring -backend -backends -balancer -balancers -bcrypt -benchmarking -Bitbucket -bitmask -bitmasks -bitwise -Blackfire -boolean -booleans -Brasseur -browserslist -buildpack -buildpacks -bundler -cacheable -Caddy -callables -camelCase -casted -changelog -changeset -charset -charsets -checkboxes -classmap -classname -clearers -cloner -cloners -codebase -config -configs -configurator -configurators -contrib -cron -cronjobs -cryptographic -cryptographically -Ctrl -ctype -cURL -customizable -customizations -Cygwin -dataset -datepicker -decrypt -denormalization -denormalize -denormalized -denormalizing -deprecations -deserialization -deserialize -deserialized -deserializing -destructor -dev -dn -DNS -docblock -Dotenv -downloader -Doxygen -DSN -Dunglas -easter -Eberlei -emilie -enctype -entrypoints -enum -env -escaper -escpaer -extensibility -extractable -eZPublish -Fabien -failover -filesystem -filesystems -formatter -formatters -frontend -getter -getters -GitHub -gmail -Gmail -Goutte -grapheme -hardcode -hardcoded -hardcodes -hardcoding -hasser -hassers -headshot -HInclude -hostname -https -iconv -igbinary -incrementing -ini -inlined -inlining -installable -instantiation -interoperable -intl -Intl -invokable -IPv -isser -issers -Jpegoptim -jQuery -js -Karlton -kb -kB -Kévin -Ki -KiB -kibibyte -Kubernetes -Kudu -labelled -latin -Ldap -libketama -licensor -lifecycle -liip -linter -localhost -Loggly -Logplex -lookups -loopback -lorenzo -Luhn -macOS -matcher -matchers -mbstring -mebibyte -memcache -memcached -MiB -michelle -minification -minified -minifier -minifies -minify -minifying -misconfiguration -misconfigured -misgendering -Monolog -mutator -nagle -namespace -namespaced -namespaces -namespacing -natively -nd -netmasks -nginx -normalizer -normalizers -npm -nyholm -OAuth -OPcache -overcomplicate -Packagist -parallelizes -parsers -PHP -PHPUnit -PID -plaintext -polyfill -polyfills -postcss -Potencier -pre -preconfigured -predefines -Predis -preload -preloaded -preloading -prepend -prepended -prepending -prepends -preprocessed -preprocessors -Procfile -profiler -programmatically -prototyped -rebase -reconfiguring -reconnection -redirections -refactorization -regexes -renderer -resolvers -responder -reStructuredText -reusability -runtime -sandboxing -schemas -screencast -semantical -serializable -serializer -sexualized -Silex -sluggable -socio -specificities -SQLite -stacktrace -stacktraces -storages -stringified -stylesheet -stylesheets -subclasses -subdirectories -subdirectory -sublcasses -sublicense -sublincense -subrequests -subtree -superclass -superglobal -superglobals -symfony -Symfony -symlink -symlinks -syntaxes -templating -testability -th -theming -throbber -timestampable -timezones -TLS -tmpfs -tobias -todo -Tomayko -Toolbelt -tooltip -Traversable -triaging -UI -uid -unary -unauthenticate -uncacheable -uncached -uncomment -uncommented -undelete -unhandled -unicode -Unix -unmapped -unminified -unported -unregister -unrendered -unserialize -unserialized -unserializing -unsubmitted -untracked -uploader -URI -validator -validators -variadic -VirtualBox -Vue -webpack -webpacked -webpackJsonp -webserver -whitespace -whitespaces -woh -Wordpress -Xdebug -xkcd -Xliff -XML -XPath -yaml -yay From efb59e63b7b04f7dd43bfdd5ad20b102091769c8 Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Mon, 13 Jan 2025 09:05:44 +0100 Subject: [PATCH 12/38] [Panther] Sync documentation from upstream --- .doctor-rst.yaml | 1 + testing/end_to_end.rst | 68 +++++++++++++++++++++++++++++++++++------- 2 files changed, 58 insertions(+), 11 deletions(-) diff --git a/.doctor-rst.yaml b/.doctor-rst.yaml index 07eb7392bfb..258de40c750 100644 --- a/.doctor-rst.yaml +++ b/.doctor-rst.yaml @@ -117,3 +117,4 @@ whitelist: - '.. versionadded:: 3.0' # Doctrine ORM - '.. _`a feature to test applications using Mercure`: https://github.com/symfony/panther#creating-isolated-browsers-to-test-apps-using-mercure-or-websocket' - 'End to End Tests (E2E)' + - '.. versionadded:: 2.2.0' # Panther diff --git a/testing/end_to_end.rst b/testing/end_to_end.rst index d59f243f998..8a624ae884e 100644 --- a/testing/end_to_end.rst +++ b/testing/end_to_end.rst @@ -111,12 +111,12 @@ Here is an example of a snippet that uses Panther to test an application:: $client->clickLink('Getting started'); // wait for an element to be present in the DOM, even if hidden - $crawler = $client->waitFor('#installing-the-framework'); + $crawler = $client->waitFor('#bootstrapping-the-core-library'); // you can also wait for an element to be visible - $crawler = $client->waitForVisibility('#installing-the-framework'); + $crawler = $client->waitForVisibility('#bootstrapping-the-core-library'); // get the text of an element thanks to the query selector syntax - echo $crawler->filter('#installing-the-framework')->text(); + echo $crawler->filter('div:has(> #bootstrapping-the-core-library)')->text(); // take a screenshot of the current page $client->takeScreenshot('screen.png'); @@ -305,13 +305,13 @@ faster. Two alternative clients are available: * The second leverages :class:`Symfony\\Component\\BrowserKit\\HttpBrowser`. It is an intermediate between Symfony's kernel and Panther's test clients. ``HttpBrowser`` sends real HTTP requests using the - :doc:`HttpClient component `. It is fast and is able to browse + :doc:`HttpClient component `. It is fast and can browse any webpage, not only the ones of the application under test. However, HttpBrowser doesn't support JavaScript and other advanced features because it is entirely written in PHP. This one can be used in any PHP application. -Because all clients implement the exact same API, you can switch from one to +Because all clients implement the same API, you can switch from one to another just by calling the appropriate factory method, resulting in a good trade-off for every single test case: if JavaScript is needed or not, if an authentication against an external SSO has to be done, etc. @@ -355,10 +355,10 @@ Testing Real-Time Applications ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Panther provides a convenient way to test applications with real-time -capabilities which use `Mercure`_, `WebSocket`_ and similar technologies. +capabilities that use `Mercure`_, `WebSocket`_ and similar technologies. The ``PantherTestCase::createAdditionalPantherClient()`` method can create -additional, isolated browsers which can interact with other ones. For instance, +additional, isolated browsers that can interact with other ones. For instance, this can be useful to test a chat application having several users connected simultaneously:: @@ -451,6 +451,22 @@ To use a proxy server, you have to set the ``PANTHER_CHROME_ARGUMENTS``: # .env.test PANTHER_CHROME_ARGUMENTS='--proxy-server=socks://127.0.0.1:9050' +Using Selenium With the Built-In Web Server +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +If you want to use `Selenium Grid`_ with the built-in web server, you need to +configure the Panther client as follows:: + + $client = Client::createPantherClient( + options: [ + 'browser' => PantherTestCase::SELENIUM, + ], + managerOptions: [ + 'host' => 'http://selenium-hub:4444', // the host of the Selenium Server (Grid) + 'capabilities' => DesiredCapabilities::firefox(), // the capabilities of the browser + ], + ); + Accepting Self-Signed SSL Certificates ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -597,6 +613,13 @@ behavior: Toggle the browser's dev tools (default ``enabled``, useful to debug) ``PANTHER_ERROR_SCREENSHOT_ATTACH`` Add screenshots mentioned above to test output in junit attachment format +``PANTHER_NO_REDUCED_MOTION`` + Disable non-essential movement in the browser (e.g. animations) + +.. versionadded:: 2.2.0 + + The support for the ``PANTHER_NO_REDUCED_MOTION`` env var was added + in Panther 2.2.0. Chrome Specific Environment Variables ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -604,7 +627,8 @@ Chrome Specific Environment Variables ``PANTHER_NO_SANDBOX`` Disable `Chrome's sandboxing`_ (unsafe, but allows to use Panther in containers) ``PANTHER_CHROME_ARGUMENTS`` - Customize Chrome arguments. You need to set ``PANTHER_NO_HEADLESS`` to fully customize + Customize Chrome arguments. You need to set ``PANTHER_NO_HEADLESS`` to ``1`` + to fully customize ``PANTHER_CHROME_BINARY`` To use another ``google-chrome`` binary @@ -616,12 +640,33 @@ Firefox Specific Environment Variables ``PANTHER_FIREFOX_BINARY`` To use another ``firefox`` binary +Changing the Size of the Browser Window +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +It's possible to control the size of the browser window. This also controls the +size of the screenshots. + +This is how you would do it with Chrome:: + + $client = Client::createChromeClient(null, ['--window-size=1500,4000']); + +You can achieve the same thing by setting the ``PANTHER_CHROME_ARGUMENTS`` env +var to ``--window-size=1500,4000``. + +On Firefox, here is how you would do it:: + + use Facebook\WebDriver\WebDriverDimension; + + $client = Client::createFirefoxClient(); + $size = new WebDriverDimension(1500, 4000); + $client->manage()->window()->setSize($size); + .. _panther_interactive-mode: Interactive Mode ---------------- -Panther can make a pause in your tests suites after a failure. +Panther can make a pause in your test suites after a failure. Thanks to this break time, you can investigate the encountered problem through the web browser. To enable this mode, you need the ``--debug`` PHPUnit option without the headless mode: @@ -709,7 +754,7 @@ Here is a minimal ``.travis.yaml`` file to run Panther tests: language: php addons: - # If you don't use Chrome, or Firefox, remove the corresponding line + # If you don't use Chrome or Firefox, remove the corresponding line chrome: stable firefox: latest @@ -788,7 +833,7 @@ The following features are not currently supported: * Updating existing documents (browsers are mostly used to consume data, not to create webpages) * Setting form values using the multidimensional PHP array syntax * Methods returning an instance of ``\DOMElement`` (because this library uses ``WebDriverElement`` internally) -* Selecting invalid choices in select +* Selecting invalid choices in the select Also, there is a known issue if you are using Bootstrap 5. It implements a scrolling effect which tends to mislead Panther. To fix this, we advise you to @@ -875,3 +920,4 @@ documentation: .. _`LiipFunctionalTestBundle`: https://github.com/liip/LiipFunctionalTestBundle .. _`PHP built-in server`: https://www.php.net/manual/en/features.commandline.webserver.php .. _`Functional Testing tutorial`: https://symfonycasts.com/screencast/last-stack/testing +.. _`Selenium Grid`: https://www.selenium.dev/documentation/grid/ From a9a37f5f07dc98e05907d4aa61beb6a7ececaba2 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Mon, 13 Jan 2025 09:11:08 +0100 Subject: [PATCH 13/38] [Frontend] Update a table to make it more readable --- frontend/create_ux_bundle.rst | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/frontend/create_ux_bundle.rst b/frontend/create_ux_bundle.rst index 8faf0f44bb1..8f44a16f62e 100644 --- a/frontend/create_ux_bundle.rst +++ b/frontend/create_ux_bundle.rst @@ -142,21 +142,22 @@ Twig ``stimulus_*`` functions. Each controller has a number of options in ``package.json`` file: -================== ==================================================================================================== -Option Description -================== ==================================================================================================== -enabled Whether the controller should be enabled by default. -main Path to the controller file. -fetch How controller & dependencies are included when the page loads. - Use ``eager`` (default) to make controller & dependencies included in the JavaScript that's - downloaded when the page is loaded. - Use ``lazy`` to make controller & dependencies isolated into a separate file and only downloaded - asynchronously if (and when) the data-controller HTML appears on the page. -autoimport List of files to be imported with the controller. Useful e.g. when there are several CSS styles - depending on the frontend framework used (like Bootstrap 4 or 5, Tailwind CSS...). - The value must be an object with files as keys, and a boolean as value for each file to set - whether the file should be imported. -================== ==================================================================================================== +``enabled``: + Whether the controller should be enabled by default. +``main``: + Path to the controller file. +``fetch``: + How controller & dependencies are included when the page loads. + Use ``eager`` (default) to make controller & dependencies included in the + JavaScript that's downloaded when the page is loaded. + Use ``lazy`` to make controller & dependencies isolated into a separate file + and only downloaded asynchronously if (and when) the data-controller HTML + appears on the page. +``autoimport``: + List of files to be imported with the controller. Useful e.g. when there are + several CSS styles depending on the frontend framework used (like Bootstrap 4 + or 5, Tailwind CSS...). The value must be an object with files as keys, and + a boolean as value for each file to set whether the file should be imported. Specifics for Asset Mapper -------------------------- From 29da96e9cf7b18c6d1933fb96278dd87b47f484c Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 13 Jan 2025 15:28:42 +0100 Subject: [PATCH 14/38] Add the Symfony UX Core Team --- contributing/code/core_team.rst | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/contributing/code/core_team.rst b/contributing/code/core_team.rst index efc60894c7c..242f471947a 100644 --- a/contributing/code/core_team.rst +++ b/contributing/code/core_team.rst @@ -71,6 +71,14 @@ Active Core Members * **Fabien Potencier** (`fabpot`_); * **Jérémy Derussé** (`jderusse`_). +* **Symfony UX** (``@symfony/ux`` on GitHub): + + * **Ryan Weaver** (`weaverryan`_); + * **Kevin Bond** (`kbond`_); + * **Simon Andre** (`smnandre`_); + * **Hugo Alliaume** (`kocal`_); + * **Matheo Daninos** (`webmamba`_). + * **Documentation Team** (``@symfony/team-symfony-docs`` on GitHub): * **Fabien Potencier** (`fabpot`_); @@ -211,3 +219,6 @@ discretion of the **Project Leader**. .. _`welcomattic`: https://github.com/welcomattic/ .. _`kbond`: https://github.com/kbond/ .. _`gromnan`: https://github.com/gromnan/ +.. _`smnandre`: https://github.com/smnandre/ +.. _`kocal`: https://github.com/kocal/ +.. _`webmamba`: https://github.com/webmamba/ From 4bb344dba9ebbaf8686d65f8303e48237663d05a Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 13 Jan 2025 16:24:57 +0100 Subject: [PATCH 15/38] Fix typo --- contributing/code/core_team.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contributing/code/core_team.rst b/contributing/code/core_team.rst index 242f471947a..3a2ed9091f9 100644 --- a/contributing/code/core_team.rst +++ b/contributing/code/core_team.rst @@ -75,7 +75,7 @@ Active Core Members * **Ryan Weaver** (`weaverryan`_); * **Kevin Bond** (`kbond`_); - * **Simon Andre** (`smnandre`_); + * **Simon André** (`smnandre`_); * **Hugo Alliaume** (`kocal`_); * **Matheo Daninos** (`webmamba`_). From bcbf6f62d5bcc1119d89f5caccf75c73f5b68cf7 Mon Sep 17 00:00:00 2001 From: Wouter de Jong Date: Mon, 13 Jan 2025 16:25:18 +0100 Subject: [PATCH 16/38] [#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 a3f48853be1f5f17fd7126581600b8ebfc1e338a Mon Sep 17 00:00:00 2001 From: Wouter de Jong Date: Mon, 13 Jan 2025 16:25:18 +0100 Subject: [PATCH 17/38] [#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 3a2ed9091f9..b787452c64a 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 d5f3dd85b4547ea181cfca71f1cfd6645de9af5d Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 13 Jan 2025 18:26:05 +0100 Subject: [PATCH 18/38] Add information about being a core member --- contributing/code/core_team.rst | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/contributing/code/core_team.rst b/contributing/code/core_team.rst index b787452c64a..edbbfaf4e77 100644 --- a/contributing/code/core_team.rst +++ b/contributing/code/core_team.rst @@ -13,6 +13,17 @@ This document states the rules that govern the Symfony core team. These rules are effective upon publication of this document and all Symfony Core members must adhere to said rules and protocol. +Role of a Core Member +--------------------- + +In addition to being a regular contributor, core members are expected to: + + * Review, approve, and merge pull requests; + + * Help enforce, improve, and implement Symfony :doc:`processes and policies `; + + * Participate in the Symfony Core Team discussions (on Slack and GitHub). + Core Organization ----------------- From 2423666c17b97c845ee0ba630b6d6dd7c32b650f Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 13 Jan 2025 18:11:38 +0100 Subject: [PATCH 19/38] Add information about PR merge commit category --- contributing/code/core_team.rst | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/contributing/code/core_team.rst b/contributing/code/core_team.rst index b787452c64a..daf1d1cb868 100644 --- a/contributing/code/core_team.rst +++ b/contributing/code/core_team.rst @@ -168,8 +168,28 @@ All code must be committed to the repository through pull requests, except for :ref:`minor change ` which can be committed directly to the repository. -**Mergers** must always use the command-line ``gh`` tool provided by the -**Project Leader** to merge the pull requests. +**Mergers** must always use the command-line ``gh`` tool to merge pull +requests. + +When merging a pull request, the tool asks for a category that should be chosen +following these rules: + +* **Feature**: For new features and deprecations; Pull requests must be merged + in the development branch. + +* **Bug**: Only for bug fixes; We are very conservative when it comes to + merging older, but still maintained, branches. Read the :doc:`maintenance` + document for more information. + +* **Minor**: For everything that does not change the code or when they don't + need to be listed in the CHANGELOG files: typos, Markdown files, test files, + new or missing translations, etc. + +* **Security**: It's the category used for security fixes and should never be + used except by the security team. + +Getting the right category is important as it is used by automated tools to +generate the CHANGELOG files when releasing new versions. Release Policy ~~~~~~~~~~~~~~ From d949cbb989e2235d0dbddbac50cc8d39e95b9198 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 15 Jan 2025 15:07:12 +0100 Subject: [PATCH 20/38] Minor tweak --- contributing/code/core_team.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contributing/code/core_team.rst b/contributing/code/core_team.rst index daf1d1cb868..61045dfbf5b 100644 --- a/contributing/code/core_team.rst +++ b/contributing/code/core_team.rst @@ -168,8 +168,8 @@ All code must be committed to the repository through pull requests, except for :ref:`minor change ` which can be committed directly to the repository. -**Mergers** must always use the command-line ``gh`` tool to merge pull -requests. +**Mergers** must always use the command-line ``gh`` tool provided by the +**Project Leader** to merge pull requests. When merging a pull request, the tool asks for a category that should be chosen following these rules: From c9ad945053958e1da303aa63d69363b8adb0dc77 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Thu, 16 Jan 2025 15:49:54 +0100 Subject: [PATCH 21/38] Minor tweaks --- contributing/code/core_team.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/contributing/code/core_team.rst b/contributing/code/core_team.rst index d8c2048e5fd..93ec6031259 100644 --- a/contributing/code/core_team.rst +++ b/contributing/code/core_team.rst @@ -13,10 +13,10 @@ This document states the rules that govern the Symfony core team. These rules are effective upon publication of this document and all Symfony Core members must adhere to said rules and protocol. -Role of a Core Member ---------------------- +Role of a Core Team Member +-------------------------- -In addition to being a regular contributor, core members are expected to: +In addition to being a regular contributor, core team members are expected to: * Review, approve, and merge pull requests; From 7232f8cf3898a2144bfacb398a665d5596b77d9d Mon Sep 17 00:00:00 2001 From: Alexis Lefebvre Date: Sat, 7 Sep 2024 17:23:00 +0200 Subject: [PATCH 22/38] =?UTF-8?q?[Setup]=20feat:=20add=20section=20about?= =?UTF-8?q?=20`composer=20extra.symfony.require=20=E2=80=A6`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- setup.rst | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/setup.rst b/setup.rst index 1fc65f23856..fccb15b375d 100644 --- a/setup.rst +++ b/setup.rst @@ -281,6 +281,19 @@ create new projects. If you use Composer, you need to tell the exact version: $ composer create-project symfony/skeleton:"6.4.*" my_project_directory +With an already existing project, you can restrict Symfony packages to one +specific version by :doc:`using Symfony Flex in your project ` +and setting the ``extra.symfony.require`` config: + +.. code-block:: terminal + + $ composer config extra.symfony.require "6.4.*" + +.. warning:: + + Tools like `dependabot`_ may ignore this setting and upgrade the Symfony dependencies, + see this `GitHub issue about dependabot`_. + The Symfony Demo application ---------------------------- @@ -315,6 +328,8 @@ Learn More .. _`Install Composer`: https://getcomposer.org/download/ .. _`install the Symfony CLI`: https://symfony.com/download .. _`symfony-cli/symfony-cli GitHub repository`: https://github.com/symfony-cli/symfony-cli +.. _`dependabot`: https://docs.github.com/en/code-security/dependabot +.. _`GitHub issue about dependabot`: https://github.com/dependabot/dependabot-core/issues/4631 .. _`The Symfony Demo Application`: https://github.com/symfony/demo .. _`Symfony Flex`: https://github.com/symfony/flex .. _`PHP security advisories database`: https://github.com/FriendsOfPHP/security-advisories From 644ac22454d64fdfa430480ae946756848aaba01 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Thu, 16 Jan 2025 16:37:56 +0100 Subject: [PATCH 23/38] Move the new contents --- setup.rst | 15 --------------- setup/upgrade_major.rst | 40 +++++++++++++++++++++++++++++++--------- 2 files changed, 31 insertions(+), 24 deletions(-) diff --git a/setup.rst b/setup.rst index fccb15b375d..1fc65f23856 100644 --- a/setup.rst +++ b/setup.rst @@ -281,19 +281,6 @@ create new projects. If you use Composer, you need to tell the exact version: $ composer create-project symfony/skeleton:"6.4.*" my_project_directory -With an already existing project, you can restrict Symfony packages to one -specific version by :doc:`using Symfony Flex in your project ` -and setting the ``extra.symfony.require`` config: - -.. code-block:: terminal - - $ composer config extra.symfony.require "6.4.*" - -.. warning:: - - Tools like `dependabot`_ may ignore this setting and upgrade the Symfony dependencies, - see this `GitHub issue about dependabot`_. - The Symfony Demo application ---------------------------- @@ -328,8 +315,6 @@ Learn More .. _`Install Composer`: https://getcomposer.org/download/ .. _`install the Symfony CLI`: https://symfony.com/download .. _`symfony-cli/symfony-cli GitHub repository`: https://github.com/symfony-cli/symfony-cli -.. _`dependabot`: https://docs.github.com/en/code-security/dependabot -.. _`GitHub issue about dependabot`: https://github.com/dependabot/dependabot-core/issues/4631 .. _`The Symfony Demo Application`: https://github.com/symfony/demo .. _`Symfony Flex`: https://github.com/symfony/flex .. _`PHP security advisories database`: https://github.com/FriendsOfPHP/security-advisories diff --git a/setup/upgrade_major.rst b/setup/upgrade_major.rst index 8c172c49b29..ab05f2b202b 100644 --- a/setup/upgrade_major.rst +++ b/setup/upgrade_major.rst @@ -162,20 +162,40 @@ starting with ``symfony/`` to the new major version: "...": "...", } -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: +A more efficient way to handle Symfony dependency updates is by setting the +``extra.symfony.require`` configuration option in your ``composer.json`` file. +In Symfony applications using :doc:`Symfony Flex `, this setting +restricts Symfony packages to a single specific version, improving both +dependency management and Composer update performance: .. code-block:: diff - "extra": { - "symfony": { - "allow-contrib": false, - - "require": "5.4.*" - + "require": "6.0.*" - } + { + "...": "...", + + "require": { + - "symfony/cache": "6.0.*", + + "symfony/cache": "*", + - "symfony/config": "6.0.*", + + "symfony/config": "*", + - "symfony/console": "6.0.*", + + "symfony/console": "*", + "...": "...", + }, + "...": "...", + + + "extra": { + + "symfony": { + + "require": "6.0.*" + + } + + } } +.. warning:: + + Tools like `dependabot`_ may ignore this setting and upgrade Symfony + dependencies. For more details, see this `GitHub issue about dependabot`_. + .. tip:: If a more recent minor version is available (e.g. ``6.4``) you can use that @@ -338,3 +358,5 @@ Classes in the ``vendor/`` directory are always ignored. .. _`PHP CS Fixer`: https://github.com/friendsofphp/php-cs-fixer .. _`Rector`: https://github.com/rectorphp/rector .. _`maintained Symfony versions`: https://symfony.com/releases +.. _`dependabot`: https://docs.github.com/en/code-security/dependabot +.. _`GitHub issue about dependabot`: https://github.com/dependabot/dependabot-core/issues/4631 From 3dca32e1cf1838b812d61e04baeade9b2e5b1716 Mon Sep 17 00:00:00 2001 From: Thomas Landauer Date: Fri, 17 Jan 2025 10:45:36 +0100 Subject: [PATCH 24/38] [Mercure] Adding hint for multiple topics Page: https://symfony.com/doc/6.4/mercure.html#subscribing Closes https://github.com/symfony/symfony-docs/issues/20574 Closes https://github.com/symfony/mercure-bundle/issues/71 Closes https://github.com/symfony/mercure-bundle/issues/82 Info is taken from https://github.com/symfony/symfony-docs/issues/20574#issuecomment-2597102678 --- mercure.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mercure.rst b/mercure.rst index f37c40ddee7..698de373a17 100644 --- a/mercure.rst +++ b/mercure.rst @@ -309,6 +309,11 @@ as patterns: } +However, on the client side (i.e. in JavaScript's ``EventSource``), there is no built-in way +to see which topic a certain message is coming from. So if this (or any other meta information) +is important to you, you need to include it in the message's data (e.g. by adding a key to the +JSON, or a `data-*` attribute to the HTML). + .. tip:: Test if a URI Template matches a URL using `the online debugger`_ From b9e2005cc3e1d1fde6d2f97382a6d37bac14bc8a Mon Sep 17 00:00:00 2001 From: Thomas Landauer Date: Sat, 18 Jan 2025 13:19:11 +0100 Subject: [PATCH 25/38] [Console] Adding associative array Page: https://symfony.com/doc/6.4/components/console/helpers/questionhelper.html#let-the-user-choose-from-a-list-of-answers --- components/console/helpers/questionhelper.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/console/helpers/questionhelper.rst b/components/console/helpers/questionhelper.rst index 2670ec3084a..e8c2d40a470 100644 --- a/components/console/helpers/questionhelper.rst +++ b/components/console/helpers/questionhelper.rst @@ -128,7 +128,7 @@ but ``red`` could be set instead (could be more explicit):: $question = new ChoiceQuestion( 'Please select your favorite color (defaults to red)', // choices can also be PHP objects that implement __toString() method - ['red', 'blue', 'yellow'], + ['red', 'blue', 'yellow'], // pass an associative array to display custom indices: [3 => 'red', 7 => 'blue'] 0 ); $question->setErrorMessage('Color %s is invalid.'); From 64bd096d735360895a1c0ea9dc97612e73d1e40e Mon Sep 17 00:00:00 2001 From: Thomas Landauer Date: Sat, 18 Jan 2025 13:37:23 +0100 Subject: [PATCH 26/38] [Console]: Minor: Removing duplication Page: https://symfony.com/doc/6.4/console/calling_commands.html --- console/calling_commands.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/console/calling_commands.rst b/console/calling_commands.rst index 349f1357682..dd1f0b12ff9 100644 --- a/console/calling_commands.rst +++ b/console/calling_commands.rst @@ -1,9 +1,9 @@ How to Call Other Commands ========================== -If a command depends on another one being run before it you can call in the -console command itself. This is useful if a command depends on another command -or if you want to create a "meta" command that runs a bunch of other commands +If a command depends on another one being run before it you can call that in the +console command itself. This can be useful +if you want to create a "meta" command that runs a bunch of other commands (for instance, all commands that need to be run when the project's code has changed on the production servers: clearing the cache, generating Doctrine proxies, dumping web assets, ...). From 6301562c49f02e2a15b253dd007aa55ad0c336cc Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Mon, 20 Jan 2025 12:02:52 +0100 Subject: [PATCH 27/38] Remove some unnecessary blank lines in some lists --- contributing/code/core_team.rst | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/contributing/code/core_team.rst b/contributing/code/core_team.rst index 93ec6031259..5f41ec0b4cf 100644 --- a/contributing/code/core_team.rst +++ b/contributing/code/core_team.rst @@ -18,11 +18,9 @@ Role of a Core Team Member In addition to being a regular contributor, core team members are expected to: - * Review, approve, and merge pull requests; - - * Help enforce, improve, and implement Symfony :doc:`processes and policies `; - - * Participate in the Symfony Core Team discussions (on Slack and GitHub). +* Review, approve, and merge pull requests; +* Help enforce, improve, and implement Symfony :doc:`processes and policies `; +* Participate in the Symfony Core Team discussions (on Slack and GitHub). Core Organization ----------------- @@ -46,9 +44,7 @@ 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.); - * **Symfony UX Team**: manages the `UX repositories`_; - * **Documentation Team**: manages the whole `symfony-docs repository`_. Active Core Members @@ -152,7 +148,6 @@ Pull Request Voting Policy * Core members can change their votes as many times as they desire during the course of a pull request discussion; - * Core members are not allowed to vote on their own pull requests. Pull Request Merging Policy @@ -161,13 +156,10 @@ Pull Request Merging Policy A pull request **can be merged** if: * It is a :ref:`minor change `; - * Enough time was given for peer reviews; - * It is a bug fix and at least two **Mergers Team** members voted ``+1`` (only one if the submitter is part of the Mergers team) and no Core member voted ``-1`` (via GitHub reviews or as comments). - * It is a new feature and at least two **Mergers Team** members voted ``+1`` (if the submitter is part of the Mergers team, two *other* members) and no Core member voted ``-1`` (via GitHub reviews or as comments). @@ -187,15 +179,12 @@ following these rules: * **Feature**: For new features and deprecations; Pull requests must be merged in the development branch. - * **Bug**: Only for bug fixes; We are very conservative when it comes to merging older, but still maintained, branches. Read the :doc:`maintenance` document for more information. - * **Minor**: For everything that does not change the code or when they don't need to be listed in the CHANGELOG files: typos, Markdown files, test files, new or missing translations, etc. - * **Security**: It's the category used for security fixes and should never be used except by the security team. From e5e62c487425a84bafe41b424ddf51601bae9d21 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Tue, 21 Jan 2025 09:12:14 +0100 Subject: [PATCH 28/38] Minor tweaks --- mercure.rst | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/mercure.rst b/mercure.rst index 698de373a17..42ad9798d3c 100644 --- a/mercure.rst +++ b/mercure.rst @@ -309,10 +309,11 @@ as patterns: } -However, on the client side (i.e. in JavaScript's ``EventSource``), there is no built-in way -to see which topic a certain message is coming from. So if this (or any other meta information) -is important to you, you need to include it in the message's data (e.g. by adding a key to the -JSON, or a `data-*` attribute to the HTML). +However, on the client side (i.e. in JavaScript's ``EventSource``), there is no +built-in way to know which topic a certain message originates from. If this (or +any other meta information) is important to you, you need to include it in the +message's data (e.g. by adding a key to the JSON, or a ``data-*`` attribute to +the HTML). .. tip:: From 53b7a44f7afabbe9b9502cb48ff1971d776689f9 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Tue, 21 Jan 2025 09:52:45 +0100 Subject: [PATCH 29/38] Reword --- components/console/helpers/questionhelper.rst | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/components/console/helpers/questionhelper.rst b/components/console/helpers/questionhelper.rst index e8c2d40a470..3dc97d5c0d3 100644 --- a/components/console/helpers/questionhelper.rst +++ b/components/console/helpers/questionhelper.rst @@ -128,7 +128,7 @@ but ``red`` could be set instead (could be more explicit):: $question = new ChoiceQuestion( 'Please select your favorite color (defaults to red)', // choices can also be PHP objects that implement __toString() method - ['red', 'blue', 'yellow'], // pass an associative array to display custom indices: [3 => 'red', 7 => 'blue'] + ['red', 'blue', 'yellow'], 0 ); $question->setErrorMessage('Color %s is invalid.'); @@ -145,6 +145,28 @@ The option which should be selected by default is provided with the third argument of the constructor. The default is ``null``, which means that no option is the default one. +Choice questions display both the choice value and a numeric index, which starts +from 0 by default. The user can type either the numeric index or the choice value +to make a selection: + +.. code-block:: terminal + + Please select your favorite color (defaults to red): + [0] red + [1] blue + [2] yellow + > + +.. tip:: + + To use custom indices, pass an array with custom numeric keys as the choice + values:: + + new ChoiceQuestion('Select a room:', [ + 102 => 'Room Foo', + 213 => 'Room Bar', + ]); + If the user enters an invalid string, an error message is shown and the user is asked to provide the answer another time, until they enter a valid string or reach the maximum number of attempts. The default value for the maximum number From 35df8ae759bf455557cb9f9b530c02231cc8ced1 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 22 Jan 2025 09:23:07 +0100 Subject: [PATCH 30/38] Reword --- scheduler.rst | 30 ++++++------------------------ 1 file changed, 6 insertions(+), 24 deletions(-) diff --git a/scheduler.rst b/scheduler.rst index 6cebb354137..5bac82d98ae 100644 --- a/scheduler.rst +++ b/scheduler.rst @@ -473,19 +473,10 @@ The attribute takes more parameters to customize the trigger:: // defines the timezone to use #[AsCronTask('0 0 * * *', timezone: 'Africa/Malabo')] -Arguments/options for Symfony commands are passed as plain string:: - - use Symfony\Component\Console\Command\Command; - - #[AsCronTask('0 0 * * *', arguments: 'arg --my-option')] + // when applying this attribute to a Symfony console command, you can pass + // arguments and options to the command using the 'arguments' option: + #[AsCronTask('0 0 * * *', arguments: 'some_argument --some-option --another-option=some_value')] class MyCommand extends Command - { - protected function configure(): void - { - $this->addArgument('my-arg'); - $this->addOption('my-option'); - } - } .. versionadded:: 6.4 @@ -536,19 +527,10 @@ The ``#[AsPeriodicTask]`` attribute takes many parameters to customize the trigg } } -Arguments/options for Symfony commands are passed as plain string:: - - use Symfony\Component\Console\Command\Command; - - #[AsPeriodicTask(frequency: '1 day', arguments: 'arg --my-option')] + // when applying this attribute to a Symfony console command, you can pass + // arguments and options to the command using the 'arguments' option: + #[AsPeriodicTask(frequency: '1 day', arguments: 'some_argument --some-option --another-option=some_value')] class MyCommand extends Command - { - protected function configure(): void - { - $this->addArgument('my-arg'); - $this->addOption('my-option'); - } - } .. versionadded:: 6.4 From 833e338690d7250e983a89198d9e8e393f41d516 Mon Sep 17 00:00:00 2001 From: Thomas Calvet Date: Wed, 22 Jan 2025 09:25:10 +0100 Subject: [PATCH 31/38] Remove myself from active core members --- contributing/code/core_team.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contributing/code/core_team.rst b/contributing/code/core_team.rst index 5f41ec0b4cf..1b1703e4f93 100644 --- a/contributing/code/core_team.rst +++ b/contributing/code/core_team.rst @@ -70,7 +70,6 @@ Active Core Members * **Alexander M. Turek** (`derrabus`_); * **Jérémy Derussé** (`jderusse`_); * **Oskar Stark** (`OskarStark`_); - * **Thomas Calvet** (`fancyweb`_); * **Mathieu Santostefano** (`welcomattic`_); * **Kevin Bond** (`kbond`_); * **Jérôme Tamarelle** (`gromnan`_). @@ -114,7 +113,8 @@ Symfony contributions: * **Tobias Schultze** (`Tobion`_); * **Maxime Steinhausser** (`ogizanagi`_); * **Titouan Galopin** (`tgalopin`_); -* **Michael Cullum** (`michaelcullum`_). +* **Michael Cullum** (`michaelcullum`_); +* **Thomas Calvet** (`fancyweb`_). Core Membership Application ~~~~~~~~~~~~~~~~~~~~~~~~~~~ From b9c7139364f16c941099891df800930c1dfd724f Mon Sep 17 00:00:00 2001 From: Javier Spagnoletti Date: Sat, 18 Jan 2025 02:05:12 -0300 Subject: [PATCH 32/38] [Logging] Add references to the `ConsoleLogger` --- logging.rst | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/logging.rst b/logging.rst index c66312f88f9..0aabf9c7c5f 100644 --- a/logging.rst +++ b/logging.rst @@ -1,8 +1,10 @@ Logging ======= -Symfony comes with a minimalist `PSR-3`_ logger: :class:`Symfony\\Component\\HttpKernel\\Log\\Logger`. -In conformance with `the twelve-factor app methodology`_, it sends messages starting from the +Symfony comes with two minimalist `PSR-3`_ loggers: :class:`Symfony\\Component\\HttpKernel\\Log\\Logger` +for the HTTP context and :class:`Symfony\\Component\\Console\\Logger\\ConsoleLogger` for the +CLI context. +In conformance with `the twelve-factor app methodology`_, they send messages starting from the ``WARNING`` level to `stderr`_. The minimal log level can be changed by setting the ``SHELL_VERBOSITY`` environment variable: @@ -17,13 +19,18 @@ The minimal log level can be changed by setting the ``SHELL_VERBOSITY`` environm ========================= ================= The minimum log level, the default output and the log format can also be changed by -passing the appropriate arguments to the constructor of :class:`Symfony\\Component\\HttpKernel\\Log\\Logger`. -To do so, :ref:`override the "logger" service definition `. +passing the appropriate arguments to the constructor of :class:`Symfony\\Component\\HttpKernel\\Log\\Logger` +and :class:`Symfony\\Component\\Console\\Logger\\ConsoleLogger`. + +The :class:`Symfony\\Component\\HttpKernel\\Log\\Logger` class is available through the ``logger`` service. +To pass your configuration, you can :ref:`override the "logger" service definition `. + +For more information about ``ConsoleLogger``, see :doc:`/components/console/logger`. Logging a Message ----------------- -To log a message, inject the default logger in your controller or service:: +To log a message using the ``logger`` service, inject the default logger in your controller or service:: use Psr\Log\LoggerInterface; // ... @@ -55,7 +62,7 @@ Adding placeholders to log messages is recommended because: * It's better for security, because escaping can then be done by the implementation in a context-aware fashion. -The ``logger`` service has different methods for different logging levels/priorities. +The logger implementations has different methods for different logging levels/priorities. See `LoggerInterface`_ for a list of all of the methods on the logger. Monolog From fa4563353e498b9a6dc3ce20c3043f720fe1493e Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 22 Jan 2025 10:29:43 +0100 Subject: [PATCH 33/38] Minor tweaks --- logging.rst | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/logging.rst b/logging.rst index 0aabf9c7c5f..0ad36031dd5 100644 --- a/logging.rst +++ b/logging.rst @@ -3,9 +3,8 @@ Logging Symfony comes with two minimalist `PSR-3`_ loggers: :class:`Symfony\\Component\\HttpKernel\\Log\\Logger` for the HTTP context and :class:`Symfony\\Component\\Console\\Logger\\ConsoleLogger` for the -CLI context. -In conformance with `the twelve-factor app methodology`_, they send messages starting from the -``WARNING`` level to `stderr`_. +CLI context. In conformance with `the twelve-factor app methodology`_, they send messages +starting from the ``WARNING`` level to `stderr`_. The minimal log level can be changed by setting the ``SHELL_VERBOSITY`` environment variable: @@ -30,7 +29,7 @@ For more information about ``ConsoleLogger``, see :doc:`/components/console/logg Logging a Message ----------------- -To log a message using the ``logger`` service, inject the default logger in your controller or service:: +To log a message, inject the default logger in your controller or service:: use Psr\Log\LoggerInterface; // ... @@ -62,7 +61,7 @@ Adding placeholders to log messages is recommended because: * It's better for security, because escaping can then be done by the implementation in a context-aware fashion. -The logger implementations has different methods for different logging levels/priorities. +The ``logger`` service has different methods for different logging levels/priorities. See `LoggerInterface`_ for a list of all of the methods on the logger. Monolog From 75a197b4f99ac3e80357d884f477067888f79df3 Mon Sep 17 00:00:00 2001 From: Sarim Khan Date: Thu, 23 Jan 2025 00:24:18 +0600 Subject: [PATCH 34/38] Caddy configuration don't allow sub-directory php files to execute. Fixes #20593 --- setup/web_server_configuration.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/setup/web_server_configuration.rst b/setup/web_server_configuration.rst index acd76c342b9..e5e06a89feb 100644 --- a/setup/web_server_configuration.rst +++ b/setup/web_server_configuration.rst @@ -207,6 +207,9 @@ When using Caddy on the server, you can use a configuration like this: # otherwise, use PHP-FPM (replace "unix//var/..." with "127.0.0.1:9000" when using TCP) php_fastcgi unix//var/run/php/php8.3-fpm.sock { + # only fallback to root index.php aka front controller. + try_files {path} index.php + # optionally set the value of the environment variables used in the application # env APP_ENV "prod" # env APP_SECRET "" From 698c0e74c09b10fd032e26133546b31f9e0aab9b Mon Sep 17 00:00:00 2001 From: Javier Spagnoletti Date: Wed, 22 Jan 2025 18:51:24 -0300 Subject: [PATCH 35/38] Bump lowest maintained version to 6.4 --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ed323a8ee83..5c063058c02 100644 --- a/README.md +++ b/README.md @@ -27,8 +27,8 @@ We love contributors! For more information on how you can contribute, please rea the [Symfony Docs Contributing Guide](https://symfony.com/doc/current/contributing/documentation/overview.html). > [!IMPORTANT] -> Use `5.4` branch as the base of your pull requests, unless you are documenting a -> feature that was introduced *after* Symfony 5.4 (e.g. in Symfony 7.1). +> Use `6.4` branch as the base of your pull requests, unless you are documenting a +> feature that was introduced *after* Symfony 6.4 (e.g. in Symfony 7.2). Build Documentation Locally --------------------------- From aabca8e1d3d8b604ecd05a4e6532774369d02a40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dunglas?= Date: Wed, 22 Jan 2025 15:57:04 +0100 Subject: [PATCH 36/38] [RateLimiter] [Rate Limiter] Mention the Caddy/FrankenPHP rate limit module --- rate_limiter.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/rate_limiter.rst b/rate_limiter.rst index 970d71c8784..a53f679f1c8 100644 --- a/rate_limiter.rst +++ b/rate_limiter.rst @@ -16,8 +16,9 @@ time, but you can use them for your own features too. By definition, the Symfony rate limiters require Symfony to be booted in a PHP process. This makes them not useful to protect against `DoS attacks`_. Such protections must consume the least resources possible. Consider - using `Apache mod_ratelimit`_, `NGINX rate limiting`_ or proxies (like - AWS or Cloudflare) to prevent your server from being overwhelmed. + using `Apache mod_ratelimit`_, `NGINX rate limiting`_, + `Caddy HTTP rate limit module`_ (also supported by FrankenPHP) + or proxies (like AWS or Cloudflare) to prevent your server from being overwhelmed. .. _rate-limiter-policies: @@ -543,6 +544,7 @@ you can use a specific :ref:`named lock ` via the .. _`DoS attacks`: https://cheatsheetseries.owasp.org/cheatsheets/Denial_of_Service_Cheat_Sheet.html .. _`Apache mod_ratelimit`: https://httpd.apache.org/docs/current/mod/mod_ratelimit.html .. _`NGINX rate limiting`: https://www.nginx.com/blog/rate-limiting-nginx/ +.. _`Caddy HTTP rate limit module`: https://github.com/mholt/caddy-ratelimit .. _`token bucket algorithm`: https://en.wikipedia.org/wiki/Token_bucket .. _`PHP date relative formats`: https://www.php.net/manual/en/datetime.formats.php#datetime.formats.relative .. _`Race conditions`: https://en.wikipedia.org/wiki/Race_condition From cc4f5c511945a46b5c152b7f236cbcbe3ece2356 Mon Sep 17 00:00:00 2001 From: Nassim LOUNADI <39556046+nassimlnd@users.noreply.github.com> Date: Wed, 15 Jan 2025 16:29:46 +0100 Subject: [PATCH 37/38] Update translations --- translation.rst | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/translation.rst b/translation.rst index ed44b6d4912..98b90949b6a 100644 --- a/translation.rst +++ b/translation.rst @@ -145,7 +145,7 @@ different formats: .. code-block:: yaml # translations/messages.fr.yaml - Symfony is great: J'aime Symfony + Symfony is great: Symfony est génial .. code-block:: xml @@ -156,7 +156,7 @@ different formats: Symfony is great - J'aime Symfony + Symfony est génial @@ -166,14 +166,14 @@ different formats: // translations/messages.fr.php return [ - 'Symfony is great' => "J'aime Symfony", + 'Symfony is great' => 'Symfony est génial', ]; You can find more information on where these files :ref:`should be located `. Now, if the language of the user's locale is French (e.g. ``fr_FR`` or ``fr_BE``), -the message will be translated into ``J'aime Symfony``. You can also translate +the message will be translated into ``Symfony est génial``. You can also translate the message inside your :ref:`templates `. .. _translation-real-vs-keyword-messages: @@ -1219,7 +1219,7 @@ for the ``fr`` locale: Symfony is great - J'aime Symfony + Symfony est génial @@ -1228,13 +1228,13 @@ for the ``fr`` locale: .. code-block:: yaml # translations/messages.fr.yaml - Symfony is great: J'aime Symfony + Symfony is great: Symfony est génial .. code-block:: php // translations/messages.fr.php return [ - 'Symfony is great' => 'J\'aime Symfony', + 'Symfony is great' => 'Symfony est génial', ]; and for the ``en`` locale: @@ -1277,7 +1277,7 @@ To inspect all messages in the ``fr`` locale for the application, run: --------- ------------------ ---------------------- ------------------------------- State Id Message Preview (fr) Fallback Message Preview (en) --------- ------------------ ---------------------- ------------------------------- - unused Symfony is great J'aime Symfony Symfony is great + unused Symfony is great Symfony est génial Symfony is great --------- ------------------ ---------------------- ------------------------------- It shows you a table with the result when translating the message in the ``fr`` @@ -1297,7 +1297,7 @@ output: --------- ------------------ ---------------------- ------------------------------- State Id Message Preview (fr) Fallback Message Preview (en) --------- ------------------ ---------------------- ------------------------------- - Symfony is great J'aime Symfony Symfony is great + Symfony is great Symfony est génial Symfony is great --------- ------------------ ---------------------- ------------------------------- The state is empty which means the message is translated in the ``fr`` locale From 922fa713756b22cc71beab7b9571157275ddc46b Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Tue, 28 Jan 2025 08:57:41 +0100 Subject: [PATCH 38/38] fix typo --- setup/web_server_configuration.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup/web_server_configuration.rst b/setup/web_server_configuration.rst index e5e06a89feb..58935bf5352 100644 --- a/setup/web_server_configuration.rst +++ b/setup/web_server_configuration.rst @@ -207,7 +207,7 @@ When using Caddy on the server, you can use a configuration like this: # otherwise, use PHP-FPM (replace "unix//var/..." with "127.0.0.1:9000" when using TCP) php_fastcgi unix//var/run/php/php8.3-fpm.sock { - # only fallback to root index.php aka front controller. + # only fall back to root index.php aka front controller. try_files {path} index.php # optionally set the value of the environment variables used in the application