tivie/php-os-detector

A small utility library that detects the OS the server is running on

Maintainers

πŸ‘ Tivie

Package info

github.com/tivie/php-os-detector

Homepage

pkg:composer/tivie/php-os-detector

Statistics

Installs: 1 641 270

Dependents: 11

Suggesters: 0

Stars: 20

Open Issues: 1

1.1.0 2017-10-21 03:33 UTC

Requires

  • php: >=5.3.0

Requires (Dev)

Suggests

None

Provides

None

Conflicts

None

Replaces

None

APACHE 2.0 9461dcd85c00e03842264f2fc8ccdc8d46867321

  • EstevΓ£o Soares dos Santos <estevao.woop@soares-dos-santos.com>

detectionosidentificationoperating systemdetectoros detection

This package is not auto-updated.

Last update: 2026-06-07 02:27:02 UTC


README

πŸ‘ Latest Stable Version
πŸ‘ Total Downloads
πŸ‘ License

A small PHP utility library that detects the OS the server is running on.

Compatibility

Although only tested in PHP 7, PHP OS Detector should be compatible with PHP 5.3 or greater

Installation

You can install it by cloning the git repository or using composer.

Git clone

git clone https://github.com/tivie/php-os-detector.git

Composer

Add these lines to your composer.json:

 {
 "require": {
 "tivie/php-os-detector": "*"
 }
 }

or run the following command:

php composer.phar require tivie/php-os-detector

Usage Example

$os = new \Tivie\OS\Detector();
$kernelName = $os->getKernelName();
if ($os->isUnixLike()) {
 echo "I'm using a Unix like system with kernel $kernelName";
} else if ($os->isWindowsLike()) {
 echo "I'm using a Windows like system with kernel $kernelName";
} else {
 echo "I'm using a non-Unix non-Windows system";
}

Contribute

Feel free to contribute by forking or making suggestions.

Issue tracker: https://github.com/tivie/php-os-detector/issues

Source code: https://github.com/tivie/php-os-detector

License

Command Library is released under Apache 2.0 license. For more information, please consult the LICENSE file in this repository or http://www.apache.org/licenses/LICENSE-2.0.txt.