PHPackages                             johnitvn/cli-runtime - 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. johnitvn/cli-runtime

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

johnitvn/cli-runtime
====================

PHP runtime execute command library

1.0.2(10y ago)23231Apache-2.0PHPPHP &gt;=5.3.2

Since Jul 22Pushed 10y ago1 watchersCompare

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

READMEChangelog (3)DependenciesVersions (4)Used By (1)

PHP Cli Runtime
===============

[](#php-cli-runtime)

[![Latest Stable Version](https://camo.githubusercontent.com/65ffa08f41ce28196dc3911de9df1eb4fac9573c192504eac36a18dcb44a25f5/68747470733a2f2f706f7365722e707567782e6f72672f6a6f686e6974766e2f636c692d72756e74696d652f762f737461626c65)](https://packagist.org/packages/johnitvn/cli-runtime)[![License](https://camo.githubusercontent.com/c65df4b03c39c6ea5e7add65d2b8a14f5c55427413a8542de43e05f2e812299f/68747470733a2f2f706f7365722e707567782e6f72672f6a6f686e6974766e2f636c692d72756e74696d652f6c6963656e7365)](https://packagist.org/packages/johnitvn/cli-runtime)[![Total Downloads](https://camo.githubusercontent.com/c1bff2ad4745bc1187eeefd6cb9d37ec7af5a11c107f649db9f7a005b3d98987/68747470733a2f2f706f7365722e707567782e6f72672f6a6f686e6974766e2f636c692d72756e74696d652f646f776e6c6f616473)](https://packagist.org/packages/johnitvn/cli-runtime)[![Monthly Downloads](https://camo.githubusercontent.com/0b191a905425bf64ff48d7b7323739c72cb9321c233ea768b86d53f6a8946b93/68747470733a2f2f706f7365722e707567782e6f72672f6a6f686e6974766e2f636c692d72756e74696d652f642f6d6f6e74686c79)](https://packagist.org/packages/johnitvn/cli-runtime)[![Daily Downloads](https://camo.githubusercontent.com/4425f78d558e1dba5dded59af66fa79b4c84ebffcd7ab42e3584aaa491e0c13f/68747470733a2f2f706f7365722e707567782e6f72672f6a6f686e6974766e2f636c692d72756e74696d652f642f6461696c79)](https://packagist.org/packages/johnitvn/cli-runtime)

PHP runtime execute command library

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

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
php composer.phar require --prefer-dist johnitvn/cli-runtime "*"

```

or add

```
"johnitvn/cli-runtime": "*"

```

to the require section of your `composer.json` file.

Usage
-----

[](#usage)

1. Create processor

```
$workingdir = 'path/to/working_dir';
$process = new johnitvn\cliruntime\CliRuntimeProcess($workingdir);
```

If you set working dir is null in CliRuntimeProcess constructor current working dir will be path of file call CliRuntimeProcess

2. Run command without return and display ouput

```
$process->run('echo Hello');
```

3. Run command with capture output

```
$output = array();
$process->runCapture('echo Hello',$output);
var_dump($output);
```

As example reference variable $ouput will get command output lines as array

4. Run command with display out put

```
$process->runDisplayOutput('echo Hello');
```

`runDisplayout()` will be run command and display out

5. Command Builder You can use `johnitvn\cliruntime\CommandBuidler` as utility for create command

Below is simple example with CommandBuilder:

```
$command = new johnitvn\cliruntime\CommandBuidler('echo');
$command->addParam('Hello world');
echo $command->getCommand();
```

and the result is:

```
echo Hello world

```

You can see below code snippet for understand how to use CommandBuilder class

```
$builder = new CommandBuidler('phpunit');
$builder->addFlag('v')
    ->addArgument('stop-on-failure')
    ->addArgument('configuration', 'phpunit.xml')
    ->addParam('TestCase.php');
echo $builder->getCommand();
```

And the result is:

```
phpunit TestCase.php -v --stop-on-failure --configuration=phpunit.xml
```

6. CommandFinder (since version 1.0.2) You can use `johnitvn\cliruntime\CommandFinder` as utility for finder real path of command under system environment variable

```
use johnitvn\cliruntime\CommandFinder;
$realCommand = CommandFinder::findCommand('composer');
echo $realCommand;

```

And result look like: `C:\\xampp\php\composer`

You can see the class comment for more detail about usage

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity60

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

Total

3

Last Release

3953d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/eb877e0e33a4c6d8bccbffefa8c1648b61f4b74d3a98917a3b4d342823466ca8?d=identicon)[johnitvn](/maintainers/johnitvn)

---

Top Contributors

[![johnitvn](https://avatars.githubusercontent.com/u/8359652?v=4)](https://github.com/johnitvn "johnitvn (8 commits)")

---

Tags

cliruntimeexecute

### Embed Badge

![Health badge](/badges/johnitvn-cli-runtime/health.svg)

```
[![Health](https://phpackages.com/badges/johnitvn-cli-runtime/health.svg)](https://phpackages.com/packages/johnitvn-cli-runtime)
```

###  Alternatives

[symfony/console

Eases the creation of beautiful and testable command line interfaces

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

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

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

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

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

WP-CLI framework

5.1k17.2M320](/packages/wp-cli-wp-cli)[wp-cli/php-cli-tools

Console utilities for PHP

68325.0M367](/packages/wp-cli-php-cli-tools)[socialengine/sniffer-rules

A Lumen 5 and Laravel 5 SquizLabs Code Sniffer 2.0 artisan command. Detect violations of a defined coding standard. It helps your code remains clean and consistent.

1248.2k1](/packages/socialengine-sniffer-rules)

PHPackages © 2026

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