PHP code example of open-southeners / machine-stats

1. Go to this page and download the library: Download open-southeners/machine-stats 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/ */

    

open-southeners / machine-stats example snippets


use OpenSoutheners\MachineStats\StatsManager;

$report = StatsManager::report();

$report->os->value; // 'linux'
$report->cpuCores; // 8
$report->cpuUsage; // 17.12
$report->memoryUnit->name; // 'GB'
$report->memoryAvailable; // 11.89
$report->memoryUsed; // 4.11
$report->diskUnit->name; // 'GB'
$report->diskCapacity; // 200
$report->diskAvailable; // 189
$report->diskUsed; // 11

use OpenSoutheners\MachineStats\StatsManager;
use OpenSoutheners\MachineStats\Drivers\DriverInterface;

$this->app->bind(StatsManager::class, fn () => new StatsManager);
$this->app->bind(DriverInterface::class, fn (Application $app) => $app->make(StatsManager::class)->getDriver());