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

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

chrissileinus/ansi-php
======================

A simple Library with static classes they generate ANSI Control Sequences and return the code as a string.

0.1.0(4y ago)0251MITPHPPHP &gt;=7.4

Since Nov 3Pushed 4y ago1 watchersCompare

[ Source](https://github.com/chrissileinus/ansiPHP)[ Packagist](https://packagist.org/packages/chrissileinus/ansi-php)[ RSS](/packages/chrissileinus-ansi-php/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (1)DependenciesVersions (2)Used By (1)

ansiPHP
=======

[](#ansiphp)

A simple Library with static classes they generate ANSI Control Sequences and return the code as a `string`.

It makes the code more readable as a lot of cryptic ANSI code in a long string.

[Bash tips: Colors and formatting (ANSI/VT100 Control sequences)](https://misc.flogisoft.com/bash/tip_colors_and_formatting)

Clear
-----

[](#clear)

All Clear commands do have one param `$command`

### `Clear::screen($command)`

[](#clearscreencommand)

Manipulates the whole Screen dependent on the given parameter.

### `Clear::line($command)`

[](#clearlinecommand)

Manipulates the current line dependent on the given parameter.

### The `$command`s are

[](#the-commands-are)

- `Clear::toEnd`: Clears everything for the current cursor position to the end.
- `Clear::toStart`: Clears everything for the current cursor position to the start.
- `Clear::All`: Clears everything.

Example #1: Clear everything from the cursor to the end of the line.

```
Ansi\Clear::line(Clear::toEnd)
```

Example #2: Clear the whole screen.

```
Ansi\Clear::screen(Clear::All)
```

Cursor
------

[](#cursor)

Move the cursor around on the whole srceen.

Every command has the parameter `$steps` and it controls how many steps the cursor moves.

### `Cursor::up($steps)`

[](#cursorupsteps)

Moves the cursor up.

### `Cursor::down($steps)`

[](#cursordownsteps)

Moves the cursor down.

### `Cursor::right($steps)`

[](#cursorrightsteps)

Moves the cursor right.

### `Cursor::left($steps)`

[](#cursorleftsteps)

Moves the cursor left.

Text
----

[](#text)

### `Text::set(...$args)`

[](#textsetargs)

Generates ANSI styling code dependent on the given `$args`.

### `Text::reset()`

[](#textreset)

Resets the styling code.

### `Text::inject($string, ...$args)`

[](#textinjectstring-args)

Like `Text::set` but it wraps the styling code around the given `$string`.

### List of all possible `$args`

[](#list-of-all-possible-args)

And all dose what they say.

#### Style

[](#style)

- default
- bold
- dim
- italic
- underline
- blink
- inverse
- hidden

#### Text color

[](#text-color)

- f\_default
- f\_black
- f\_red
- f\_green
- f\_yellow
- f\_blue
- f\_magenta
- f\_cyan
- f\_lightGray
- f\_darkGray
- f\_lightRed
- f\_lightGreen
- f\_lightYellow
- f\_lightBlue
- f\_lightMagenta
- f\_lightCyan
- f\_white

#### Background color

[](#background-color)

- b\_default
- b\_black
- b\_red
- b\_green
- b\_yellow
- b\_blue
- b\_magenta
- b\_cyan
- b\_lightGray
- b\_darkGray
- b\_lightRed
- b\_lightGreen
- b\_lightYellow
- b\_lightBlue
- b\_lightMagenta
- b\_lightCyan
- b\_white

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity40

Maturing project, gaining track record

 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

1656d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5bd509356cb018db17d5d6ba969f10acabec3926c4c92aa88d5702a6a665bcac?d=identicon)[chrissileinus](/maintainers/chrissileinus)

---

Top Contributors

[![chrissileinus](https://avatars.githubusercontent.com/u/62146011?v=4)](https://github.com/chrissileinus "chrissileinus (10 commits)")

### Embed Badge

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

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

PHPackages © 2026

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