Skip to content

Commit 2e76823

Browse files
committed
Update readme
1 parent 5e65867 commit 2e76823

File tree

1 file changed

+70
-1
lines changed

1 file changed

+70
-1
lines changed

README.md

Lines changed: 70 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,70 @@
1-
# php-server-info
1+
# PHP Server Info
2+
3+
## Installation
4+
5+
```bash
6+
composer require divineomega/php-server-info
7+
```
8+
9+
## Usage
10+
11+
```php
12+
<?php
13+
14+
use DivineOmega\ServerInfo\Server;
15+
use DivineOmega\SSHConnection\SSHConnection;
16+
17+
require_once __DIR__.'/../vendor/autoload.php';
18+
19+
$connection = (new SSHConnection())
20+
->to('example.com')
21+
->as('username')
22+
->withPrivateKey('/home/user/.ssh/id_rsa');
23+
24+
$array = (new Server($connection))
25+
->metrics()
26+
->toArray();
27+
28+
var_dump($array);
29+
```
30+
31+
```php
32+
array(14) {
33+
["uptime"]=>
34+
int(7564013)
35+
["hostname"]=>
36+
string(11) "example"
37+
["disk-usage-percentage"]=>
38+
int(29)
39+
["total-disk-space-bytes"]=>
40+
int(18045964)
41+
["memory-usage-percentage"]=>
42+
int(37)
43+
["total-memory-bytes"]=>
44+
int(1009128)
45+
["swap-usage-percentage"]=>
46+
int(26)
47+
["total-swap-bytes"]=>
48+
int(1048572)
49+
["mysql-server-running"]=>
50+
bool(true)
51+
["apache-server-running"]=>
52+
bool(false)
53+
["nginx-server-running"]=>
54+
bool(true)
55+
["active-http-connections"]=>
56+
int(0)
57+
["load-averages"]=>
58+
array(3) {
59+
[1]=>
60+
float(0.13)
61+
[5]=>
62+
float(0.19)
63+
[15]=>
64+
float(0.13)
65+
}
66+
["cpu-usage-percentage"]=>
67+
float(6.2)
68+
}
69+
70+
```

0 commit comments

Comments
 (0)