Skip to content

Commit

Permalink
Updated installation instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
ahaaje committed Jul 21, 2017
1 parent 43edb08 commit 622731c
Showing 1 changed file with 37 additions and 1 deletion.
38 changes: 37 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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.

Expand All @@ -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
<?php
require '../vendor/autoload.php';

use Ahaaje\LinuxSystemInformation\System;

try {
$system = new System();

echo 'Host:' . $system, PHP_EOL;
echo 'Load average last 5 minutes: ' . $system->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;
}

```

0 comments on commit 622731c

Please sign in to comment.