PHPackages                             voku/ansi-to-html - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. voku/ansi-to-html

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

voku/ansi-to-html
=================

A library to convert a text with ANSI codes to HTML

v3.0.0(3y ago)31221[1 issues](https://github.com/voku/ansi-to-html/issues)[1 PRs](https://github.com/voku/ansi-to-html/pulls)MITPHPPHP ~7.0|~8.0

Since Mar 19Pushed 3y ago2 watchersCompare

[ Source](https://github.com/voku/ansi-to-html)[ Packagist](https://packagist.org/packages/voku/ansi-to-html)[ RSS](/packages/voku-ansi-to-html/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependencies (1)Versions (12)Used By (0)

[![Build Status](https://camo.githubusercontent.com/056af6cf47cddbe524147f4d45c7f3d3eb6c98f3fc0cc0f7292207ba6aa3a385/68747470733a2f2f7472617669732d63692e636f6d2f766f6b752f616e73692d746f2d68746d6c2e7376673f6272616e63683d6d6173746572)](https://travis-ci.com/voku/ansi-to-html)[![Coverage Status](https://camo.githubusercontent.com/68117572758b9ae877d6458357d5696a2b3153e33f60a160d7b6d4f54495dec0/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f766f6b752f616e73692d746f2d68746d6c2f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/voku/ansi-to-html?branch=master)

ANSI to HTML5 Converter for PHP
===============================

[](#ansi-to-html5-converter-for-php)

\*\*\* this is only a fork of "" \*\*\*

This small library only does one thing: converting a text containing ANSI codes to an HTML5 fragment:

```
require_once __DIR__ . '/vendor/autoload.php';

use voku\AnsiConverter\AnsiToHtmlConverter;

$converter = new AnsiToHtmlConverter();

$html = $converter->convert($ansi);
```

The `$ansi` variable should contain a text with ANSI codes, and `$html` will contain the converted HTML5 version of it.

You can then output the HTML5 fragment in any HTML document:

```

        10px 15px; font-family: monospace;"
        >

```

The converter supports different color themes:

```
use voku\AnsiConverter\Theme\SolarizedTheme;

$theme = new SolarizedTheme();
$converter = new AnsiToHtmlConverter($theme);
```

By default, the colors are inlined into the HTML, but you can also use classes by turning off style inlining:

```
$converter = new AnsiToHtmlConverter($theme, false);
```

And the `asCss()` method of the theme object lets you retrieve the theme styles as a CSS snippet:

```
$styles = $theme->asCss();
```

which you can then use in your HTML document:

```

            .ansi_box { overflow: auto; padding: 10px 15px; font-family: monospace; }

```

You can also override the theme by calling the `setTheme()` method with a new theme.

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance13

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity75

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

Every ~374 days

Recently: every ~659 days

Total

10

Last Release

1438d ago

Major Versions

v1.1.2 → v2.0.02018-08-31

v2.1.0 → v3.0.02022-06-07

PHP version history (3 changes)v1.0.0PHP &gt;=5.3.0

v2.0.0PHP ~5.5|~7.0

v3.0.0PHP ~7.0|~8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/6456fe693db197c458272cb758bf78958bc7d3e787ccd59db4bf3cf41654316a?d=identicon)[voku](/maintainers/voku)

---

Top Contributors

[![fabpot](https://avatars.githubusercontent.com/u/47313?v=4)](https://github.com/fabpot "fabpot (13 commits)")[![rquadling](https://avatars.githubusercontent.com/u/12801?v=4)](https://github.com/rquadling "rquadling (11 commits)")[![voku](https://avatars.githubusercontent.com/u/264695?v=4)](https://github.com/voku "voku (8 commits)")[![skolodyazhnyy](https://avatars.githubusercontent.com/u/576301?v=4)](https://github.com/skolodyazhnyy "skolodyazhnyy (1 commits)")[![lyrixx](https://avatars.githubusercontent.com/u/408368?v=4)](https://github.com/lyrixx "lyrixx (1 commits)")[![cordoval](https://avatars.githubusercontent.com/u/328359?v=4)](https://github.com/cordoval "cordoval (1 commits)")[![adam187](https://avatars.githubusercontent.com/u/156628?v=4)](https://github.com/adam187 "adam187 (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/voku-ansi-to-html/health.svg)

```
[![Health](https://phpackages.com/badges/voku-ansi-to-html/health.svg)](https://phpackages.com/packages/voku-ansi-to-html)
```

PHPackages © 2026

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