2017 © Pedro Peláez
 

library serverinfo

Retreive serverinfo via SSH Wrapper

image

wiardvanrij/serverinfo

Retreive serverinfo via SSH Wrapper

  • Sunday, October 22, 2017
  • by wiardvanrij
  • Repository
  • 2 Watchers
  • 3 Stars
  • 13 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

Server information via PHP

Information

This libary uses the "ssh wrapper" : https://github.com/wiardvanrij/sshwrapper as requirement, (*1)

It provides out of the box functions to retrieve server information. Mostly used for webbased servers on a Linux operating system, (*2)

Requirements

Please read the sshwrapper library, you will need ssh2 php module., (*3)

Installation

Via composer, (*4)

{
    "require": {
        "wiardvanrij/serverinfo": "^0"
    }
}

or, (*5)

composer require wiardvanrij/serverinfo

Usage

again please read the sshwrapper for those features, (*6)

Require the autoloader and include the namespaces, (*7)

<?php
require_once('vendor/autoload.php');

use SshWrapper\SshCore;
use ServerInfo\ServerCore;

Initiate the class with the host and make a connection, (*8)

$ssh = new SshCore('123.123.123.123');
$ssh->connect();

Initiate the serverinfo class and pass the connection, (*9)

$server = new ServerCore($ssh);

Use the functions you desire, (*10)

Returns the hostname of the server as string, (*11)

$hostname = $server->getHostname();

Returns the exact PHP version/service on the server. For instance php7.0 or php7.0-fpm etc., (*12)

$php      = $server->getPHPServiceName();

Returns an array of the vhosts including domains, vhost location and aliases sorted by port 80 & 443, (*13)

$data     = $server->getVhosts();     

Example output:, (*14)

Array
(
    [http] => Array
        (
            [1] => Array
                (
                    [domain] => foo.com
                    [config] => /etc/apache2/sites-enabled/ssl-foo.com.conf
                )
            [2] => Array
                (
                    [domain] => bar.com
                    [config] => /etc/apache2/sites-enabled/ssl-bar.com.conf
                    [aliases] => Array
                        (
                            [0] => foobar.eu
                            [1] => www.barfoo.eu
                        )

                )
        )
    [https] => Array
        (
            [1] => Array
                (
                    [domain] => foo.com
                    [config] => /etc/apache2/sites-enabled/foo.com.conf
                )
            [2] => Array
                (
                    [domain] => bar.com
                    [config] => /etc/apache2/sites-enabled/bar.com.conf
                    [aliases] => Array
                        (
                            [0] => foobar.eu
                            [1] => www.barfoo.eu
                        )

                )
         )
)                                      

The Versions

22/10 2017

dev-master

9999999-dev https://github.com/wiardvanrij/serverinfo

Retreive serverinfo via SSH Wrapper

  Sources   Download

MIT

The Requires

 

by Wiard van Rij

22/10 2017

1.0.0

1.0.0.0 https://github.com/wiardvanrij/serverinfo

Retreive serverinfo via SSH Wrapper

  Sources   Download

MIT

The Requires

 

by Wiard van Rij

22/10 2017

0.02

0.02.0.0 https://github.com/wiardvanrij/serverinfo

Retreive serverinfo via SSH Wrapper

  Sources   Download

MIT

The Requires

 

by Wiard van Rij

22/10 2017

0.01

0.01.0.0 https://github.com/wiardvanrij/serverinfo

Retreive serverinfo via SSH Wrapper

  Sources   Download

MIT

by Wiard van Rij