operating-system/operating-system

Wrapper for retrieving information about an operating system with native PHP functions

v1.0.1 2018-12-13 21:04 UTC

This package is auto-updated.

Last update: 2019-12-01 00:19:14 UTC


README

Wrapper for retrieving information about an operating system with native PHP functions

Installation

composer require operating-system/group

Usage

Instantiate operating system:

use OperatingSystem\OperatingSystem\OperatingSystem;
use OperatingSystem\OperatingSystem\Exception\PosixNotAvailableException;

$os = new OperatingSystem();

Get information about the operating system:

if (OperatingSystem::UNIX === $os->getType()) {
    // is UNIX
} elseif (OperatingSystem::WINDOWS === $os->getType()) {
    // is Windows
} else {
    // is unknown
}
$os->getName();         // 'Linux'
$os->getHostName();     // 'michael-Lenovo-ideapad-500-15ISK'
$os->getRelease();      // '4.15.0-42-generic'
$os->getVersion();      // '#45-Ubuntu SMP Thu Nov 15 19:32:57 UTC 2018'
$os->getMachineType();  // 'x86_64'
$os->getDomainName();   // '(none)'

Testing

$ ./vendor/bin/phpunit

License

The MIT License (MIT). Please see License File for more information.