From 622731c17775bf2c037c377b3548f190c6e86b99 Mon Sep 17 00:00:00 2001 From: "Arne K. Haaje" Date: Fri, 21 Jul 2017 15:55:14 +0200 Subject: [PATCH] Updated installation instructions --- README.md | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index abe0107..bcd081e 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,8 @@ Linux System Information ========================= +[![Latest Stable Version](https://poser.pugx.org/ahaaje/linux-system-information/v/stable)](https://packagist.org/packages/ahaaje/linux-system-information) +[![License](https://poser.pugx.org/ahaaje/linux-system-information/license)](https://packagist.org/packages/ahaaje/linux-system-information) +[![composer.lock](https://poser.pugx.org/ahaaje/linux-system-information/composerlock)](https://packagist.org/packages/ahaaje/linux-system-information) This is a light-weight library to gather information (stats) about the Linux system it is running on. @@ -16,4 +19,37 @@ Stats that can be fetched ------------------------- - hostname - load average (for 1, 5 or 15 minutes) -- memory, as total, available and used +- memory as total, available and used + +### Requirements + - Linux + - PHP 5.5 + +### Installation +With [composer](https://getcomposer.org/) simply do `composer require ahaaje/linux-system-information` inside your project directory. + +### Usage +This is from the example file. You should not need to require the auto loader if already using composer to manage your project requirements + +```php +getLoadAverage(5), PHP_EOL; + echo 'Total memory: ' . $system->getMemoryCategory('total'), PHP_EOL; + echo 'Used memory: ' . $system->getMemoryCategory('used'), PHP_EOL; + echo 'Available memory: ' . $system->getMemoryCategory('available'), PHP_EOL; +} catch (\RuntimeException $e) { + // Some stat could not be accessed + echo get_class($e) . ' : ' . $e->getMessage(), PHP_EOL; +} catch (\Exception $e) { + echo 'FATAL EXCEPTION: ' . $e->getMessage(), PHP_EOL; +} + +```