operating-system / operating-system
Wrapper for retrieving information about an operating system with native PHP functions
v1.0.2
2020-09-06 11:30 UTC
Requires
- php: ^7.4
Requires (Dev)
- phpunit/phpunit: ^9.3
This package is auto-updated.
Last update: 2021-04-06 12:38:41 UTC
README
Wrapper for retrieving information about an operating system with native PHP functions
Installation
$ composer require operating-system/operating-system
Usage
use OperatingSystem\OperatingSystem\OperatingSystem; use OperatingSystem\OperatingSystem\Exception\PosixNotAvailableException; $os = new OperatingSystem(); 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.