PHPackages                             beryllium/twig-ansi-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. beryllium/twig-ansi-extension

Abandoned → [sensiolabs/ansi-to-html](/?search=sensiolabs%2Fansi-to-html)Library[Templating &amp; Views](/categories/templating)

beryllium/twig-ansi-extension
=============================

A twig extension for sensiolabs/ansi-to-html

v1.0.0(13y ago)07MITPHP

Since Mar 23Pushed 13y ago1 watchersCompare

[ Source](https://github.com/beryllium/TwigAnsiExtension)[ Packagist](https://packagist.org/packages/beryllium/twig-ansi-extension)[ RSS](/packages/beryllium-twig-ansi-extension/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependencies (2)Versions (2)Used By (0)

ANSI to HTML5 Converter Extension for Twig
==========================================

[](#ansi-to-html5-converter-extension-for-twig)

Inspired by the [sensiolabs/ansi-to-html](https://github.com/sensiolabs/ansi-to-html) release, I wanted to create a quick Twig extension for rendering ANSI as HTML inside Twig templates.

### Installation

[](#installation)

Add the requirement to your composer.json (it should fetch ansi-to-html automatically):

```
    {
      "require": {
        "beryllium/twig-ansi-extension": "dev-master"
      }
    }
```

### Usage

[](#usage)

First, get [sensiolabs/ansi-to-html](https://github.com/sensiolabs/ansi-to-html) configured the way you like it. Then you can do this:

Default usage:

```
    $twig->addExtension(new Beryllium\TwigAnsiExtension\TwigAnsiExtension($ansi));
```

Optional "themed" usage:

```
    $twig->addExtension(new Beryllium\TwigAnsiExtension\TwigAnsiExtension($ansi,$theme));
```

And now you can use it inside twig, like so:

```
    {{ 'my_ansi_string'|ansi|raw }}
```

If you opted to add the theme, you should be able to output the style CSS like so:

```
    {{ get_ansi_css()|raw }}
```

### Current Status

[](#current-status)

At the moment this is just a quick prototype, I haven't even tested the theme support. In my local environment, I'm using the "colordiff" system utility to generate sample ANSI output. Other examples of ANSI output include PHPUnit with colors enabled, and especially PHPUnit results with [NyanCat](https://github.com/whatthejeff/nyancat-phpunit-resultprinter) output enabled (although I don't think streaming would work).

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity63

Established project with proven stability

 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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

4847d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/602491?v=4)[Kevin Boyd](/maintainers/beryllium)[@beryllium](https://github.com/beryllium)

---

Top Contributors

[![beryllium](https://avatars.githubusercontent.com/u/602491?v=4)](https://github.com/beryllium "beryllium (7 commits)")

---

Tags

twigextensionansi

### Embed Badge

![Health badge](/badges/beryllium-twig-ansi-extension/health.svg)

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

###  Alternatives

[symfony/ux-twig-component

Twig components for Symfony

22017.2M313](/packages/symfony-ux-twig-component)[symfony/ux-live-component

Live components for Symfony

1636.5M115](/packages/symfony-ux-live-component)[tales-from-a-dev/twig-tailwind-extra

A Twig extension for Tailwind

36982.8k12](/packages/tales-from-a-dev-twig-tailwind-extra)[symfony/ux-toolkit

A tool to easily create a design system in your Symfony app with customizable, well-crafted Twig components

1682.8k1](/packages/symfony-ux-toolkit)[umanit/twig-image-extension

An extension to facilitate the integration of responsive images' markup in Twig templates.

1043.8k](/packages/umanit-twig-image-extension)[mati365/ckeditor5-symfony

CKEditor 5 integration for Symfony

261.9k](/packages/mati365-ckeditor5-symfony)

PHPackages © 2026

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