PHPackages                             mothership/twig-bem-bundle - 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. mothership/twig-bem-bundle

ActiveSymfony-bundle[Templating &amp; Views](/categories/templating)

mothership/twig-bem-bundle
==========================

Symfony bundle that adds BEM helper functions to twig

00PHP

Since Jul 6Pushed 3y ago2 watchersCompare

[ Source](https://github.com/mothership-gmbh/TwigBemBundle)[ Packagist](https://packagist.org/packages/mothership/twig-bem-bundle)[ RSS](/packages/mothership-twig-bem-bundle/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

TwigBemBundle
=============

[](#twigbembundle)

This symfony bundle provides BEM helper functions to use in twig template.

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

[](#installation)

Make sure Composer is installed globally, as explained in the [installation chapter](https://getcomposer.org/doc/00-intro.md)of the Composer documentation.

### Applications that use Symfony Flex

[](#applications-that-use-symfony-flex)

Open a command console, enter your project directory and execute:

```
$ composer require mothership/twig-bem-bundle
```

### Applications that don't use Symfony Flex

[](#applications-that-dont-use-symfony-flex)

#### Step 1: Download the Bundle

[](#step-1-download-the-bundle)

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:

```
$ composer require mothership/twig-bem-bundle
```

#### Step 2: Enable the Bundle

[](#step-2-enable-the-bundle)

Then, enable the bundle by adding it to the list of registered bundles in the `config/bundles.php` file of your project:

```
// config/bundles.php

return [
    // ...
    Mothership\TwigBemBundle\TwigBemBundle::class => ['all' => true],
];
```

Usage
-----

[](#usage)

### bemBlock(blockName, modifiers = \[\])

[](#bemblockblockname-modifiers--)

Use it like this: ``

Parameters:

- *blockName*: String
- *modifiers*: (optional) String\[\]

### bemElem(elementName, modifiers = \[\])

[](#bemelemelementname-modifiers--)

This function can only be used if there is a `bemBlock` defined in the parent tree. Use it like this: ``

Parameters:

- *elementName*: String
- *modifiers*: (optional) String\[\]

Example
-------

[](#example)

```
{% block body %}

{% endblock %}
```

This will be the corresponding output/markup:

```

```

###  Health Score

14

—

LowBetter than 2% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity0

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity25

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/31ea5c2a7c0f4d9beeb077750260256b4e0836f74b4f194c4bc6a513381b61d9?d=identicon)[Mothership](/maintainers/Mothership)

---

Top Contributors

[![niklaswolf](https://avatars.githubusercontent.com/u/16021919?v=4)](https://github.com/niklaswolf "niklaswolf (2 commits)")

### Embed Badge

![Health badge](/badges/mothership-twig-bem-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/mothership-twig-bem-bundle/health.svg)](https://phpackages.com/packages/mothership-twig-bem-bundle)
```

###  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)[symfony/ux-icons

Renders local and remote SVG icons in your Twig templates.

545.8M69](/packages/symfony-ux-icons)

PHPackages © 2026

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