PHPackages                             xocdr/ext-tui - 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. xocdr/ext-tui

ActivePhp-ext[CLI &amp; Console](/categories/cli)

xocdr/ext-tui
=============

Terminal UI extension with Yoga layout engine for PHP (inspired by React INK)

0.4.4(6mo ago)053MITCPHP &gt;=8.1CI failing

Since Dec 30Pushed 6mo agoCompare

[ Source](https://github.com/xocdr/ext-tui)[ Packagist](https://packagist.org/packages/xocdr/ext-tui)[ RSS](/packages/xocdr-ext-tui/feed)WikiDiscussions main Synced today

READMEChangelog (8)DependenciesVersions (13)Used By (0)

 [![ext-tui logo](docs/tui-logo.svg)](docs/tui-logo.svg)

ext-tui
=======

[](#ext-tui)

A PHP C extension for building terminal user interfaces with component-based architecture and Yoga flexbox layout.

Features
--------

[](#features)

- **Flexbox Layout**: Facebook's Yoga layout engine for CSS-like flexbox positioning
- **Component-Based**: Build UIs with `ContainerNode` and `ContentNode` components
- **Full UTF-8 Support**: Proper handling of Unicode text including CJK wide characters
- **Rich Text Styling**: Bold, italic, underline, colors (RGB), and more
- **Keyboard Input**: Full keyboard event handling with modifiers (Ctrl, Alt, Shift)
- **Mouse Support**: Click, scroll, and drag events with hit testing
- **Terminal Resize**: Automatic layout recalculation on terminal resize
- **Clipboard**: OSC 52 clipboard read/write (works over SSH)
- **Hyperlinks**: Clickable OSC 8 terminal hyperlinks
- **Bracketed Paste**: Detect and handle pasted text
- **Focus Management**: Tab navigation, focus groups, focus traps
- **Drawing Primitives**: Lines, rectangles, circles, ellipses, triangles
- **Canvas Graphics**: High-resolution drawing with Braille, block, or ASCII modes
- **Animation**: Easing functions, interpolation, color gradients
- **Sprites**: Frame-based animated sprites with collision detection
- **Tables**: Formatted table rendering with alignment and borders
- **Progress Indicators**: Progress bars, busy bars, and spinners
- **Timers**: Interval-based callbacks for animations and updates
- **High Performance**: All rendering done in C with minimal PHP overhead

Requirements
------------

[](#requirements)

- PHP 8.0+
- C compiler with C++20 support (for Yoga)
- Unix-like operating system (macOS, Linux)
- Terminal with UTF-8 support

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

[](#installation)

### From Source

[](#from-source)

```
# Clone the repository
git clone https://github.com/xocoder/ext-tui.git
cd ext-tui

# Build the extension
phpize
./configure --enable-tui
make

# Run tests
make test

# Install (requires root)
sudo make install

# Add to php.ini
echo "extension=tui.so" >> $(php -i | grep "Loaded Configuration File" | cut -d' ' -f5)
```

### Verify Installation

[](#verify-installation)

```
php -m | grep tui
# Output: tui

php -r "var_dump(tui_get_terminal_size());"
# Output: array(2) { [0]=> int(80) [1]=> int(24) }
```

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

[](#quick-start)

### Hello World

[](#hello-world)

```
