Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Term Laravel Package

php-tui/term

php-tui/term is a PHP library for terminal control and TUI development, with ANSI escape sequences, cursor movement, text styling, screen management, and input handling. Build responsive command-line interfaces and interactive CLI tools without heavy dependencies.

Deep Wiki
Context7

php-tui/term is a low-level terminal control library for PHP, providing the building blocks needed to create rich command-line interfaces. It abstracts ANSI escape sequences and terminal capabilities, making it easier to manage cursor movement, colors, screen dimensions, and raw input across platforms.

  • ANSI escape sequence generation and parsing
  • Cursor positioning, visibility, and screen clearing
  • Terminal size detection and color support
  • Raw mode and keyboard input handling
  • Lightweight, dependency-free API for TUI applications
Frequently asked questions about Term
What is php-tui/term and can I use it in a Laravel app?
php-tui/term is a low-level PHP terminal manipulation library for ANSI escape sequences, cursor movement, colors, styling, terminal size detection, raw mode, and input reading. It can be used in Laravel, but only for CLI or TUI features such as interactive Artisan commands, installers, render loops, or terminal dashboards. It should stay in an infrastructure or CLI adapter layer rather than application or domain code. It is not suitable for HTTP request paths or queue workers.
How do I install php-tui/term with Composer in a Laravel project?
You install it like any Composer package, but you should pin an exact version or commit because the upstream repository is unknown and the package has a single 2023 release. Keep the dependency restricted to CLI entry points or specific Artisan commands. Validate the package artifact against a verifiable tag or commit before adopting it. Avoid installing it into shared web-facing dependencies where terminal behavior is irrelevant.
Does php-tui/term work with Laravel Artisan commands and Symfony Console?
It can be used inside Artisan commands, but direct terminal I/O may bypass Laravel and Symfony Console output abstractions. That makes output capture, testing, and fallback behavior harder. You should isolate it behind a small adapter and use Symfony Console or Laravel Prompts for ordinary prompts and progress bars. Use php-tui/term only where genuinely low-level terminal control is required.
Which PHP versions and extensions does php-tui/term require?
The provided context does not specify exact PHP versions or extension requirements, so you must verify them against your team's PHP matrix. Composer installation is likely straightforward only if those constraints match your environment. Check compatibility with your deployment images, CI runners, and Laravel versions before using it. Stale PHP compatibility is a material risk given the package's age and low release cadence.
Can php-tui/term handle colors, cursor movement, and terminal size detection?
Yes, the package is described as handling ANSI escape sequences, cursor movement, colors and styling, terminal size detection, raw mode, and input reading. Those capabilities are useful for custom CLI renderers and TUI-style interfaces. However, rendering can break with unsupported ANSI, Unicode width issues, limited color depth, redirected output, CI, Windows, SSH, or terminal multiplexers. Plan fallback behavior for environments that do not support these features.
Is php-tui/term safe for production Laravel applications?
It carries high due diligence risk because the repository provenance is unknown, the package has 45 stars, one release dated 2023-12-04, and an unverifiable MIT license claim. Do not use it in business-critical flows without a fork or maintainer plan. Restrict it to non-critical CLI features and add documented fallback and rollback paths. For ordinary CLI output, prefer Symfony Console or Laravel Prompts.
How do I test php-tui/term commands in CI or non-TTY environments?
You should add tests for non-TTY output, piped or logged output, CI runners, Windows, and interrupt handling. Build an adapter with TTY detection and a Symfony Console fallback so automated environments never depend on raw terminal mode. Add timeouts and non-interactive modes for automated jobs. A time-boxed proof of concept in a non-critical command is a sensible first step.
Does php-tui/term support Windows, SSH, tmux, and signal or resize handling?
The context flags Windows and TTY incompatibility, CI hangs, SSH and tmux rendering issues, and incomplete signal or resize handling as material risks. It does not confirm full support for those environments. You must validate behavior across your team's operating systems, terminal emulators, CI runners, and multiplexers. Confirm what happens when STDOUT is not a TTY before relying on it.
What happens if raw mode fails or the terminal is not restored after Ctrl-C?
Raw terminal mode may not be restored after crashes or Ctrl-C, which can leave shells unusable. The package description does not document a guaranteed fallback when raw mode or escape sequences fail. You should wrap usage with careful cleanup, interrupt handling, and a documented disable-interactive-mode mitigation. Test failure paths before using it in any long-running or shared terminal workflow.
Are there better alternatives to php-tui/term for Laravel CLI prompts and output?
For ordinary prompts, progress bars, and command output, prefer Symfony Console or Laravel Prompts. Those integrate more naturally with Laravel and are easier to test, capture, and maintain. Consider php-tui/term only when you need low-level terminal control that those abstractions do not provide. If you adopt it, isolate it behind an internal interface so it can be swapped or forked later.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
robertmarney/lara-hierarchial-collections
simonschaufi/rule-doc-generator
emissaoja/emissaoja
blackbricksoftware/gravityforms-civicrm-form-processor
al-rahabi/fancy-crud
jinas/dhivatar-component
mltstephane/laravel-quality
bernskiold/laravel-talentlms
bernskioldmedia/laravel-form-architect
youbar/easy-crud
c-point-labs/laravel-hostyourai
dbravoan/dbcms-admin-theme-dbcms
dbravoan/dbcms-theme-db-cyber
dbravoan/dbcms-blocks-basic
dbravoan/dbcms-module-content-audit
dbravoan/dbcms-module-ai-assistant
paygate-to/paygate-php
padosoft/askmydocs-connector-base
defstudio/supercharged-carbon
bernskioldmedia/laravel-matomo