PHPackages                             php-ansi-code/php-ansi-code - 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. php-ansi-code/php-ansi-code

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

php-ansi-code/php-ansi-code
===========================

A short description of what your package does

01PHP

Since Jan 19Pushed 2y ago1 watchersCompare

[ Source](https://github.com/ehsan-shahbakhsh/PHPAnsiCode)[ Packagist](https://packagist.org/packages/php-ansi-code/php-ansi-code)[ RSS](/packages/php-ansi-code-php-ansi-code/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

PHPAnsiCode
===========

[](#phpansicode)

PHPAnsiCode is a library so that you can easily apply desired styles to your texts in the terminal.

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

[](#installation)

```
composer require php-ansi-code/php-ansi-code
```

Example
-------

[](#example)

- [`index.php`](https://github.com/ehsan-shahbakhsh/PHPAnsiCode/blob/main/example/index.php)

Add Components To Project
-------------------------

[](#add-components-to-project)

```
require_once 'vendor/autoload.php'; // Original root
require_once '../vendor/autoload.php'; // Example folder root
```

How To Use
----------

[](#how-to-use)

```
echo Ansi::color('red', 'This is PHPAnsiCode lib');
```

```
echo Ansi::red('This is PHPAnsiCode lib');
```

```
echo (new Ansi)(['color' => 'red', 'text' => 'This is PHPAnsiCode lib']);
```

```
echo (new Ansi)('red', 'This is PHPAnsiCode lib');
```

```
echo (new Ansi)->bgGreen('This is PHPAnsiCode lib');
```

```
echo Ansi::rgb(rand(0, 255), rand(0, 255), rand(0, 255), 'This is PHPAnsiCode lib');
```

```
// open tags
echo Ansi::tagsToColor('Hi my name is ehsan ');
```

```
// open close tags
echo Ansi::tagsToColor('Hi my name is ehsan', true);
```

```
// Use multiple items at the same time
echo Ansi::bold(Ansi::scColor(rand(0, 255), 'My name is ehsan'));
```

License
-------

[](#license)

The PHPAnsiCode library has an MIT license. You can read this file [LICENSE](LICENSE) for more information.

###  Health Score

12

—

LowBetter than 0% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity1

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity19

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/0373dab262938ddf84e5b97ee16bc2d2578afb006d7db53418a1cbdc74c28d78?d=identicon)[ehsan-shahbakhsh](/maintainers/ehsan-shahbakhsh)

---

Top Contributors

[![ehsan-shahbakhsh](https://avatars.githubusercontent.com/u/131532702?v=4)](https://github.com/ehsan-shahbakhsh "ehsan-shahbakhsh (16 commits)")

### Embed Badge

![Health badge](/badges/php-ansi-code-php-ansi-code/health.svg)

```
[![Health](https://phpackages.com/badges/php-ansi-code-php-ansi-code/health.svg)](https://phpackages.com/packages/php-ansi-code-php-ansi-code)
```

###  Alternatives

[strictus/strictus

Strict Typing for local variables in PHP

1606.9k](/packages/strictus-strictus)[wodby/wordpress-composer

Project template for WordPress projects with composer

691.1k](/packages/wodby-wordpress-composer)[ollyxar/websockets-chat

Laravel WebSockets Chat

431.1k](/packages/ollyxar-websockets-chat)

PHPackages © 2026

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