PHPackages                             deft/twig-aop-extension - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Templating &amp; Views](/categories/templating)
4. /
5. deft/twig-aop-extension

ActiveLibrary[Templating &amp; Views](/categories/templating)

deft/twig-aop-extension
=======================

Twig extension that provides AOP capabilities

56

Since Jul 9Pushed 12y ago2 watchersCompare

[ Source](https://github.com/deft/twig-aop-extension)[ Packagist](https://packagist.org/packages/deft/twig-aop-extension)[ RSS](/packages/deft-twig-aop-extension/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

AOP for Twig Extension
======================

[](#aop-for-twig-extension)

Introduction
------------

[](#introduction)

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.

For more information on AOP in general, see [http://en.wikipedia.org/wiki/Aspect-oriented\_programming](http://en.wikipedia.org/wiki/Aspect-oriented_programming)

Installation
------------

[](#installation)

The recommended way of installing this extension is by adding `"deft/twig-aop-extension": "~0.1"` to the `require` section of your composer.json.

Important concepts
------------------

[](#important-concepts)

Below is a summary of the most important concepts in AOP and how they're mapped to the domain of Twig.

**Aspect**Module that encapsulates a concern; collection of *pointcuts* and *advice* bodies.

**Pointcut**A predicate that matches one or more *join points*.

**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.

**Advice**Code that is associated with a pointcut. Types of advice:

- Before: The advice runs before the join point;
- After: The advice runs after the join point;
- Around: The advice runs *instead* of the join point. The advice stil does have the possibility to execute the original join point, but has to explicitly make this call.

**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.

Usage
-----

[](#usage)

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.

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/badce9dc5b7e3eca22163e77346853cc6ab8890d06d8827c091cce8e0deff75c?d=identicon)[jankramer](/maintainers/jankramer)

### Embed Badge

![Health badge](/badges/deft-twig-aop-extension/health.svg)

```
[![Health](https://phpackages.com/badges/deft-twig-aop-extension/health.svg)](https://phpackages.com/packages/deft-twig-aop-extension)
```

###  Alternatives

[mustache/mustache

A Mustache implementation in PHP.

3.3k44.6M291](/packages/mustache-mustache)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[whitecube/nova-flexible-content

Flexible Content &amp; Repeater Fields for Laravel Nova.

8053.0M25](/packages/whitecube-nova-flexible-content)[mopa/bootstrap-bundle

Easy integration of twitters bootstrap into symfony2

7042.9M33](/packages/mopa-bootstrap-bundle)[limenius/react-bundle

Client and Server-side react rendering in a Symfony Bundle

3871.2M](/packages/limenius-react-bundle)[nicmart/string-template

StringTemplate is a very simple string template engine for php. I've written it to have a thing like sprintf, but with named and nested substutions.

2101.7M30](/packages/nicmart-string-template)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
