Download the PHP package xocdr/tui without Composer
On this page you can find all versions of the php package xocdr/tui. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package tui
xocdr/tui
A Terminal UI framework for PHP. Build beautiful, interactive terminal applications with a component-based architecture and hooks for state management.
Features
- ๐จ Component-based - Build UIs with composable components (Box, Text, etc.)
- โก Hooks - state, onRender, memo, onInput, and more
- ๐ฆ Flexbox layout - Powered by Yoga layout engine via ext-tui
- ๐ฏ Focus management - Tab navigation and focus tracking
- ๐ Event system - Priority-based event dispatching with propagation control
- ๐งช Testable - Interface-based design with mock implementations
Requirements
- PHP 8.4+
- ext-tui (C extension)
Installation
Quick Start
Components
Box
Flexbox container for layout:
Text
Styled text content:
Other Components
Hooks
The Hooks class provides state management and side effects for components.
state
Manage component state:
onRender
Run side effects:
memo / callback
Memoize values and callbacks:
ref
Create mutable references:
reducer
Complex state with reducer pattern:
onInput
Handle keyboard input:
app
Access application controls:
focus / focusManager
Manage focus:
stdout
Get terminal info:
HooksAware Trait
For components, use the HooksAwareTrait for convenient access:
Events
Listen to events on the runtime via managers:
Within a UI class, use the convenience methods instead:
Advanced Usage
Runtime Configuration
Configure with options array:
Manager Access
Access specialized managers from the runtime:
Testing Without C Extension
Use MockInstance for testing:
Style Utilities
Style Builder
Color Utilities
Gradients
Border Styles
Terminal Control
Access terminal features via TerminalManager:
Scrolling
SmoothScroller
Spring physics-based smooth scrolling:
VirtualList
Efficient rendering for large lists (windowing/virtualization):
Architecture
The package follows SOLID principles with a clean separation of concerns:
Development
License
MIT
Related
- xocdr/ext-tui - Required C extension
All versions of tui with dependencies
ext-tui Version *
intervention/image Version ^3.11
league/commonmark Version ^2.8
scrivo/highlight.php Version ^9.18
sebastian/diff Version ^7.0