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 --------------------------- diff --git a/components/console/helpers/questionhelper.rst b/components/console/helpers/questionhelper.rst index 2670ec3084a..3dc97d5c0d3 100644 --- a/components/console/helpers/questionhelper.rst +++ b/components/console/helpers/questionhelper.rst @@ -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 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 ~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/logging.rst b/logging.rst index c66312f88f9..0ad36031dd5 100644 --- a/logging.rst +++ b/logging.rst @@ -1,9 +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 -``WARNING`` level to `stderr`_. +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,8 +18,13 @@ 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 ----------------- diff --git a/mercure.rst b/mercure.rst index f37c40ddee7..42ad9798d3c 100644 --- a/mercure.rst +++ b/mercure.rst @@ -309,6 +309,12 @@ as patterns: } +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:: Test if a URI Template matches a URL using `the online debugger`_ diff --git a/rate_limiter.rst b/rate_limiter.rst index e08d4576b95..6c158ee52d0 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: @@ -536,6 +537,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 diff --git a/scheduler.rst b/scheduler.rst index eb018ca01dd..ddc40aa4952 100644 --- a/scheduler.rst +++ b/scheduler.rst @@ -455,6 +455,11 @@ The attribute takes more parameters to customize the trigger:: // defines the timezone to use #[AsCronTask('0 0 * * *', timezone: 'Africa/Malabo')] + // 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 + .. _scheduler-attributes-periodic-task: ``AsPeriodicTask`` Example @@ -499,6 +504,11 @@ The ``#[AsPeriodicTask]`` attribute takes many parameters to customize the trigg } } + // 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 + Managing Scheduled Messages --------------------------- diff --git a/setup/web_server_configuration.rst b/setup/web_server_configuration.rst index acd76c342b9..58935bf5352 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 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 # env APP_ENV "prod" # env APP_SECRET "" diff --git a/translation.rst b/translation.rst index 96736dfd53a..2300f9ef2f6 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: @@ -1192,7 +1192,7 @@ for the ``fr`` locale: Symfony is great - J'aime Symfony + Symfony est génial @@ -1201,13 +1201,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: @@ -1250,7 +1250,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`` @@ -1270,7 +1270,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