PHPackages                             loophp/phposinfo - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. loophp/phposinfo

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

loophp/phposinfo
================

Try to guess the host operating system.

1.8.0(3y ago)76.6M—2.4%[7 PRs](https://github.com/loophp/phposinfo/pulls)9MITPHPPHP ^8CI failing

Since Jul 22Pushed 4mo ago2 watchersCompare

[ Source](https://github.com/loophp/phposinfo)[ Packagist](https://packagist.org/packages/loophp/phposinfo)[ GitHub Sponsors](https://github.com/drupol)[ RSS](/packages/loophp-phposinfo/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (5)Versions (24)Used By (9)

[![Latest Stable Version](https://camo.githubusercontent.com/3833b5a6ddab6787700d73e9cfb9d029088954185fb759b83b080e657b16714e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6c6f6f7068702f7068706f73696e666f2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/loophp/phposinfo)[![GitHub stars](https://camo.githubusercontent.com/c5db498ab634bb9fd6e9c47f3e6bf5fda29495d2bcad159894167fadeafefa40/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f6c6f6f7068702f7068706f73696e666f2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/loophp/phposinfo)[![Total Downloads](https://camo.githubusercontent.com/f8d7677210a4acdf7e36e7556d0b0e04c0d7536110104c2c20930547e749bbe4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6c6f6f7068702f7068706f73696e666f2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/loophp/phposinfo)[![GitHub Workflow Status](https://camo.githubusercontent.com/366c09d936608c1daf75293d62e8e87625326ac55205277831b07cbc4cc4571e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6c6f6f7068702f7068706f73696e666f2f74657374732e796d6c3f6272616e63683d6d6173746572267374796c653d666c61742d737175617265)](https://github.com/loophp/phposinfo/actions)[![Scrutinizer code quality](https://camo.githubusercontent.com/65161fb6cd512d022d8e92260ba8c15a5f7f6ff3bba033f0ede8b11271a0bc42/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f7175616c6974792f672f6c6f6f7068702f7068706f73696e666f2f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/loophp/phposinfo/?branch=master)[![Type Coverage](https://camo.githubusercontent.com/a818aad805b6e692314d1faf60093ee7b29d927889b39cd14ebc43e4d1b4a9b2/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f64796e616d69632f6a736f6e3f7374796c653d666c61742d73717561726526636f6c6f723d636f6c6f72266c6162656c3d54797065253230636f7665726167652671756572793d6d6573736167652675726c3d687474707325334125324625324673686570686572642e6465762532466769746875622532466c6f6f7068702532467068706f73696e666f253246636f766572616765)](https://shepherd.dev/github/loophp/phposinfo)[![Code Coverage](https://camo.githubusercontent.com/dd54d1790ef1e2c936d45a340f47b5090d9ca6bcd0e29f9c0fe098dffb8e80df/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f6c6f6f7068702f7068706f73696e666f2f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/loophp/phposinfo/?branch=master)[![License](https://camo.githubusercontent.com/bca2b15fbecf71fc124e2207aeb53bea736a6d438c70f26108c079883d98b599/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6c6f6f7068702f7068706f73696e666f2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/loophp/phposinfo) [![Donate!](https://camo.githubusercontent.com/a71f45de7e408be2477113d166e9ee94c90bbf814a1373fd154aa5b6652302de/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f53706f6e736f722d4769746875622d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](https://github.com/sponsors/drupol)

PHP OS Info
===========

[](#php-os-info)

Description
-----------

[](#description)

Get information of the current operating system where PHP is running on.

Information that you can retrieve are:

- Operating system name
- Operating system family
- Machine UUID

There are many packages that does that already, but most of them are based on the use of the variable `PHP_OS` that contains the operating system name PHP was built on, from [php.net](https://www.php.net/manual/en/reserved.constants.php):

```
 The operating system PHP was built for.

```

However, `PHP_OS` might be sometimes not very accurate, then using [php\_uname()](https://php.net/php_uname) might be a better fit for detecting the operating system, we only use it as a fallback.

This library uses [php\_uname()](https://php.net/php_uname) and a static list of existing operating systems, and then from there, tries to deduct the operating system family.

From PHP 7.2, the variable `PHP_OS_FAMILY` was added and based on the definition from [php.net](https://www.php.net/manual/en/reserved.constants.php):

```
 The operating system family PHP was built for.
 Either of 'Windows', 'BSD', 'Darwin', 'Solaris', 'Linux' or 'Unknown'.

```

So once again, if you're using a PHP which is cross compiled, using those constant is a bad idea.

Requirements
------------

[](#requirements)

- PHP &gt;= 7.1.3

Installation
------------

[](#installation)

`composer require loophp/phposinfo`

Usage
-----

[](#usage)

```
