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

Overview

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?

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]?

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]?

if you want to collaborate with the development of the library; You can express your ideas or report any situation related to this in: https://github.com/arcanisgk/WEB-CLI-Detector/issues

[WEB-CLI-Detector] Configuration:

None necessary.

[WEB-CLI-Detector] Installation:

composer require arcanisgk/web-cli-detector

[WEB-CLI-Detector] Usage:

Instance of Class:

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

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:

this is an option to instance and validate in one line

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

    //your logic

}

Example Output:

CLI Test

Image of Example Output1

Web Test

Image of Example Output2

Contributors

You might also like...
Workshop environment for Decoupled Drupal

Decoupled Drupal Workshop 👋 Welcome to the Bluehorn Digital Decoupled Drupal workshop repository! This repository contains a decoupled ready Drupal b

MajorDoMo is an open-source DIY smarthome automation platform aimed to be used in multi-protocol and multi-services environment.
MajorDoMo is an open-source DIY smarthome automation platform aimed to be used in multi-protocol and multi-services environment.

MajorDoMo (Major Domestic Module) is an open-source DIY smarthome automation platform aimed to be used in multi-protocol and multi-services environment. It is based on web-technologies stack and ready to be delivered to any modern device. It is very flexible in configuration with OOP paradigm used to set up automation rules and scripts. This platform can be installed on almost any personal computer running Windows or Linux OS.

🐘 A probe program for PHP environment (一款精美的 PHP 探針, 又名X探針、劉海探針)

Simplified Chinese | 简体中文 Traditional Chinese(Taiwan) | 正體中文(臺灣) Traditional Chinese(Hong Kong) | 正體中文(香港) Japanese | 日本語 😎 X Prober This is a probe

Full PHP development environment for Docker.
Full PHP development environment for Docker.

Full PHP development environment based on Docker. Use Docker First - Learn About It Later! Join Us Awesome People Laradock is an MIT-licensed open sou

A simple library to increase the power of your environment variables.
A simple library to increase the power of your environment variables.

Environment A simple library (with all methods covered by php unit tests) to increase the power of your environment variables, contribute with this pr

The Phar Installation and Verification Environment (PHIVE)

The Phar Installation and Verification Environment (PHIVE) Installation and verification of phar distributed PHP applications has never been this easy

A Magento Development Environment Made of Docker Containers

Docker for Magento 1 Extension Development Tl;dr How do I use this? Clone it. Type docker-compose up -d. Install a Magento Mount your file share. Deve

A simple shell script which loads a magento environment

A simple shell script to load up a Magento environment and execute PHP code Very experimental and should only be ran on dev servers REQUIRES php pcntl

A dockerized magento 2 community environment ready for development or production.

Painless Magento 2 & 1 A dockerized magento 2 community environment ready for development or production. It supports magento 1.9.x for development Ins

Releases(v1.0.6)
Owner
Walter Nuñez
( your dad ) 👍 💯 🥇
Walter Nuñez
Detection of design patterns in PHP code

Pattern Detector for PHP Detects design pattern in your code

Jean-François Lépine 105 Aug 23, 2022
php-dry – Clone Detection for PHP

php-dry – Clone Detection for PHP php-dry detects duplicated behaviour in your application, even if the duplicated passages are implemented completely

Leo Viezens 15 Oct 28, 2022
A collection of command line scripts for Magento 2 code generation, and a PHP module system for organizing command line scripts.

What is Pestle? Pestle is A PHP Framework for creating and organizing command line programs An experiment in implementing python style module imports

Alan Storm 526 Dec 5, 2022
Highlight PHP code in terminal

PHP Console Highlighter This repository is abandoned. Suggested alternative: https://github.com/php-parallel-lint/PHP-Console-Highlighter Highlight PH

Jakub Onderka 6.2k Dec 22, 2022
Run the following commands in your terminal to setup the project

Run the following commands in your terminal to setup the project You must have the LAMP installed on your system git clone https://github.com/Bashar-A

null 1 Nov 6, 2021
Terminal drawing with braille

php-drawille Terminal drawing with braille. Requirements php-drawille requires PHP 5.4.0 or later. Installation The recommended way to install php-dra

Jeff Welch 102 Nov 2, 2022
Terminal management system.

About Laravel Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experie

HISTYLE 3 Sep 5, 2022
Terminal management system.

About Laravel Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experie

HISTYLE 2 May 14, 2022
Highlight PHP code in terminal

PHP Console Highlighter Highlight PHP code in console (terminal). Example Install Just run the following command to install it: composer require --dev

PHP Parallel lint 74 Dec 12, 2022
TraceX-GUI is a GUI based IP atrcker tool for terminal user

TraceX-GUI Author Alex Butler (MrHacker-X) What is IP Tracing? As IP addresses are automatically identified thanks to the handshake, IP address tracke

Alex Butler 10 Dec 26, 2022