PHPackages                             robinthehood/terminal - 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. [CLI &amp; Console](/categories/cli)
4. /
5. robinthehood/terminal

ActiveLibrary[CLI &amp; Console](/categories/cli)

robinthehood/terminal
=====================

With Terminal you can easily output colored text on the console with php.

0.1.5(1y ago)288815MITPHPPHP ^5.6 || ^7.0 || ^8.0

Since Nov 8Pushed 1y ago3 watchersCompare

[ Source](https://github.com/RobinTheHood/Terminal)[ Packagist](https://packagist.org/packages/robinthehood/terminal)[ RSS](/packages/robinthehood-terminal/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (6)Used By (5)

Terminal - Ouput Color with PHP
===============================

[](#terminal---ouput-color-with-php)

[![alt text](https://raw.githubusercontent.com/RobinTheHood/Terminal/master/docs/Example-Image.png)](https://raw.githubusercontent.com/RobinTheHood/Terminal/master/docs/Example-Image.png)

About
-----

[](#about)

With Terminal you can easily output colored text on the console with php. Terminal uses the 'terminal escape sequences' to display colored text. If you wish more features feel free to contribute.

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

[](#installation)

If Composer is installed globally, run

```
composer require robinthehood/terminal
```

How to use
----------

[](#how-to-use)

### Code

[](#code)

```
require 'vendor/autoload.php'; // if you are using Composer

use RobinTheHood\Terminal\Terminal;

$terminal = new Terminal();
$terminal->setColor(Terminal::RED);
$terminal->out("Hello world in red!\n");
```

### Result on the console

[](#result-on-the-console)

Displays the string on the console in red:

```
Hello world in red!

```

Colors
------

[](#colors)

```
$terminal->setColor(Terminal::GREEN); // use green color
```

Terminal::BLACK
Terminal::RED
Terminal::GREEN
Terminal::YELLOW
Terminal::BLUE
Terminal::MAGENTA
Terminal::CYAN Terminal::ORANGE Terminal::LIGHT\_GRAY
Terminal::DARK\_GRAY
Terminal::LIGHT\_RED
Terminal::LIGHT\_GREEN
Terminal::LIGHT\_YELLOW
Terminal::LIGHT\_BLUE
Terminal::LIGHT\_MAGENTA
Terminal::LIGHT\_CYAN

More examples
-------------

[](#more-examples)

### Example 1

[](#example-1)

```
require 'vendor/autoload.php'; // if you are using Composer

use RobinTheHood\Terminal\Terminal;

$terminal = new Terminal();
$terminal->setColor(Terminal::RED);
$terminal->out("Hello world in red!\n");

$terminal->setColor(Terminal::GREEN);
$terminal->out("Hello world in green!\n");

$terminal->setColor(Terminal::BLUE);
$terminal->out("Hello world in blue!\n");
```

```
Hello world in red!
Hello world in green!
Hello world in blue!

```

### Example 2

[](#example-2)

Terminal can also display line numbers:

```
require 'vendor/autoload.php'; // if you are using Composer

use RobinTheHood\Terminal\Terminal;

$terminal = new Terminal();
$terminal->setColor(Terminal::RED);
$terminal->setLineNumbersEnabled(true);
$terminal->out("Hello world in red with line number!\nThis is the 2. line.\n");
```

```
1 Hello world in red with line number!
2 This is the 2. line.

```

License
=======

[](#license)

Copyright (c) 2017 Robin Wieschendorf

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance42

Moderate activity, may be stable

Popularity18

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity62

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

Every ~658 days

Total

5

Last Release

470d ago

PHP version history (3 changes)0.1.1PHP ^5.3.3 || ^7.0

0.1.2PHP ^5.6 || ^7.0

0.1.4PHP ^5.6 || ^7.0 || ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/0d043ae2d04c03dceb7a798a9c76128b13b5e231034a876c31ed78a5d01ad4b1?d=identicon)[RobinTheHood](/maintainers/RobinTheHood)

---

Top Contributors

[![RobinTheHood](https://avatars.githubusercontent.com/u/6323551?v=4)](https://github.com/RobinTheHood "RobinTheHood (13 commits)")

---

Tags

terminalcolorescape sequences

### Embed Badge

![Health badge](/badges/robinthehood-terminal/health.svg)

```
[![Health](https://phpackages.com/badges/robinthehood-terminal/health.svg)](https://phpackages.com/packages/robinthehood-terminal)
```

###  Alternatives

[symfony/console

Eases the creation of beautiful and testable command line interfaces

9.8k1.1B11.3k](/packages/symfony-console)[league/climate

PHP's best friend for the terminal. CLImate allows you to easily output colored text, special formats, and more.

1.9k14.0M272](/packages/league-climate)[php-school/cli-menu

A command line menu helper in PHP

2.0k1.1M27](/packages/php-school-cli-menu)[kevinlebrun/colors.php

Colors for PHP CLI scripts

3426.7M45](/packages/kevinlebrun-colorsphp)[php-tui/php-tui

Comprehensive TUI library heavily influenced by Ratatui

589747.0k6](/packages/php-tui-php-tui)[clue/term-react

Streaming terminal emulator, built on top of ReactPHP.

10410.2M2](/packages/clue-term-react)

PHPackages © 2026

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