Skip to content

Commit

Permalink
Adding installation instructions for Symfony
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasLandauer committed Sep 21, 2022
1 parent 40b6f59 commit 5280bbf
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions doc/functions/template_from_string.rst
Expand Up @@ -17,9 +17,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

0 comments on commit 5280bbf

Please sign in to comment.