PHPackages                             azurre/php-shell - 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. [CLI &amp; Console](/categories/cli)
4. /
5. azurre/php-shell

ActiveLibrary[CLI &amp; Console](/categories/cli)

azurre/php-shell
================

A convenient none blocking asynchronous shell

2.1(4y ago)0132MITPHP

Since Mar 11Pushed 4y ago1 watchersCompare

[ Source](https://github.com/azurre/php-shell)[ Packagist](https://packagist.org/packages/azurre/php-shell)[ Docs](https://github.com/azurre/php-shell)[ RSS](/packages/azurre-php-shell/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (6)DependenciesVersions (6)Used By (0)

PHP Shell [![Latest Version](https://camo.githubusercontent.com/6fa6078d89f78dfaf267e4117fa6fc7d6c7f2df8334c952557823ebd7d3f74f7/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f617a757272652f7068702d7368656c6c2e7376673f7374796c653d666c61742d737175617265)](https://github.com/azurre/php-shell/releases)
=========================================================================================================================================================================================================================================================================================================================================

[](#php-shell--)

This small and easy to use PHP shell make it able to run commands as non blocking asynchronous jobs

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

[](#installation)

Install composer in your project:

```
curl -s https://getcomposer.org/installer | php

```

Require the package with composer:

```
composer require azurre/php-shell

```

Usage
-----

[](#usage)

### Simple example

[](#simple-example)

```
$loader = require_once __DIR__ . '/vendor/autoload.php';

use Azurre\Component\System\Shell;

$cmd = 'ls -lwa /tmp';
echo Shell::create()->run($cmd);
```

Output

```
total 180
drwxrwxrwt 11 root     root     4096 Jul  4 23:21 .
drwxr-xr-x 22 root     root     4096 Jun 10 16:23 ..
drwxrwxrwt  2 root     root     4096 Jun 10 16:23 .ICE-unix
drwxrwxrwt  2 root     root     4096 Jun 10 16:23 .X11-unix
drwxrwxrwt  2 root     root     4096 Jun 10 16:23 .XIM-unix
drwxrwxrwt  2 root     root     4096 Jun 10 16:23 .font-unix
-rw-------  1 www-data www-data    0 Jul  1 21:21 239315d1a4f341c8b52.14168329mUCCHL
-rw-r--r--  1 www-data www-data 6468 Jul  1 21:18 416205d1a4e5fe8e166.51692428EFpYWQ
-rw-r--r--  1 www-data www-data 6469 Jul  1 21:21 443675d1a4f3ce6efd0.08860101uETZWS
-rw-r--r--  1 www-data www-data 6416 Jul  1 21:26 494485d1a503c71cfd8.3817705715MVk4
-rw-r--r--  1 www-data www-data 6468 Jul  1 21:19 519335d1a4eba5a2ef8.14398347CWkGkb
-rw-------  1 www-data www-data    0 Jul  1 21:27 575735d1a508060a080.18275551cZg15T

```

### Background tasks

[](#background-tasks)

```
$shell = new Shell;
$shell->runAsync('ping -c 5 127.0.0.1');

echo "Start background task\n";
while($shell->isProcessRunning()) {
    echo 'Working...' .PHP_EOL;
    sleep(1);
}
echo $shell;
```

Output

```
Start background task
Working...
Working...
Working...
Working...
Working...
PING 127.0.0.1 (127.0.0.1) 56(84) bytes of data.
64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.020 ms
64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.022 ms
64 bytes from 127.0.0.1: icmp_seq=3 ttl=64 time=0.015 ms
64 bytes from 127.0.0.1: icmp_seq=4 ttl=64 time=0.023 ms
64 bytes from 127.0.0.1: icmp_seq=5 ttl=64 time=0.019 ms

--- 127.0.0.1 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4099ms
rtt min/avg/max/mdev = 0.015/0.019/0.023/0.006 ms

```

### Error handling

[](#error-handling)

```
$shell = new Shell;
$shell->run('ls /A/1/2/3/4')->waitForProcess();
if ($shell->getExitCode() !== Shell::NO_ERROR) {
    echo "\nExit code: {$shell->getExitCode()}\n";
    echo "Error: {$shell->getStdError()}\n";
} else {
    echo $shell->getStdOut();
}
```

Output

```
Exit code: 2
Error: ls: cannot access '/A/1/2/3/4': No such file or directory

```

License
-------

[](#license)

[MIT](https://choosealicense.com/licenses/mit/)

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity67

Established project with proven stability

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

Total

4

Last Release

1511d ago

Major Versions

v1.2 → 2.02019-07-04

### Community

Maintainers

![](https://www.gravatar.com/avatar/f5bbeafb1d06ec9c1ba940980a19a3fd3902cef3499a446726677986be73b0ec?d=identicon)[a.milenin](/maintainers/a.milenin)

---

Top Contributors

[![azurre](https://avatars.githubusercontent.com/u/2183975?v=4)](https://github.com/azurre "azurre (11 commits)")

---

Tags

asyncasynchronousshellprocesslinuxcmdnone blocking

### Embed Badge

![Health badge](/badges/azurre-php-shell/health.svg)

```
[![Health](https://phpackages.com/badges/azurre-php-shell/health.svg)](https://phpackages.com/packages/azurre-php-shell)
```

###  Alternatives

[psy/psysh

An interactive shell for modern PHP.

9.8k569.8M785](/packages/psy-psysh)[mikehaertl/php-shellcommand

An object oriented interface to shell commands

32439.6M69](/packages/mikehaertl-php-shellcommand)[seregazhuk/php-watcher

Automatically restart PHP application once the source code changes

394138.4k6](/packages/seregazhuk-php-watcher)[jolicode/castor

A lightweight and modern task runner. Automate everything. In PHP.

54642.4k4](/packages/jolicode-castor)[zhgzhg/gphpthread

Generic PHP Threads library using only pure PHP

154.3k](/packages/zhgzhg-gphpthread)[ptlis/shell-command

A basic wrapper around execution of shell commands.

2256.8k2](/packages/ptlis-shell-command)

PHPackages © 2026

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