Skip to content
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

Adding installation instructions for Symfony #3744

Merged
merged 1 commit into from Sep 28, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 12 additions & 3 deletions doc/functions/template_from_string.rst
Expand Up @@ -21,9 +21,18 @@ any related error message:

.. note::

The ``template_from_string`` function is not available by default. You
must add the ``\Twig\Extension\StringLoaderExtension`` extension explicitly when
creating your Twig environment::
The ``template_from_string`` function is not available by default.

In Symfony projects, you need to load it in your ``services.yaml``::

services:
Twig\Extension\StringLoaderExtension:

or ``services.php``::

$services->set(\Twig\Extension\StringLoaderExtension::class);

Otherwise, add the extension explicitly on the Twig environment::

$twig = new \Twig\Environment(...);
$twig->addExtension(new \Twig\Extension\StringLoaderExtension());
Expand Down