We know services. And that makes us really dangerous. Let me show you one
of your new tricks.
Twig gives us a ton of built-in functions, filters, tests and other goodies.
Everything in Twig - like the path function, the upper filter and
even “tests” like divisibleby are loaded into Twig by “extensions”, which
are basically Twig “plugins”.
So can we add our own custom Twig stuff? Of course we can, and it’s really
What other tags are there? Well I’m so glad you asked. In the reference
section of the docs, we have a fantastic page called The Dependency Injection Tags.
If you’re doing something really custom, or awesome, in Symfony, you’re probably
using a dependency injection tag. You won’t use them too often, but they’re
key to unlocking really powerful features.
A very important tag is kernel.event_listener, which allows you to register
“hooks” inside Symfony at various stages of the request lifecycle. That topic
is for another screencast, but we’ll cover a very similar subject next: Doctrine