PHP code example of anteris-dev / os-helper

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

    

anteris-dev / os-helper example snippets



use Anteris\Helper\OS;

if ( OS::isLinux() ) {
    echo 'Running on Linux!';
}

if ( OS::isMacOs() ) {
    echo 'Running on Mac!';
}

if ( OS::isWindows() ) {
    echo 'Running on Windows!';
}



use Anteris\Helper\OS;

OS::ifLinux(function () {
    echo 'Running on Linux!';
});

OS::ifMacOs(function () {
    echo 'Running on Mac!';
});

Os::ifWindows(function () {
    echo 'Running on Windows!';
});



use Anteris\Helper\OS;


// On a Mac machine, this would output: Mac OS

echo OS::name();



use Anteris\Helper\OS;


// On a Mac machine, this would output: macos

echo OS::shortName();