PHPackages                             shipfastlabs/terminal-detector - 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. shipfastlabs/terminal-detector

ActiveLibrary[CLI &amp; Console](/categories/cli)

shipfastlabs/terminal-detector
==============================

Detects which terminal emulator is running the current PHP process

v1.0.0(3mo ago)20[1 PRs](https://github.com/shipfastlabs/terminal-detector/pulls)MITPHPPHP ^8.2CI passing

Since Mar 5Pushed 2w agoCompare

[ Source](https://github.com/shipfastlabs/terminal-detector)[ Packagist](https://packagist.org/packages/shipfastlabs/terminal-detector)[ RSS](/packages/shipfastlabs-terminal-detector/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (1)Dependencies (6)Versions (3)Used By (0)

 [![Terminal Detector](docs/logo.png)](docs/logo.png)

 [![GitHub Workflow Status (master)](https://github.com/shipfastlabs/terminal-detector/actions/workflows/tests.yml/badge.svg)](https://github.com/shipfastlabs/terminal-detector/actions) [![Total Downloads](https://camo.githubusercontent.com/cb38152693f3bac8e566eb369e9779ce5294bbcdbe30c9907e3924e9aea68dea/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f73686970666173746c6162732f7465726d696e616c2d6465746563746f72)](https://packagist.org/packages/shipfastlabs/terminal-detector) [![Latest Version](https://camo.githubusercontent.com/25a901e5af1a2d19e2c0632fc79b9fcbb4a6101bc432bcdd88b1d2e964b0ddfb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f73686970666173746c6162732f7465726d696e616c2d6465746563746f72)](https://packagist.org/packages/shipfastlabs/terminal-detector) [![License](https://camo.githubusercontent.com/201915f35e206dffd6b020bbfd45345926b4828b00a58a3beeb44832e9531e7c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f73686970666173746c6162732f7465726d696e616c2d6465746563746f72)](https://packagist.org/packages/shipfastlabs/terminal-detector)

Terminal Detector
=================

[](#terminal-detector)

Detects which terminal emulator is running the current PHP process.

> **Requires [PHP 8.2+](https://php.net/releases/)**

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

[](#installation)

```
composer require shipfastlabs/terminal-detector
```

Usage
-----

[](#usage)

```
use TerminalDetector\TerminalDetector;

$result = TerminalDetector::detect();

if ($result->detected) {
    echo "Running inside: {$result->name}";
}

// Check for a specific known terminal
if ($result->knownTerminal() === \TerminalDetector\KnownTerminal::Ghostty) {
    echo "Hello from Ghostty!";
}
```

Or use the standalone function:

```
use function TerminalDetector\detectTerminal;

$result = detectTerminal();
```

### Result Properties

[](#result-properties)

```
$result->detected;        // true / false
$result->name;            // e.g. 'iterm2', 'ghostty', 'vscode'
$result->version;         // e.g. '3.5.0' (from TERM_PROGRAM_VERSION)
$result->knownTerminal(); // KnownTerminal enum or null
```

Known Terminals
---------------

[](#known-terminals)

The `KnownTerminal` enum provides type-safe identifiers for all supported terminals:

Enum CaseValue`KnownTerminal::ITerm2``iterm2``KnownTerminal::AppleTerminal``apple-terminal``KnownTerminal::VSCode``vscode``KnownTerminal::Hyper``hyper``KnownTerminal::WarpTerminal``warp``KnownTerminal::WezTerm``wezterm``KnownTerminal::Kitty``kitty``KnownTerminal::Alacritty``alacritty``KnownTerminal::Ghostty``ghostty``KnownTerminal::WindowsTerminal``windows-terminal``KnownTerminal::JetBrains``jetbrains``KnownTerminal::Konsole``konsole``KnownTerminal::GnomeTerminal``gnome-terminal``KnownTerminal::Tilix``tilix``KnownTerminal::Tabby``tabby``KnownTerminal::Rio``rio``KnownTerminal::Tmux``tmux``KnownTerminal::Zellij``zellij``KnownTerminal::Screen``screen``KnownTerminal::SSHSession``ssh``KnownTerminal::Xterm``xterm`Supported Terminals
-------------------

[](#supported-terminals)

TerminalDetection MethodiTerm2`TERM_PROGRAM`Apple Terminal`TERM_PROGRAM`VS Code`TERM_PROGRAM`Hyper`TERM_PROGRAM`Warp`TERM_PROGRAM`WezTerm`TERM_PROGRAM`Rio`TERM_PROGRAM`Kitty`KITTY_WINDOW_ID` / `TERM`Ghostty`GHOSTTY_RESOURCES_DIR` / `TERM`Windows Terminal`WT_SESSION`JetBrains`TERMINAL_EMULATOR`Konsole`KONSOLE_DBUS_SESSION` / `KONSOLE_VERSION`Tilix`TILIX_ID`GNOME Terminal`GNOME_TERMINAL_SCREEN` / `VTE_VERSION`Tabby`TABBY_CONFIG_DIRECTORY`Alacritty`TERM`Xterm`TERM`tmux`TMUX`Zellij`ZELLIJ`Screen`STY`SSH`SSH_CONNECTION` / `SSH_CLIENT`Custom Override
---------------

[](#custom-override)

Set the `TERMINAL_DETECTOR` environment variable to force a specific terminal name:

```
TERMINAL_DETECTOR=my-terminal php script.php
```

License
-------

[](#license)

Terminal Detector is open-sourced software licensed under the **[MIT license](https://opensource.org/licenses/MIT)**.

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance89

Actively maintained with recent releases

Popularity3

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

110d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/31663512?v=4)[Pushpak Chhajed](/maintainers/pushpak1300)[@pushpak1300](https://github.com/pushpak1300)

---

Top Contributors

[![pushpak1300](https://avatars.githubusercontent.com/u/31663512?v=4)](https://github.com/pushpak1300 "pushpak1300 (8 commits)")

---

Tags

phpcliterminaldetector

###  Code Quality

TestsPest

Static AnalysisPHPStan, Rector

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/shipfastlabs-terminal-detector/health.svg)

```
[![Health](https://phpackages.com/badges/shipfastlabs-terminal-detector/health.svg)](https://phpackages.com/packages/shipfastlabs-terminal-detector)
```

###  Alternatives

[league/climate

PHP's best friend for the terminal. CLImate allows you to easily output colored text, special formats, and more.

1.9k14.5M291](/packages/league-climate)[nunomaduro/termwind

It's like Tailwind CSS, but for the console.

2.5k260.6M359](/packages/nunomaduro-termwind)[php-school/learn-you-php

An introduction to PHP's core features: i/o, http, arrays, exceptions and so on.

3202.0k](/packages/php-school-learn-you-php)[alecrabbit/php-cli-snake

Lightweight cli spinner with zero dependencies

29214.4k5](/packages/alecrabbit-php-cli-snake)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
