1. Go to this page and download the library: Download dev-hvmnd/memory-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/ */
dev-hvmnd / memory-info example snippets
use DevHvmnd\MemoryInfo\MemoryDataReader;
use DevHvmnd\MemoryInfo\MemoryInfoReadException;
$reader = new MemoryDataReader();
try {
$memoryInfo = $reader->getMemoryInfo();
echo $memoryInfo->memTotal;
echo $memoryInfo->memAvailable;
} catch (MemoryInfoReadException $exception) {
// Handle missing /proc/meminfo, unreadable data, or unsupported field sets.
}
$memoryInfo = (new MemoryInfoParser())->parse($contents);