PHPackages                             drupal-pattern-lab/bem-twig-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. drupal-pattern-lab/bem-twig-extension

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

drupal-pattern-lab/bem-twig-extension
=====================================

Twig function that inserts static classes into Pattern Lab and adds them to the Attributes object in Drupal

v1.0.1(8y ago)14473.8k↑37%7[1 issues](https://github.com/drupal-pattern-lab/bem-twig-extension/issues)[3 PRs](https://github.com/drupal-pattern-lab/bem-twig-extension/pulls)1MITPHP

Since Aug 17Pushed 6y agoCompare

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

READMEChangelogDependenciesVersions (3)Used By (1)

bem-twig-extension
==================

[](#bem-twig-extension)

Twig function that inserts static classes into Pattern Lab and adds them to the Attributes object in Drupal

Requirements
------------

[](#requirements)

To use in Pattern Lab, simply place in the `_twig-components/functions` directory. Drupal needs to recognize the Twig function, so something like [Unified Twig Extensions](https://github.com/drupal-pattern-lab/unified-twig-extensions/) module can be helpful for that.

Usage (4 arguments)
-------------------

[](#usage-4-arguments)

#### Simple block name (required argument):

[](#simple-block-name-required-argument)

``

This creates:

``

#### Block with modifiers (optional array allowing multiple modifiers):

[](#block-with-modifiers-optional-array-allowing-multiple-modifiers)

``

This creates:

``

#### Element with modifiers and blockname (optional):

[](#element-with-modifiers-and-blockname-optional)

``

This creates:

``

#### Element with blockname, but no modifiers (optional):

[](#element-with-blockname-but-no-modifiers-optional)

``

This creates:

``

#### Element with modifiers, blockname and extra classes (optional - in case you need non-BEM classes):

[](#element-with-modifiers-blockname-and-extra-classes-optional---in-case-you-need-non-bem-classes)

``

This creates:

``

#### Element with extra classes only (optional):

[](#element-with-extra-classes-only-optional)

``

This creates:

``

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity44

Moderate usage in the ecosystem

Community17

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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

Unknown

Total

1

Last Release

3197d ago

### Community

Maintainers

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

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

![](https://www.gravatar.com/avatar/73b44976b3c063623653087ac776773b58867dea753f75138cfcdb7096872545?d=identicon)[sghoweri](/maintainers/sghoweri)

---

Top Contributors

[![bryce-gilhome](https://avatars.githubusercontent.com/u/30160838?v=4)](https://github.com/bryce-gilhome "bryce-gilhome (2 commits)")[![ModulesUnraveled](https://avatars.githubusercontent.com/u/1663810?v=4)](https://github.com/ModulesUnraveled "ModulesUnraveled (2 commits)")[![JeffTomlinson](https://avatars.githubusercontent.com/u/2602202?v=4)](https://github.com/JeffTomlinson "JeffTomlinson (1 commits)")

### Embed Badge

![Health badge](/badges/drupal-pattern-lab-bem-twig-extension/health.svg)

```
[![Health](https://phpackages.com/badges/drupal-pattern-lab-bem-twig-extension/health.svg)](https://phpackages.com/packages/drupal-pattern-lab-bem-twig-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)
