Skip to content

Commit 8d519bb

Browse files
committed
minor #9035 Mention the official Twig extensions (javiereguiluz)
This PR was merged into the 4.0 branch. Discussion ---------- Mention the official Twig extensions This finishes #7616 in a more concise way now that we can assume that the app is using Flex. Commits ------- 0084f14 Mention the official Twig extensions
2 parents 103bfe0 + 0084f14 commit 8d519bb

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

templating/twig_extension.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,17 @@ If you need to create custom Twig functions, filters, tests or more, you'll need
88
to create a Twig extension. You can read more about `Twig Extensions`_ in the Twig
99
documentation.
1010

11+
.. tip::
12+
13+
Before writing your own Twig extension, check if the filter/function that
14+
you need is already implemented in the :doc:`Symfony Twig extensions </reference/twig_reference>`.
15+
Check also the `official Twig extensions`_, which can be installed in your
16+
application as follows:
17+
18+
.. code-block:: terminal
19+
20+
$ composer require twig/extensions
21+
1122
Create the Extension Class
1223
--------------------------
1324

@@ -62,6 +73,7 @@ you're done! Symfony will automatically know about your new service and add the
6273

6374
You can now start using your filter in any Twig template.
6475

76+
.. _`official Twig extensions`: https://github.com/twigphp/Twig-extensions
6577
.. _`Twig extensions documentation`: http://twig.sensiolabs.org/doc/advanced.html#creating-an-extension
6678
.. _`global variables`: http://twig.sensiolabs.org/doc/advanced.html#id1
6779
.. _`functions`: http://twig.sensiolabs.org/doc/advanced.html#id2

0 commit comments

Comments
 (0)