Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Documented the use of binary values as container params #9780

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions service_container/parameters.rst
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,43 @@ Setting PHP constants as parameters is also supported:
$container->setParameter('global.constant.value', GLOBAL_CONSTANT);
$container->setParameter('my_class.constant.value', My_Class::CONSTANT_NAME);

Binary Values as Parameters
---------------------------

.. versionadded:: 4.1
The support for binary values in container parameters was introduced in
Symfony 4.1

If the value of a container parameter is a binary value, set it as a base64
encoded value in YAML and XML configs and use the escape sequences in PHP:

.. configuration-block::

.. code-block:: yaml

# config/services.yaml
parameters:
some_parameter: !!binary VGhpcyBpcyBhIEJlbGwgY2hhciAH

.. code-block:: xml

<!-- config/services.xml -->
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services
http://symfony.com/schema/dic/services/services-1.0.xsd">

<parameters>
<parameter key="some_parameter" type="binary">VGhpcyBpcyBhIEJlbGwgY2hhciAH</parameter>
</parameters>
</container>

.. code-block:: php

// config/services.php
$container->setParameter('some_parameter', 'This is a Bell char \x07');

PHP Keywords in XML
-------------------

Expand Down