arcanisgk/web-cli-detector
最新稳定版本:v1.07
Composer 安装命令:
composer require 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
README 文档
README
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<br>'; } 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
Web Test
Contributors
- (c) 2020 - 2022 Walter Francisco Núñez Cruz
icarosnet@gmail.com
统计信息
- 总下载量: 607
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 6
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-06-14