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

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

innmind/operating-system
========================

Abstraction for the whole system the script is operating in

7.0.0(3mo ago)994.5k↓27.3%[2 issues](https://github.com/Innmind/OperatingSystem/issues)20MITPHPPHP ~8.4CI passing

Since Oct 21Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/Innmind/OperatingSystem)[ Packagist](https://packagist.org/packages/innmind/operating-system)[ Docs](http://github.com/Innmind/OperatingSystem)[ RSS](/packages/innmind-operating-system/feed)WikiDiscussions develop Synced 1mo ago

READMEChangelog (10)Dependencies (13)Versions (35)Used By (20)

OperatingSystem
===============

[](#operatingsystem)

[![CI](https://github.com/Innmind/OperatingSystem/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/Innmind/OperatingSystem/actions/workflows/ci.yml)[![codecov](https://camo.githubusercontent.com/34f3bba73fac54cad0ca1aaee146cc6e707cea161824d855c30bd43bf4bd7740/68747470733a2f2f636f6465636f762e696f2f67682f696e6e6d696e642f6f7065726174696e6773797374656d2f6272616e63682f646576656c6f702f67726170682f62616467652e737667)](https://codecov.io/gh/innmind/operatingsystem)[![Type Coverage](https://camo.githubusercontent.com/22c4a12e819df87199ae792bd1f479bbcef44dbd4cf88d5fb8fdab7b9ffa7b54/68747470733a2f2f73686570686572642e6465762f6769746875622f696e6e6d696e642f6f7065726174696e6773797374656d2f636f7665726167652e737667)](https://shepherd.dev/github/innmind/operatingsystem)

Abstraction for most of the operating system the PHP code run on.

The goal is to deal with the operating system in a more abstract way (instead of dealing with concrete, low level, details).

Important

you must use [`vimeo/psalm`](https://packagist.org/packages/vimeo/psalm) to make sure you use this library correctly.

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

[](#installation)

```
composer require innmind/operating-system
```

Documentation
-------------

[](#documentation)

Documentation is located in the [`documentation/`](documentation) folder.

Usage
-----

[](#usage)

```
use Innmind\OperatingSystem\Factory;

$os = Factory::build();
```

### Want to access the system clock ?

[](#want-to-access-the-system-clock-)

`$os->clock()` will return an instance of [`Innmind\Time\Clock`](https://github.com/innmind/time#usage).

### Want to access the filesystem ?

[](#want-to-access-the-filesystem-)

```
use Innmind\Url\Path;

$adapter = $os
    ->filesystem()
    ->mount(Path::of('/var/data/'))
    ->unwrap();
```

`$adater` is an instance of [`Innmind\Filesystem\Adapter`](http://innmind.github.io/Filesystem/).

### Want to list processes running on the system ?

[](#want-to-list-processes-running-on-the-system-)

`$os->status()->processes()->all()` will return a map of [`Inmmind\Immutable\Set`](https://github.com/innmind/serverstatus#usage).

### Want to run a command on the system ?

[](#want-to-run-a-command-on-the-system-)

```
use Innmind\Server\Control\Server\Command;

$process = $os
    ->control()
    ->processes()
    ->execute(Command::foreground('echo foo'))
    ->unwrap();
```

`$process` is an instance of [`Innmind\Server\Control\Server\Process`](https://github.com/innmind/servercontrol#usage).

### Want to open a port to the outside world ?

[](#want-to-open-a-port-to-the-outside-world-)

```
use Innmind\Socket\Internet\Transport;
use Innmind\IP\IPv4;
use Innmind\Url\Authority\Port;

$server = $os
    ->ports()
    ->open(
        Transport::tcp(),
        IPv4::localhost(),
        Port::of(1337),
    )
    ->unwrap();
```

`$server` is an instance of [`Innmind\IO\Sockets\Servers\Server`](https://innmind.org/io/sockets/).

### Want to open a local socket ?

[](#want-to-open-a-local-socket-)

```
# process A
use Innmind\Socket\Address\Unix;

$server = $os
    ->sockets()
    ->open(Unix::of('/tmp/foo.sock'))
    ->unwrap();
```

`$server` is an instance of [`Innmind\IO\Sockets\Servers\Server`](https://innmind.org/io/sockets/).

```
# process B
use Innmind\Socket\Address\Unix;

$client = $os
    ->sockets()
    ->connectTo(Unix::of('/tmp/foo.sock'))
    ->unwrap();
```

`$client` is an instance of [`Innmind\IO\Sockets\Clients\Client`](https://innmind.org/io/sockets/#clients).

### Want to execute commands on a remote server ?

[](#want-to-execute-commands-on-a-remote-server-)

```
use Innmind\Url\Url;
use Innmind\Server\Control\Server\Command;

$process = $os
    ->remote()
    ->ssh(Url::of('ssh://user@server-address:1337'))
    ->processes()
    ->execute(Command::foreground('ls'))
    ->unwrap();
```

`$process` is an instance of [`Innmind\Server\Control\Server\Process`](https://github.com/innmind/servercontrol#usage).

### Want to do a http call ?

[](#want-to-do-a-http-call-)

```
use Innmind\Http\{
    Request,
    Method,
    ProtocolVersion,
};
use Innmind\Url\Url;

$response = $os
    ->remote()
    ->http()(Request::of(
        Url::of('http://example.com'),
        Method::get,
        ProtocolVersion::v20,
    ));
```

### Want to access current process id ?

[](#want-to-access-current-process-id-)

```
$os->process()->id()->unwrap();
```

### Want to pause the current process ?

[](#want-to-pause-the-current-process-)

```
use Innmind\Time\Period;

$os->process()->halt(Period::minute(1));
```

### Want to listen for a signal ?

[](#want-to-listen-for-a-signal-)

```
use Innmind\Signals\Signal;

$os->process()->signals()->listen(Signal::terminate, function() {
    // handle the signal here
})->unwrap();
```

###  Health Score

60

—

FairBetter than 99% of packages

Maintenance76

Regular maintenance activity

Popularity37

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity91

Battle-tested with a long release history

 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 ~86 days

Recently: every ~143 days

Total

32

Last Release

100d ago

Major Versions

2.3.0 → 3.0.02022-03-19

3.8.0 → 4.0.02023-10-22

4.2.0 → 5.0.02024-03-10

5.2.0 → 6.0.02025-05-24

6.2.0 → 7.0.02026-02-07

PHP version history (6 changes)1.0.0PHP ~7.2

2.0.0PHP ~7.4

2.2.0PHP ~7.4|~8.0

3.0.0PHP ~8.1

4.0.0PHP ~8.2

7.0.0PHP ~8.4

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/851425?v=4)[Baptiste Langlade](/maintainers/Baptouuuu)[@Baptouuuu](https://github.com/Baptouuuu)

---

Top Contributors

[![Baptouuuu](https://avatars.githubusercontent.com/u/851425?v=4)](https://github.com/Baptouuuu "Baptouuuu (259 commits)")

---

Tags

abstractionoperating system

### Embed Badge

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

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

###  Alternatives

[willdurand/geocoder

Common files for PHP Geocoder

17435.7M159](/packages/willdurand-geocoder)[unicodeveloper/laravel-identify

A Laravel 5 Package Provider to Identify/detect a user's browser, device, operating system and Language

19322.0k](/packages/unicodeveloper-laravel-identify)[tivie/php-os-detector

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

201.6M11](/packages/tivie-php-os-detector)[consoletvs/identify

A Laravel 5 Package Provider to Identify/detect a user's browser, device, operating system and Language

2775.4k6](/packages/consoletvs-identify)[ebidtech/collection

A set of interfaces and traits to speed up the creation of collections

13119.8k6](/packages/ebidtech-collection)

PHPackages © 2026

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