PHPackages                             ballen/executioner - 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. ballen/executioner

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

ballen/executioner
==================

Executioner is a PHP library for executing system processes and applications with the ability to pass extra arguments and read CLI output results.

4.0.2(3y ago)45.8k↓100%1[1 PRs](https://github.com/allebb/executioner/pulls)1MITPHPPHP &gt;=7.3.0CI passing

Since Mar 28Pushed 3mo ago2 watchersCompare

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

READMEChangelog (7)Dependencies (2)Versions (11)Used By (1)

Executioner
===========

[](#executioner)

[![Build](https://github.com/allebb/executioner/workflows/build/badge.svg)](https://github.com/allebb/executioner/actions)[![Code Coverage](https://camo.githubusercontent.com/f7dd06bcf7ac0d68b3edf69c65991f14a5d81d80f0ae04b4b7061ecb8a22c771/68747470733a2f2f636f6465636f762e696f2f67682f616c6c6562622f657865637574696f6e65722f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/allebb/executioner)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/c40d254e1c684b3012f82fa8ed6d18a83f42a25c0bc46a5ca0f2e93e573d5459/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f616c6c6562622f657865637574696f6e65722f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/allebb/executioner/?branch=master)[![Code Climate](https://camo.githubusercontent.com/9e5d8d68c0f061eb3f7ae62fcc3f8e28ad0996163f0f0cf153d84a4fd4f21bcb/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f616c6c6562622f657865637574696f6e65722f6261646765732f6770612e737667)](https://codeclimate.com/github/allebb/executioner)[![Latest Stable Version](https://camo.githubusercontent.com/243568285bbb96415677e818bc7dd7dd503b4f5ba534ebb71f6b962d95d5b6ba/68747470733a2f2f706f7365722e707567782e6f72672f62616c6c656e2f657865637574696f6e65722f762f737461626c65)](https://packagist.org/packages/ballen/executioner)[![Latest Unstable Version](https://camo.githubusercontent.com/63fd4e890fd8244748f3dcbb053f425753a05f89bf3fbb876bf51b1a89f4fd27/68747470733a2f2f706f7365722e707567782e6f72672f62616c6c656e2f657865637574696f6e65722f762f756e737461626c65)](https://packagist.org/packages/ballen/executioner)[![License](https://camo.githubusercontent.com/9606922ba421077ee11cc0388daef90e302cb552d5b6514de647b2bd2e0ce6e1/68747470733a2f2f706f7365722e707567782e6f72672f62616c6c656e2f657865637574696f6e65722f6c6963656e7365)](https://packagist.org/packages/ballen/executioner)

Executioner is a PHP library for executing system processes and applications with the ability to pass extra arguments and read CLI output results.

Requirements
------------

[](#requirements)

This library is unit tested against PHP 7.3, 7.4, 8.0, 8.1 and 8.2!

If you need to use an older version of PHP, you should instead install the 3.x version of this library (see below for details).

License
-------

[](#license)

This client library is released under the MIT license, a [copy of the license](https://github.com/allebb/executioner/blob/master/LICENSE) is provided in this package.

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

[](#installation)

To install the package into your project (assuming you are using the Composer package manager) you can simply execute the following command from your terminal in the root of your project folder:

`composer require ballen/executioner`

**If you need to use an older version of PHP, version 3.x.x supports PHP 5.3, 5.4, 5.5, 5.6, 7.0, 7.1 and 7.2, you can install this version using Composer with this command instead:**

```
composer require ballen/executioner ^3.0
```

Usage example
-------------

[](#usage-example)

Example of retrieving IP address information for the server.

```
use Ballen\Executioner\Executioner;

$run = new Executioner();

if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
    $run->setApplication('ipconfig'); // Server is Microsoft Windows!
} else {
    $run->sudo() // Lets assume we must run 'sudo' to get the output...
        ->setApplication('ifconfig');
}
$run->execute();

// We'll simply just display the results as a plain text string...
echo $run->resultAsText();
```

An example of getting the PHP version number using `php -v` terminal command.

```
use Ballen\Executioner\Executioner;

/**
 * A shorthand version of using the factory method to create a new instance
 * and then chaining the other methods and getting the response.
 */
$php_version = Executioner::make('php')
    ->addArgument('-v')
    ->execute()
    ->resultAsArray();
$words = explode(' ', $php_version[0]); // Split the words from the first line of the output!
$extracted_version_number = $words[1]; // The second word in the raw outputted line should be the version number :)
echo 'The extacted version number is: ' . $extracted_version_number . '';

// The extacted version number is: 7.0.0
```

These examples can also be found in the [examples](examples) directory.

Tests and coverage
------------------

[](#tests-and-coverage)

This library is fully unit tested using [PHPUnit](https://phpunit.de/).

I use [GitHub Actions](https://github.com/) for continuous integration, which triggers tests for PHP 7.3, 7.4, 8.0, 8.1 and 8.2 each time a commit is pushed.

If you wish to run the tests yourself you should run the following:

```
# Install the Cartographer Library (which will include PHPUnit as part of the require-dev dependencies)
composer install

# Now we run the unit tests (from the root of the project) like so:
./vendor/bin/phpunit
```

Code coverage can also be run, and a report generated (this does require XDebug to be installed)...

```
./vendor/bin/phpunit --coverage-html ./report
```

Support
-------

[](#support)

I am happy to provide support via. my personal email address, so if you need a hand drop me an email at: ballen@bobbyallen.me.

###  Health Score

43

—

FairBetter than 90% of packages

Maintenance57

Moderate activity, may be stable

Popularity25

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity64

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

Recently: every ~434 days

Total

9

Last Release

1231d ago

Major Versions

v1.0.x-dev → v2.0.x-dev2015-12-24

2.0.0 → 3.0.02015-12-25

3.0.2 → 4.0.02020-12-23

PHP version history (3 changes)v1.0.x-devPHP &gt;=5.3.0

3.0.0PHP &gt;=5.4.0

4.0.0PHP &gt;=7.3.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/4729a376aa8281d9456a90c000e991aa605c96f15251469acd5a7a5c6cdde2e6?d=identicon)[allebb](/maintainers/allebb)

---

Top Contributors

[![allebb](https://avatars.githubusercontent.com/u/767628?v=4)](https://github.com/allebb "allebb (34 commits)")

---

Tags

execexecutableexecuteexecutorphptaskcliprocessrunexecuteexecexecutionpassthru

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ballen-executioner/health.svg)

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

###  Alternatives

[symfony/console

Eases the creation of beautiful and testable command line interfaces

9.8k1.1B11.2k](/packages/symfony-console)[nunomaduro/collision

Cli error handling for console/command-line PHP applications.

4.6k331.8M8.4k](/packages/nunomaduro-collision)[nunomaduro/termwind

It's like Tailwind CSS, but for the console.

2.5k239.8M280](/packages/nunomaduro-termwind)[wp-cli/wp-cli

WP-CLI framework

5.0k17.2M318](/packages/wp-cli-wp-cli)[wp-cli/php-cli-tools

Console utilities for PHP

68325.0M364](/packages/wp-cli-php-cli-tools)[titasgailius/terminal

Terminal is an Elegent wrapper around Symfony's Process component.

512340.9k11](/packages/titasgailius-terminal)

PHPackages © 2026

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