PHPackages                             demvsystems/exec - 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. demvsystems/exec

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

demvsystems/exec
================

A Wrapper for exec and it's results

0.2.1(3y ago)265.2k↑25.9%[1 PRs](https://github.com/demvsystems/exec/pulls)MITPHPPHP &gt;=5.5.0

Since Jun 10Pushed 11mo ago2 watchersCompare

[ Source](https://github.com/demvsystems/exec)[ Packagist](https://packagist.org/packages/demvsystems/exec)[ Docs](https://github.com/demvsystems/exec)[ RSS](/packages/demvsystems-exec/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (7)Dependencies (1)Versions (9)Used By (0)

exec
====

[](#exec)

exec is a wrapper for the php `exec()` command, which allows to build CLI commands with the help of chaining.

The Command Class
-----------------

[](#the-command-class)

Everything starts with the Command class, which let's you create any command in the following fashion:

```
echo Command::create()
  ->app('echo')
  ->input('Hello World')
  ->exec();
//prints out "Hello World"
```

This would create a command, which is running the application echo with the input "Hello World" and executes it right away. For a full reference on what is possible with the Command head over to the [associated wiki entry](https://github.com/demvsystems/exec/wiki/Command).

Asynchronous Commands
---------------------

[](#asynchronous--commands)

You are also able to execute a command asynchronously, by appending the `async()` method to your command. The echo example from before would look like this:

```
$async = Command::create()
  ->app('echo')
  ->input('Hello World')
  ->async()
  ->exec();
```

Which returns an `Async` object. With this object, you can do:

- check if the command is still running
- check if a command with a similar syntax is currently running
- kill ithe command
- kill every command with a similar syntax

Of course the above example doesn't make much sense, because we will never get a look at the result. Therefor we can pipe the result into a file.

```
$async = Command::create()
  ->app('echo')
  ->input('Hello World')
  ->async()
  ->path('hello.txt')
  ->exec();
```

This will write a file called `hello.txt` with the content of our command, as soon as it terminates. For more on asynchronous commands have a look at [the wiki page](https://github.com/demvsystems/exec/wiki/Async).

\##Application Instead of defining every app in a string, inside of the app call, you are also able to use some of the predefined apps, which wrap away some of the repetetive work. For example take the [PhpApp](https://github.com/demvsystems/exec/blob/master/src/Application/PhpApp.php). Normally you would build a command like this to get the PHP version:

```
Command::create()
  ->app('php')
  ->arg('v')
  ->exec();
```

But with the PhpApp you can get rid of the string param:

```
Command::create()
  ->phpApp()
  ->arg('v')
  ->exec();
```

There are already some other advanced apps, which wrap away their special syntax, like the [XArgsApp](https://github.com/demvsystems/exec/blob/master/src/Application/XargsApp.php). For a full reference on which apps are available and how they work, have a look at the [Application wiki entry](https://github.com/demvsystems/exec/wiki/Application).

You are also able to write your own app wrappers. Have a look [at this](https://github.com/demvsystems/exec/wiki/Create-your-own-Application-Wrappers) on how to do it.

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance38

Infrequent updates — may be unmaintained

Popularity31

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 82.8% 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 ~373 days

Recently: every ~558 days

Total

7

Last Release

1391d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/771d66ca80a4f8717264505edfcfce796adfc4775094326a391b500cf01cdfa4?d=identicon)[demvsystems](/maintainers/demvsystems)

---

Top Contributors

[![snowiow](https://avatars.githubusercontent.com/u/3718461?v=4)](https://github.com/snowiow "snowiow (24 commits)")[![alexmpunkt](https://avatars.githubusercontent.com/u/7370582?v=4)](https://github.com/alexmpunkt "alexmpunkt (2 commits)")[![DemvSteinbrink](https://avatars.githubusercontent.com/u/194234223?v=4)](https://github.com/DemvSteinbrink "DemvSteinbrink (1 commits)")[![dotdash](https://avatars.githubusercontent.com/u/230962?v=4)](https://github.com/dotdash "dotdash (1 commits)")[![SaschaScholly](https://avatars.githubusercontent.com/u/7370371?v=4)](https://github.com/SaschaScholly "SaschaScholly (1 commits)")

---

Tags

commandexec

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/demvsystems-exec/health.svg)

```
[![Health](https://phpackages.com/badges/demvsystems-exec/health.svg)](https://phpackages.com/packages/demvsystems-exec)
```

###  Alternatives

[league/climate

PHP's best friend for the terminal. CLImate allows you to easily output colored text, special formats, and more.

1.9k14.0M273](/packages/league-climate)[league/tactician

A small, flexible command bus. Handy for building service layers.

86415.4M127](/packages/league-tactician)[mrrio/shellwrap

Use any command-line tool as a PHP function.

738198.8k2](/packages/mrrio-shellwrap)[nategood/commando

PHP CLI Commando Style

8123.3M38](/packages/nategood-commando)[helhum/typo3-console

A reliable and powerful command line interface for TYPO3 CMS

2939.0M192](/packages/helhum-typo3-console)[adhocore/cli

Command line interface library for PHP

3501.2M50](/packages/adhocore-cli)

PHPackages © 2026

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