PHPackages                             phluxcp/operating-system - 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. phluxcp/operating-system

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

phluxcp/operating-system
========================

A PHP component to detect the running OS name, version and family.

0.1.1(9mo ago)05MITPHPPHP ^8.4

Since Oct 6Pushed 9mo ago1 watchersCompare

[ Source](https://github.com/phluxcp/operating-system)[ Packagist](https://packagist.org/packages/phluxcp/operating-system)[ RSS](/packages/phluxcp-operating-system/feed)WikiDiscussions main Synced today

READMEChangelog (2)Dependencies (9)Versions (3)Used By (0)

[![Phlux Control Panel logo](https://github.com/phluxcp/art/raw/main/logo.svg "Phlux")](https://github.com/phluxcp/art/blob/main/logo.svg)

phluxcp/operating-system
========================

[](#phluxcpoperating-system)

A PHP framework-agnostic component to detect the running OS name, version and family. It can also be installed globally to [use a binary](#binary-usage) to show your operating system.

Warning

This package is in early development stage and is not ready for production use. It is not tested yet, so use it at your own risk.

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

[](#installation)

```
composer require phluxcp/operating-system
```

Usage
-----

[](#usage)

```
// Instance of Phlux\Component\OperatingSystem\System\SystemInterface
$system = Phlux\Component\OperatingSystem\detect();
```

Each OS instance class can (and should) extend a parent OS class if it is a derivative.

For example, you can detect if the running system is Ubuntu by checking the instance of the class:

```
use Phlux\Component\OperatingSystem;

$system = OperatingSystem\detect(); // Ubuntu instance
$system instanceof OperatingSystem\System\Ubuntu; // true
```

At the same time, you can check if you are running a Debian based OS, even if it is a derivated OS.

This can be very useful if you want to check between major Linux distributions:

```
use Phlux\Component\OperatingSystem;

$system = OperatingSystem\detect(); // Ubuntu instance

if ($system instanceof OperatingSystem\System\Debian) {
    // Do something if OS is Debian, Ubuntu, LMDE, Elementary...
} elseif ($system instanceof OperatingSystem\System\Fedora) {
    // Do something if OS is Fedora, RHEL, CentOS...
}
```

Adding new detectors
--------------------

[](#adding-new-detectors)

If you need to add a new detector for an obscure case, OS, or cannot wait for a pull request to get merged you can add more detectors when instantiating the `Detector` class:

```
use Phlux\Component\OperatingSystem;

// Create a new detector instance with custom detectors...

$detector = new OperatingSystem\Detector(
    new OperatingSystem\Filesystem\Amp(),
    [
        \MyNamespace\OperatingSystem\ObscureOS::class,
        // You can add detectors as you want if they all implements Phlux\Component\OperatingSystem\System\SystemInterface
    ],
);

// ...or add to the default detectors from the constructor...

$detector = new OperatingSystem\Detector(
    new OperatingSystem\Filesystem\Amp(),
    [
        ...OperatingSystem\Detector::DEFAULT_DETECTORS, // Include default detectors
        \MyNamespace\OperatingSystem\ObscureOS::class,
        // You can add detectors as you want if they all implements Phlux\Component\OperatingSystem\System\SystemInterface
    ],
);

// ...or add them later

$detector = new OperatingSystem\Detector(new OperatingSystem\Filesystem\Amp());
$detector->addSystem(\MyNamespace\OperatingSystem\ObscureOS::class);
```

Implement `SystemInterface` if the OS is not a derivated distribution...

```
use Phlux\Component\OperatingSystem\System\SystemInterface;

class ObscureOS implements SystemInterface
{
    // ...
}
```

...or just extend another OS

```
use Phlux\Component\OperatingSystem\System\Debian;

class ObscureOS extends Debian
{
    // ...
}
```

Binary usage
------------

[](#binary-usage)

Besides `phluxcp/operating-system` is primarily intended to be programmatically used, it can be used to play as a binary in a global installation.

Simply run

```
composer global require phluxcp/operating-system
```

and run `detect-operating-system`

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance58

Moderate activity, may be stable

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

270d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/462de3bc6b5b394cc968eb74fc519cb923d18903f79cad6dc0397f9607b41f36?d=identicon)[DevNIX](/maintainers/DevNIX)

---

Top Contributors

[![devnix](https://avatars.githubusercontent.com/u/1777519?v=4)](https://github.com/devnix "devnix (20 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/phluxcp-operating-system/health.svg)

```
[![Health](https://phpackages.com/badges/phluxcp-operating-system/health.svg)](https://phpackages.com/packages/phluxcp-operating-system)
```

###  Alternatives

[symfony/symfony

The Symfony PHP framework

31.4k87.2M2.2k](/packages/symfony-symfony)[laravel/framework

The Laravel Framework.

34.8k543.8M20.1k](/packages/laravel-framework)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

751291.4k43](/packages/civicrm-civicrm-core)[drupal/core

Drupal is an open source content management platform powering millions of websites and applications.

21866.0M1.7k](/packages/drupal-core)[flow-php/flow

PHP ETL - Extract Transform Load - Data processing framework

85036.3k](/packages/flow-php-flow)[wikimedia/parsoid

Parsoid, a bidirectional parser between wikitext and HTML5

187557.3k3](/packages/wikimedia-parsoid)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
