Skip to content

v0.7.0

Choose a tag to compare

@prateekbhujel prateekbhujel released this 08 Sep 09:12
· 20 commits to main since this release
0472dce

New Features & Primitives:

  • Dimension Accessors: Added Terminal\Terminal::getWidth() and Terminal\Terminal::getHeight() helpers to retrieve terminal dimensions directly without manual array extraction from getSize().
  • Color Depth Detection: Added Terminal\ColorDepth enum (None = 0, Standard = 4, Extended = 8, TrueColor = 24) and Terminal\Terminal::getColorDepth(), supportsColor(), and supportsTrueColor(). Provides robust cross-platform detection supporting NO_COLOR, CLICOLOR_FORCE, COLORTERM, modern terminal emulators (Ghostty, Kitty, WezTerm, iTerm, Hyper, VS Code, Tabby, Warp, Windows Terminal WT_SESSION, ConEmu), and extended TERM flags.
  • Window & Tab Title: Added Terminal\Terminal::setTitle(string $title) with control character sanitization (\r, \n, \033, \x07) to prevent ANSI/OSC escape sequence injection.
  • Terminal Bell: Added Terminal\Terminal::beep() to emit audible/visual terminal alert notifications.
  • Key Normalization: Added Shift+Tab (\e[Z / BackTab) normalization to Terminal\Key::Tab on POSIX, matching Windows behavior. Added CSI F1–F4 (\e[P, \e[Q, \e[R, \e[S) key normalization.
  • Standards & Detection: Added CLICOLOR_FORCE standard support on Unix and Windows, enabling ANSI output for redirected/CI streams while strictly preserving NO_COLOR precedence.
  • Modern Terminal Detection: Added Apple_Terminal, ghostty, and warp to recognized TERM_PROGRAM values, and WT_SESSION on Windows. Extended color-capable TERM recognition to xterm*, screen*, tmux*, rxvt*, linux, vt100, vt220, and ansi.

Fixes & Hardening:

  • Fixed readSecret() newline emission on Enter and abort (Ctrl-C, Ctrl-D, Escape) so the terminal cursor remains on a clean line.
  • Marked the Windows raw-mode guard flag as volatile for correct behavior under ZTS.
  • Added extension version to phpinfo() output.
  • Fixed PIE package metadata schema in composer.json for strict validation.
  • Added non-interactive stream-resource and pipe-safe basic examples with PHPT coverage.
  • Full CI test matrix passing across Unix (PHP 8.1, 8.2, 8.3, 8.4, 8.5, nightly) and Windows (PHP 8.2, 8.3, 8.4, 8.5 TS/NTS).