PHP code example of danielme85 / simple-server-info

1. Go to this page and download the library: Download danielme85/simple-server-info 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/ */

    

danielme85 / simple-server-info example snippets


use danielme85\Server\Info;

$info = new Info();

$cpuInfo = $info->cpuInfo();
$cpuUsage = $info->cpuLoad($sampleSec = 1, $rounding = 2);

 

$memoryInfo = Info::get()->memoryInfo();

$cpuinfo = Info::get()->cpuInfo();
$filteredCpuInfo = Info::get()->cpuInfo($core = null, ['processor', 'model_name', 'cpu_mhz', 'cache_size']);
$cpuLoad = Info::get()->cpuLoad($sampleSec = 1, $rounding = 2);

$memoryUsage = Info::get()->memoryUsage();
$memoryLoad = Info::get()->memoryLoad();

$volumes = Info::get()->volumesInfo(),

$allprocs = Info::get()->processes();
$filteredprocs = Info::get()->processes(['name', 'state', 'pid', 'ppid', 'vmpeak', 'vmsize', 'threads'], 'status', true);
$spesifficproc = Info::get()->process($pid);

$uptime => Info::get()->uptime(),