PHPackages                             ajaxray/ansikit - 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. ajaxray/ansikit

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

ajaxray/ansikit
===============

Tiny ANSI escape helper for terminal UIs (text styles, foreground &amp; background colors, cursor positions, clearing) with table, progressbar, and more helpers.

v0.3.1(7mo ago)1075481MITPHPPHP &gt;=8.2CI passing

Since Sep 11Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/ajaxray/AnsiKit)[ Packagist](https://packagist.org/packages/ajaxray/ansikit)[ RSS](/packages/ajaxray-ansikit/feed)WikiDiscussions main Synced 1mo ago

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

 [![AnsiKit](media/AnsiKit.png)](media/AnsiKit.png)

AnsiKit
=======

[](#ansikit)

[![Latest Version on Packagist](https://camo.githubusercontent.com/a48fd23bbb45a1c194d8c2f335a24da1fdc77a1e2ac9eee74bdaa8648a197f5f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f616a61787261792f616e73696b69742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ajaxray/ansikit)[![Total Downloads](https://camo.githubusercontent.com/db9883ac3481c78a4f9a15de6d9a67977a209009493658903b362c71f4f05509/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f616a61787261792f616e73696b69742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ajaxray/ansikit)[![Build Status](https://github.com/ajaxray/ansikit/actions/workflows/php.yml/badge.svg)](https://github.com/ajaxray/ansikit/actions)[![License](https://camo.githubusercontent.com/942e017bf0672002dd32a857c95d66f28c5900ab541838c6c664442516309c8a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e7376673f7374796c653d666c61742d737175617265)](LICENSE)

Tiny, easy-to-remember ANSI escape helper for building terminal UIs in PHP. Chainable API for styles/colors/cursor control, with a few handy components and utilities.

Works on any terminal that supports ANSI escapes (most modern terminals on macOS/Linux and Windows Terminal/ConEmu on Windows 10+).

> **Let's keep simple things simple.** 😌
> You don't need a *whole framework* to build a simple CLI app.

Why Choose AnsiKit?
-------------------

[](#why-choose-ansikit)

Zero dependencies, PSR-12 with strict types, and a beautiful chainable API. Perfect for small CLI tools, deployment scripts, or any terminal-based app where you need style without the weight.

Features
--------

[](#features)

### 🎨 Text Styling

[](#-text-styling)

- Standard 8/16 colors, 256-color palette, and truecolor (RGB, 24-bit)
- Bold, dim, italic, underline, inverse, hidden, strike-through styles
- Easy reset and chaining

### 📊 UI Components

[](#-ui-components)

- **Table** - Beautiful tables with borders and alignment
- **Banner** - Eye-catching banners for messages
- **Progressbar** - Progress tracking with customizable styles
- **Spinner** - Animated spinners for loading states
- **Choice** - Interactive selection prompts
- **Panel** - Flexible container layouts (vertical/horizontal) with borders and dividers
- **PanelBlock** - Individual content blocks that can be nested or standalone

### ⌨️ Input &amp; Interactivity

[](#️-input--interactivity)

- **Input helpers** - Line, multiline, and confirm prompts
- **Keypress detection** - Listen for arrow keys, ENTER, ESC, TAB, modifiers, and more

### 🎯 Cursor Control

[](#-cursor-control)

- Move cursor to any position
- Save/restore cursor state
- Show/hide cursor
- Alternate screen buffer support

### 🛠️ Utilities

[](#️-utilities)

- ANSI-aware string length and stripping
- Memory writer for testing
- Tab title and bell helpers

See It In Action
----------------

[](#see-it-in-action)

[![showcase.png](media/showcase.png)](media/showcase.png)

```
php examples/showcase.php
```

Quick Start
-----------

[](#quick-start)

```
composer require ajaxray/ansikit
```

```
