A simple PHP 7.1+ class to provide system information about your server/system build.

v1.0 2020-02-05 15:54 UTC

This package is auto-updated.

Last update: 2022-04-22 08:03:23 UTC


GitHub PHP from Packagist GitHub release GitHub tag Travis (.org) Codecov

A simple PHP 7.1+ class to provide system information about your unix/linux server/system.

Get CPU information and load. Memory and storage/volume usage and information. Made with efficiency and simplicity in mind. Information is read from the virtual filesystem "/proc" on Unix systems, as such Procfs is required. There is no usage of excec or other shell commands/hacks to get to the underlying system information. All information is read from the virtual /proc filesystem.



require danielme85/simple-server-info

Include vendor/autoload.php or however else you prefer to include stuff to your project/framework.

Usage examples

use danielme85\Server\Info;

$info = new Info();

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

Static shortcut

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

Currently supported info

The following information is supported.


The method "cpuInfo" returns an array with information about the CPU. This is per core, though most of the information is duplicated as the cores usually shares the same parent information. The array is organized and indexed with the core_id. To limit the information return you can specify the core and/or an array with the information you want. The method "cpuLoad" returns an array with the percentage load per core based on samples with a set sec (default 1 sec) pause in between.

$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);


The method "memoryUsage" returns information about the current memory usage in a byte format. The method "memoryLoad" returns the percentage load/usage.

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


The method "volumesInfo" returns information about the mounted file systems/volumes.

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


The methods "processes" and "process" returns information about processes currently present in the /proc system on the system. There are results available from both the 'stat' and 'status' virtual system files. You can filter the results by passing an array of wanted columns, specify status/stat only and lastly set $runningonly = true/false.

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

System uptime

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