Download the PHP package artisan-build/parfait without Composer
On this page you can find all versions of the php package artisan-build/parfait. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download artisan-build/parfait
More information about artisan-build/parfait
Files in artisan-build/parfait
Package parfait
Short Description A framework-agnostic, component-based TUI layout and rendering system for PHP terminal applications
License MIT
Homepage https://github.com/artisan-build/parfait
Informations about the package parfait
A framework-agnostic, component-based TUI layout and rendering system for PHP terminal applications.
Why Parfait?
Building a terminal UI usually means hand-managing ANSI codes, cursor math, and Unicode width edge cases. Parfait gives you a declarative, component-based API instead โ you describe the UI as a tree of components, and Parfait renders it to a string.
- ๐งฉ Components โ
Panel,Modal,Accordion,FileTree,SelectList,NodeCanvas,Text, and more, each with a fluent API. - ๐ Layouts โ compose
Layout::columns()/Layout::rows()with ratio-based sizing. - ๐จ 256-color theming โ a semantic
Colorenum that emits correct ANSI codes. - ๐ Unicode-correct width โ emoji, CJK, combining marks, and ANSI escapes are measured accurately.
- ๐ช Portals โ dropdowns, modals, and toasts render onto higher layers instead of being clipped.
- ๐งช Effortless testing โ components are pure functions: state in โ
render()โ string out. No terminal required. - ๐ชถ Zero framework dependencies โ needs only PHP 8.2+ and
soloterm/grapheme.
Parfait layers cleanly on top of Laravel Prompts for input/render loops, but depends on neither Laravel nor Prompts โ you can drive it from any PHP terminal program.
Requirements
- PHP
^8.2 ext-mbstringandext-intl(for grapheme-aware width)
Installation
Quick Start
Every component knows the space it has via a Container, and renders to a
string you print yourself:
Composing a layout
Layout arranges child components and hands each one a correctly-sized
Container:
Components
| Component | Purpose |
|---|---|
Text / Stack |
Inline styled text and vertical content composition |
Panel |
Bordered / sidebar / minimal containers with header, body, footer |
Modal |
Overlay dialogs with shadow rendering (via portals) |
Toast |
Transient notifications |
Accordion |
Expandable tree-style navigation |
SelectList |
Scrollable, selectable lists |
FileTree |
Filesystem browser with search and exclude patterns |
Input / TextArea |
Single- and multi-line text entry |
CommandLine |
Command-palette style input |
ProgressBar |
Determinate progress display |
StatusBar / AppHeader |
Chrome for the top and bottom of the screen |
NodeCanvas |
Node-graph visualization with automatic layout |
Each component lives in src/Components/ alongside a co-located *Renderer
where rendering is non-trivial โ see Architecture.
Architecture
Parfait uses a co-located renderer pattern:
Component.phpholds state and props (public properties, fluent setters).ComponentRenderer.phpturns that state into a string.
This keeps rendering logic isolated and makes components trivial to test โ
construct one, set its container, assert on the rendered string. The base
Component provides styling helpers (applyStyle, width/truncate utilities),
view-state storage, and the portal hook.
See DESIGN.md for the full design rationale.
Documentation
The docs/ directory covers each subsystem in depth:
- Introduction
- Components
- Layouts
- Styles
- Navigation
- View State
- Events
- Testing
- Portals
Testing
Components are pure functions, so tests need no terminal or framework:
Run the suite:
Contributing
Contributions are welcome โ see CONTRIBUTING.md for the dev setup, coding standards, and quality gates.
License
Parfait is open-source software licensed under the MIT license.