Skip to content

Commit f8ea3a7

Browse files
committed
Merge branch '6.4' into 7.0
* 6.4: [DependencyInjection] Add defined prefix for env var processor
2 parents 351753c + 7f31c49 commit f8ea3a7

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

configuration/env_var_processors.rst

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -786,6 +786,44 @@ Symfony provides the following env var processors:
786786

787787
The ``env(enum:...)`` env var processor was introduced in Symfony 6.2.
788788

789+
``env(defined:NO_FOO)``
790+
Evaluates to ``true`` if the env var exists and its value is from ``''``
791+
(an empty string) or ``null``; it returns ``false`` otherwise.
792+
793+
.. configuration-block::
794+
795+
.. code-block:: yaml
796+
797+
# config/services.yaml
798+
parameters:
799+
typed_env: '%env(defined:FOO)%'
800+
801+
.. code-block:: xml
802+
803+
<!-- config/services.xml -->
804+
<?xml version="1.0" encoding="UTF-8" ?>
805+
<container xmlns="http://symfony.com/schema/dic/services"
806+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
807+
xmlns:framework="http://symfony.com/schema/dic/symfony"
808+
xsi:schemaLocation="http://symfony.com/schema/dic/services
809+
https://symfony.com/schema/dic/services/services-1.0.xsd
810+
http://symfony.com/schema/dic/symfony
811+
https://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
812+
813+
<parameters>
814+
<parameter key="typed_env"'%env(defined:FOO)%</parameter>
815+
</parameters>
816+
</container>
817+
818+
.. code-block:: php
819+
820+
// config/services.php
821+
$container->setParameter('typed_env', '%env(defined:FOO)%');
822+
823+
.. versionadded:: 6.4
824+
825+
The ``env(defined:...)`` env var processor was introduced in Symfony 6.4.
826+
789827
It is also possible to combine any number of processors:
790828
791829
.. configuration-block::

0 commit comments

Comments
 (0)