PHPackages                             youlead-bow/twig - 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. youlead-bow/twig

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

youlead-bow/twig
================

Provides many extension tag

v1.5.3(1y ago)258GPL-3.0-onlyPHPPHP &gt;=8.1

Since Jun 21Pushed 1y ago1 watchersCompare

[ Source](https://github.com/youlead-bow/twig)[ Packagist](https://packagist.org/packages/youlead-bow/twig)[ RSS](/packages/youlead-bow-twig/feed)WikiDiscussions main Synced 2w ago

READMEChangelog (10)Dependencies (2)Versions (15)Used By (0)

Twig extensions
===============

[](#twig-extensions)

Provides a {% switch %} tag for Twig switch case statements.
Provides a {% includeDir %} tag for Twig
Provides a {% useDir %} tag for Twig

1. switch
---------

[](#1-switch)

### Usage

[](#usage)

```
{% switch myVar %}
    {% case 'value1' %}
        {# ...code here to run for value1 #}
    {% case 'value2' %}
        {# ...code here to run for value2 #}
    {% default %}
        {# ...code here to run for default when no case matched #}
{% endswitch %}
```

2. includeDir
-------------

[](#2-includedir)

### Usage

[](#usage-1)

```
{% includeDir '/popups' %}
```

The files in the directory will be included alphabetically.

### Recursive usage

[](#recursive-usage)

To include all files within a given directory recursive simply add the keyword *recursive* to your include statement:

```

    {% includeDir '/popups' recursive %}

```

Now also the popups from the directories */popups/user* and */popups/system* etc. will be included.

**Caution:** The templates will be included alphabetically as well, including the directories. Thus the template */popups/footer.twig* will be included before the templates from the directory */popups/system* followed by */popups/user* followed by a possible */popups/zebraHeader.twig*. It is recommended to use includeDir only for templates which do **not** require a specific order.

### Variables

[](#variables)

As known from the Twig Core *include* you can control the available variables with the keywords *with* and *only* (compare: [include](https://twig.symfony.com/doc/2.x/tags/include.html))

```

    {# only the foo variable will be accessible #}
    {% includeDir '/modals' recursive with {'foo': 'bar'} only %}

```

2. useDir
---------

[](#2-usedir)

### Usage

[](#usage-2)

```
{% useDir '/form/specials' %}
```

The files in the directory will be included alphabetically.

### Recursive usage

[](#recursive-usage-1)

To use all files within a given directory recursive simply add the keyword *recursive* to your use statement:

```
{% useDir '/form/specials' recursive %}
```

Now also the popups from the directories */form/specials* and */form/field* etc. will be used.

**Caution:** The templates will be used alphabetically as well, including the directories. Thus the template */form/field/select.twig* will be included before the templates from the directory *form/specials*. It is recommended to use useDir only for templates which do **not** require a specific order.

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance42

Moderate activity, may be stable

Popularity11

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 90% of commits — single point of failure

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.

###  Release Activity

Cadence

Every ~52 days

Recently: every ~62 days

Total

14

Last Release

467d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/31312163?v=4)[Youlead](/maintainers/youlead-bow)[@youlead-bow](https://github.com/youlead-bow)

---

Top Contributors

[![flavou45](https://avatars.githubusercontent.com/u/46626945?v=4)](https://github.com/flavou45 "flavou45 (18 commits)")[![youlead-bow](https://avatars.githubusercontent.com/u/31312163?v=4)](https://github.com/youlead-bow "youlead-bow (2 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/youlead-bow-twig/health.svg)

```
[![Health](https://phpackages.com/badges/youlead-bow-twig/health.svg)](https://phpackages.com/packages/youlead-bow-twig)
```

###  Alternatives

[craftcms/cms

Craft CMS

3.6k3.7M3.4k](/packages/craftcms-cms)

PHPackages © 2026

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