diff --git a/components/dotenv.rst b/components/dotenv.rst index 6d7a4adffba..397962df817 100644 --- a/components/dotenv.rst +++ b/components/dotenv.rst @@ -49,7 +49,7 @@ Load a ``.env`` file in your PHP application via ``Dotenv::load()``:: Given the following ``.env`` file content: -.. code-block:: bash +.. code-block:: shell # .env DB_USER=root @@ -76,11 +76,11 @@ shell scripts: .. code-block:: terminal - source .env + $ source .env Add comments by prefixing them with ``#``: -.. code-block:: bash +.. code-block:: shell # Database credentials DB_USER=root @@ -88,14 +88,25 @@ Add comments by prefixing them with ``#``: Use environment variables in values by prefixing variables with ``$``: -.. code-block:: bash +.. code-block:: shell DB_USER=root DB_PASS=${DB_USER}pass # Include the user as a password prefix +.. note:: + + When using the Dotenv component within the Symfony Framework, beware that + variables can't contain container parameters because they are not resolved: + + .. code-block:: shell + + # '%kernel.project_dir%' is not resolved, so the value of this + # variable won't be the expected one and the application won't work + DATABASE_URL=sqlite:///%kernel.project_dir%/test.db + Embed commands via ``$()`` (not supported on Windows): -.. code-block:: bash +.. code-block:: shell START_TIME=$(date) pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy