PHP code example of tivie / php-os-detector

1. Go to this page and download the library: Download tivie/php-os-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/ */

    

tivie / php-os-detector example snippets


$os = new \Tivie\OS\Detector();
$kernelName = $os->getKernelName();
if ($os->isUnixLike()) {
    echo "I'm using a Unix like system with kernel $kernelName";
} else if ($os->isWindowsLike()) {
    echo "I'm using a Windows like system with kernel $kernelName";
} else {
    echo "I'm using a non-Unix non-Windows system";
}
json
    {
        "/php-os-detector": "*"
        }
    }