Recommend this page to a friend! |
Download .zip |
Info | Example | View files (6) | Download .zip | Reputation | Support forum | Blog | Links |
Last Updated | Ratings | Unique User Downloads | Download Rankings | |||||
2022-06-07 (26 days ago) | Not yet rated by the users | Total: 43 | All time: 10,364 This week: 77 |
Version | License | PHP version | Categories | |||
web-cli-detector 1.0.5 | MIT/X Consortium ... | 7.4 | PHP 5, System information, Console |
Description | Author | |||
This class can detect if PHP is running from CLI or a Web server. Innovation Award
|
Detection of execution by command (Terminal) or web environment.
Acronym: [WEB-CLI-Detector].
Name: WEB-CLI-Detector.
Dependencies: Stand Alone / PHP v7.4.
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)
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.
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
None necessary.
composer require arcanisgk/web-cli-detector
or
composer require arcanisgk/web-cli-detector --dev
use IcarosNet\WebCLIDetector\WebCLIDetector;
require __DIR__.'\..\vendor\autoload.php';
$wc_detector = new WebCLIDetector();
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();
this is an option to instance and validate in one line
if (WebCLIDetector::getInstance()->isCLI()) {
//your logic
}
CLI Test
Web Test
Files |
File | Role | Description | ||
---|---|---|---|---|
example (1 file) | ||||
src (1 file) | ||||
composer.json | Data | Auxiliary data | ||
composer.lock | Data | Auxiliary data | ||
LICENSE | Lic. | License text | ||
README.md | Doc. | Documentation |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
100% |
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.