PHPackages                             innmind/virtual-machine - 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. innmind/virtual-machine

ActiveLibrary

innmind/virtual-machine
=======================

1.0.0(5y ago)07MITPHPPHP ~8.0CI failing

Since Mar 26Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/Innmind/virtual-machine)[ Packagist](https://packagist.org/packages/innmind/virtual-machine)[ Docs](http://github.com/innmind/virtual-machine)[ RSS](/packages/innmind-virtual-machine/feed)WikiDiscussions develop Synced 1w ago

READMEChangelogDependencies (5)Versions (4)Used By (0)

virtual-machine
===============

[](#virtual-machine)

[![Build Status](https://github.com/innmind/virtual-machine/workflows/CI/badge.svg?branch=master)](https://github.com/innmind/virtual-machine/actions?query=workflow%3ACI)[![codecov](https://camo.githubusercontent.com/104bbe10fcfc2a09d33944b38f671e4bfc6a385f0881259c9b44a3febe238c88/68747470733a2f2f636f6465636f762e696f2f67682f696e6e6d696e642f7669727475616c2d6d616368696e652f6272616e63682f646576656c6f702f67726170682f62616467652e737667)](https://codecov.io/gh/innmind/virtual-machine)[![Type Coverage](https://camo.githubusercontent.com/d037b11d66072a93401aa5dc01c61c437613013651ddd36aead512ac6ce479eb/68747470733a2f2f73686570686572642e6465762f6769746875622f696e6e6d696e642f7669727475616c2d6d616368696e652f636f7665726167652e737667)](https://shepherd.dev/github/innmind/virtual-machine)

Small abstraction on top of `innmind/cli` to manage processes and filesystem within the context of a project.

This is intended for CLI applications where the binary must be run within the context of the project.

**Note**: do **not** use this package for CLI tools that you can run from anywhere in your operating system.

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

[](#installation)

```
composer require innmind/virtual-machine
```

Usage
-----

[](#usage)

```
# some/binary.php

use Innmind\CLI\{
    Main,
    Environment,
};
use Innmind\OperatingSystem\OperatingSystem;
use Innmind\VirtualMachine\{
    VirtualMachine,
    Command,
};
use Innmind\Server\Status;
use Innmind\Server\Control;
use Innmind\Immutable\Set;

new class extends Main
{
    protected function main(Environment $env, OperatingSystem $os): void
    {
        $vm = VirtualMachine::of($env, $os);

        if ($env->workingDirectory()->toString() !== __DIR__.'/') {
            throw new \Exception('binary.php must me executed from within the "some/" directory')
        }

        // all required paths are resolved from the working directory so you don't
        // have to do the resolution yourself, and it's safe to require a file
        // from anywhere within your app
        $vm->filesystem()->require(Path::of('other_file.php'));

        // this is similar to $os->status()->processes()->all() but here the set
        // will only contain processes that are running whithin the working
        // directory for the same "binary.php" bin
        /** @var Set */
        $processes = $vm->processes()->all();

        // this is a shortcut to start a new process with the command
        // "php binary.php 'some-command'" started within the same working
        // directory. So you don't have to repeat the the binary name and
        // specify the working directory. The process is started in the foreground.
        /** @var Control\Server\Process */
        $process = $vm->processes()->execute(Command::of('some-command'));

        // Same as the line above except the process is started in the background
        $vm->processes()->daemon(Command::of('some-daemon'));
    }
}
```

**Note**: of course you can name your bin file anyway you want, not just `binary.php`.

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance60

Regular maintenance activity

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity59

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

Unknown

Total

1

Last Release

1879d ago

### 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 (18 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Type Coverage Yes

### Embed Badge

![Health badge](/badges/innmind-virtual-machine/health.svg)

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

PHPackages © 2026

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