PHP code example of arcanisgk / web-cli-detector
1. Go to this page and download the library: Download arcanisgk/web-cli-detector library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
arcanisgk / web-cli-detector example snippets
use IcarosNet\WebCLIToolKit\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();
if (WebCLIDetector::getInstance()->isCLI()) {
//your logic
}