PHPackages                             arcanisgk/web-cli-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. arcanisgk/web-cli-detector

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

arcanisgk/web-cli-detector
==========================

WEB CLI detector: is a library that allows any development to detect if it is running through the PHP CLI service or a Web Server

v1.07(2y ago)6777MITPHPPHP &gt;=7.4|&gt;=8.0|&gt;=8.1CI passing

Since Jun 7Pushed 2y ago1 watchersCompare

[ Source](https://github.com/arcanisgk/WEB-CLI-Detector)[ Packagist](https://packagist.org/packages/arcanisgk/web-cli-detector)[ RSS](/packages/arcanisgk-web-cli-detector/feed)WikiDiscussions main Synced today

READMEChangelog (8)DependenciesVersions (8)Used By (0)

WEB-CLI-Detector
================

[](#web-cli-detector)

Detection of execution by command (Terminal) or web environment.

Acronym: \[WEB-CLI-Detector\].

Name: WEB-CLI-Detector.

Dependencies: Stand Alone / PHP v7.4.

What does *\[WEB-CLI-Detector\]* do?
------------------------------------

[](#what-does-web-cli-detector-do)

is a very simple PHP \[WEB-CLI-Detector\] implementation that allows you to easily validate if the PHP execution is taking place from a web environment or from the execution of commands (terminal)

Why use *\[WEB-CLI-Detector\]*?
-------------------------------

[](#why-use-web-cli-detector)

Developers need the ability to validate in which environment their libraries or applications are running, this helps decision making depending on the needs or requirements, making it easier for all developers on the same team to use the same validation.

Help to improve *\[WEB-CLI-Detector\]*?
---------------------------------------

[](#help-to-improve-web-cli-detector)

if you want to collaborate with the development of the library; You can express your ideas or report any situation related to this in:

*\[WEB-CLI-Detector\]* Configuration:
-------------------------------------

[](#web-cli-detector-configuration)

None necessary.

*\[WEB-CLI-Detector\]* Installation:
------------------------------------

[](#web-cli-detector-installation)

```
composer require arcanisgk/web-cli-detector
```

*\[WEB-CLI-Detector\]* Usage:
-----------------------------

[](#web-cli-detector-usage)

### Instance of Class:

[](#instance-of-class)

```
use IcarosNet\WebCLIToolKit\WebCLIDetector;
require __DIR__.'\..\vendor\autoload.php';
$wc_detector = new WebCLIDetector();
```

### Implementation of Class:

[](#implementation-of-class)

```
if ($wc_detector->isCLI()) {
    echo 'Running from CLI'.PHP_EOL;
}

if ($wc_detector->isWEB()) {
    echo 'Running from WEB';
}

echo 'Get Raw Environment: '.$wc_detector->getEnvironment();
```

### Other Way to implement:

[](#other-way-to-implement)

this is an option to instance and validate in one line

```
if (WebCLIDetector::getInstance()->isCLI()) {

    //your logic

}
```

### Example Output:

[](#example-output)

CLI Test

[![Image of Example Output1](https://camo.githubusercontent.com/bb0773d88af2c47dbfbc9897a9a6a08cd018dbfb8be2fc92522aa4bf35d1a3ca/68747470733a2f2f692e696d6775722e636f6d2f58725031394d372e706e67)](https://camo.githubusercontent.com/bb0773d88af2c47dbfbc9897a9a6a08cd018dbfb8be2fc92522aa4bf35d1a3ca/68747470733a2f2f692e696d6775722e636f6d2f58725031394d372e706e67)

Web Test

[![Image of Example Output2](https://camo.githubusercontent.com/0374de5d358e27042d2f63bbd0e11dfe7a26af783afebbce2e773550c5d37155/68747470733a2f2f692e696d6775722e636f6d2f675177596c6d4f2e706e67)](https://camo.githubusercontent.com/0374de5d358e27042d2f63bbd0e11dfe7a26af783afebbce2e773550c5d37155/68747470733a2f2f692e696d6775722e636f6d2f675177596c6d4f2e706e67)

### Contributors

[](#contributors)

- (c) 2020 - 2022 Walter Francisco Núñez Cruz  [![Donate](https://camo.githubusercontent.com/a52580597c15a106bc32b9769f9a7327c177653898360f8052c301029f51a7b7/68747470733a2f2f696d672e736869656c64732e696f2f7374617469632f76313f6c6162656c3d446f6e617465266d6573736167653d50617950616c2e6d652f776e756e657a383626636f6c6f723d627269676874677265656e)](https://www.paypal.me/wnunez86/4.99USD)

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity62

Established project with proven stability

 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

Every ~72 days

Recently: every ~108 days

Total

7

Last Release

1051d ago

PHP version history (2 changes)v1.0.1PHP ^7.4

v1.07PHP &gt;=7.4|&gt;=8.0|&gt;=8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/f826ead58519f4ed93071a8c7264620cfcb687bca24ec0a0fb2da936bf88d9e1?d=identicon)[ArcanisGK](/maintainers/ArcanisGK)

---

Top Contributors

[![wnunezc](https://avatars.githubusercontent.com/u/1207306?v=4)](https://github.com/wnunezc "wnunezc (11 commits)")

### Embed Badge

![Health badge](/badges/arcanisgk-web-cli-detector/health.svg)

```
[![Health](https://phpackages.com/badges/arcanisgk-web-cli-detector/health.svg)](https://phpackages.com/packages/arcanisgk-web-cli-detector)
```

###  Alternatives

[illuminate/console

The Illuminate Console package.

13046.0M6.5k](/packages/illuminate-console)[styleci/cli

The CLI tool for StyleCI

71470.5k9](/packages/styleci-cli)[winbox/args

Windows command-line formatter

20720.9k21](/packages/winbox-args)[tomatophp/filament-artisan

Simple but yet powerful library for running some artisan commands for FilamentPHP

3275.4k1](/packages/tomatophp-filament-artisan)

PHPackages © 2026

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