PHPackages                             pastuhov/php-exec-command - 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. pastuhov/php-exec-command

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

pastuhov/php-exec-command
=========================

Simple php command executor with param binding.

1.1.0(9y ago)25205.4k↓23.3%22GPL-2.0PHPPHP &gt;=5.3.0

Since Jun 20Pushed 8y ago1 watchersCompare

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

READMEChangelog (4)Dependencies (2)Versions (8)Used By (2)

php-exec-command
================

[](#php-exec-command)

[![Build Status](https://camo.githubusercontent.com/dedf8078d5807ba918c63491a76fe957e69d995ba3f22cee6f963e86d5dde0cb/68747470733a2f2f7472617669732d63692e6f72672f7061737475686f762f7068702d657865632d636f6d6d616e642e737667)](https://travis-ci.org/pastuhov/php-exec-command)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/7c1a517658fa0cbda97db4f72864315f0dc90e5ea3329ddfcc4572dbc00935e4/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7061737475686f762f7068702d657865632d636f6d6d616e642f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/pastuhov/php-exec-command/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/12253512f76287fe3cb3f6bc21f50e4246a6c3bf6a53e549a0d5e10060d48e67/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7061737475686f762f7068702d657865632d636f6d6d616e642f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/pastuhov/php-exec-command/?branch=master)[![Total Downloads](https://camo.githubusercontent.com/7231b4b353ab11199a4a9649a450a67cadc2ce9e9173ef6ef2bb97080c8060ab/68747470733a2f2f706f7365722e707567782e6f72672f7061737475686f762f7068702d657865632d636f6d6d616e642f646f776e6c6f616473)](https://packagist.org/packages/pastuhov/php-exec-command)[![StyleCI](https://camo.githubusercontent.com/9fb811e536c159a348fb9dcf693a3543d42c78697c690cc00228bc62a119a523/68747470733a2f2f7374796c6563692e696f2f7265706f732f33373732343138342f736869656c64)](https://styleci.io/repos/37724184)

Simple php command executor with param binding.

Install
-------

[](#install)

Via Composer

```
$ composer require pastuhov/php-exec-command
```

Features
--------

[](#features)

- light weight
- param binding
- throws an exception if return status &gt;0
- redirect stderr to stdout if needed

Usage
-----

[](#usage)

```
    $output = Command::exec(
        'echo {phrase}',
        [
            'phrase' => 'hello'
        ]
    );
    // $output = 'hello'
```

or

```
    $output = Command::exec(
        'echo {phrase}',
        [
            'phrase' => [
                'hello',
                'world'
            ]
        ]
    );
    // $output = 'hello world'
```

or

```
    try {
        Command::exec('locate {parody}',
            [
                'parody' => [
                    'pink_unicorn'
                ]
            ]
        );

        echo "unicorn was found!";
    } catch (\pastuhov\Command\CommandException $e) {
        echo "can't find unicorn :(";
    }
```

By default, all arguments are escaped using [escapeshellarg](https://secure.php.net/manual/en/function.escapeshellarg.php). If you need to pass unescaped arguments, use `{!name!}`, like so:

```
Command::exec('echo {!path!}', ['path' => '$PATH']);
```

Testing
-------

[](#testing)

```
$ composer test
```

or

```
$ phpunit
```

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Kirill Pastukhov](https://github.com/pastuhov)
- [All Contributors](../../contributors)

License
-------

[](#license)

GNU General Public License, version 2. Please see [License File](LICENSE) for more information.

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity40

Moderate usage in the ecosystem

Community17

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 89.4% 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 ~217 days

Total

3

Last Release

3552d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/7937221?v=4)[Pastuhov Kirill](/maintainers/pastuhov)[@pastuhov](https://github.com/pastuhov)

---

Top Contributors

[![pastuhov](https://avatars.githubusercontent.com/u/7937221?v=4)](https://github.com/pastuhov "pastuhov (42 commits)")[![danmichaelo](https://avatars.githubusercontent.com/u/434495?v=4)](https://github.com/danmichaelo "danmichaelo (3 commits)")[![artezh](https://avatars.githubusercontent.com/u/8474078?v=4)](https://github.com/artezh "artezh (1 commits)")[![samwilson](https://avatars.githubusercontent.com/u/213655?v=4)](https://github.com/samwilson "samwilson (1 commits)")

---

Tags

commandexecutephpcommandsystemexec

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/pastuhov-php-exec-command/health.svg)

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

###  Alternatives

[cpx/cpx

Run any command from any composer package, even if it's not installed in your project.

40410.9k1](/packages/cpx-cpx)[arara/process

Provides a better API to work with processes on Unix-like systems

16861.7k2](/packages/arara-process)[skywarth/chaotic-schedule

Randomize scheduled command execution time and date intervals

12142.3k](/packages/skywarth-chaotic-schedule)[synolia/sylius-scheduler-command-plugin

Scheduler Command Plugin.

34361.5k](/packages/synolia-sylius-scheduler-command-plugin)[scrumble-nl/laravel-model-ts-type

This package makes it possible to generate TypeScript types based on your models

6984.5k](/packages/scrumble-nl-laravel-model-ts-type)[msztorc/laravel-env

Laravel env helper commands

7855.4k](/packages/msztorc-laravel-env)

PHPackages © 2026

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