dev-master
9999999-devTwig extension that provides AOP capabilities
MIT
The Requires
The Development Requires
by Jan Kramer
twig aop
Wallogit.com
2017 © Pedro Peláez
Twig extension that provides AOP capabilities
This extension adds Aspect-oriented programming (AOP) features to the Twig templating language. AOP makes it possible to encapsulate cross-cutting concerns (e.g. logging, security, etc.) into distinct modules, which makes it possible to reduce code duplication and allows a better separation of concerns., (*1)
For more information on AOP in general, see http://en.wikipedia.org/wiki/Aspect-oriented_programming, (*2)
The recommended way of installing this extension is by adding
"deft/twig-aop-extension": "~0.1" to the require section of your composer.json., (*3)
Below is a summary of the most important concepts in AOP and how they're mapped to the domain of Twig., (*4)
Aspect Module that encapsulates a concern; collection of pointcuts and advice bodies., (*5)
Pointcut A predicate that matches one or more join points., (*6)
Join point Point in the execution flow. In Twig, every node is a join point (1-1 relation) and pointcuts are therefore defined by whether they match a given node or not., (*7)
Advice Code that is associated with a pointcut. Types of advice:, (*8)
Aspect weaver The processor that actually adds the advice to the compiled result at the associated join points. In Twig, this can be accomplished by modifying the node tree just using node visitors, just before it is compiled., (*9)
This section is still under construction, but you can have a look at test/Deft/Twig/AopExtension/IntegrationTestCase which should provide some guidelines on usage., (*10)
Twig extension that provides AOP capabilities
MIT
twig aop