PHP code example of knotsphp / system

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

    

knotsphp / system example snippets


use KnotsPHP\System\System;
use KnotsPHP\System\Enums\OperatingSystem;

// Get the operating system
$os_enum = OperatingSystem::current(); // Returns an enum
$os = System::os(); // Returns an instance of OperatingSystemContract

// Get basic system information
echo $os->name();           // MacOS    Ubuntu            Windows
echo $os->version();        // 15.2     20.04             10
echo $os->kernel();         // 24.2.0   5.4.0-42-generic  10.0.18363.1316
echo $os->build();          // 24C101   5.4.0-42-generic  21H2