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(7mo ago)05MITPHPPHP ^8.4

Since Oct 6Pushed 7mo 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 1mo ago

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

31

—

LowBetter than 68% of packages

Maintenance63

Regular maintenance activity

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

223d 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

[civicrm/civicrm-core

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

728272.9k20](/packages/civicrm-civicrm-core)[pocketmine/pocketmine-mp

A server software for Minecraft: Bedrock Edition written in PHP

3.5k74.6k86](/packages/pocketmine-pocketmine-mp)[orchestra/canvas

Code Generators for Laravel Applications and Packages

21017.2M158](/packages/orchestra-canvas)[flow-php/etl

PHP ETL - Extract Transform Load - Abstraction

374468.4k51](/packages/flow-php-etl)[j0k3r/php-readability

Automatic article extraction from HTML

186808.8k6](/packages/j0k3r-php-readability)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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