PHPackages                             tebazil/yii2-console-runner - 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. tebazil/yii2-console-runner

ActiveYii2-extension[CLI &amp; Console](/categories/cli)

tebazil/yii2-console-runner
===========================

Yii2 console command runner that can run without shell\_exec() enabled

0.0.0(10y ago)85.0k2[2 issues](https://github.com/tebazil/yii2-console-runner/issues)PHP

Since Oct 16Pushed 10y ago4 watchersCompare

[ Source](https://github.com/tebazil/yii2-console-runner)[ Packagist](https://packagist.org/packages/tebazil/yii2-console-runner)[ RSS](/packages/tebazil-yii2-console-runner/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (2)Versions (2)Used By (0)

Yii2 console command runner
===========================

[](#yii2-console-command-runner)

Another implementation of Yii2 console command runner. At the time of writing this, it differs from [vova07/yii2-console-runner-extension](https://github.com/vova07/yii2-console-runner-extension) and \[toriphes/yii2-console-runner\] () in that it doesn't require shell\_exec to be enabled on the server.

Typical usage would be to run `migrate` or other of your console application's commands from web application's controller's action.

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

[](#installation)

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

Either run

```
$ composer require tebazil/yii2-console-runner
```

or add

```
"tebazil/yii2-console-runner": "*"

```

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

Basic usage
-----------

[](#basic-usage)

First you initialize the runner.

```
$runner = new \tebazil\runner\ConsoleCommandRunner();
```

Then you run as many commands as you need:

```
$runner->run('migrate');
$runner->run('migrate\create', ['insert_test_id','interactive'=>false]);
```

After running each command, you may collect get the exitCode and/or output for the last command.

```
$output = $runner->getOutput();
$exitCode = $runner->getExitCode();
```

\##How it works On initialization, the runner creates a new console application, then it returns `Yii::$app` to the application currently executed. When running the command, runner will first replace the `Yii::$app` with the "child" console application, run the command, and replace Yii::$app back with the parent application. The result is that in console commands you have console application's `Yii::$app`, and between the runs `Yii::$app` is your "parent" application, as it was intended.

\##Advanced usage You can optionally pass the `$config` (path or array) to the `ConsoleCommandRunner::__construct` method, so you can alter console application's configuration on the fly. You might also want to create several runners with different configured applications - each will stick to it's own application, and will respore original `Yii::$app` between runs.

\##Known issues Currently only `echo` output can be retrieved with `getOutput`, because standart `ob_start/ob_get_clean` combination is used to capture the output. If output is being written directly to `stdout` or `stderr`, it won't be captured.

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance15

Infrequent updates — may be unmaintained

Popularity28

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 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

Unknown

Total

1

Last Release

3913d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7c53a3bd47504ecf015853565657a1d1b129a392c88ed5d324f0544801baa2f3?d=identicon)[tebazil](/maintainers/tebazil)

---

Top Contributors

[![vambus](https://avatars.githubusercontent.com/u/2419721?v=4)](https://github.com/vambus "vambus (10 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/tebazil-yii2-console-runner/health.svg)

```
[![Health](https://phpackages.com/badges/tebazil-yii2-console-runner/health.svg)](https://phpackages.com/packages/tebazil-yii2-console-runner)
```

###  Alternatives

[craftcms/cms

Craft CMS

3.6k3.6M3.1k](/packages/craftcms-cms)[samdark/yii2-webshell

A web shell that allows to run yii console commands and create your own commands.

22886.7k2](/packages/samdark-yii2-webshell)[thelfensdrfer/yii2-ssh-console

SSH library for yii2 console commands

2465.4k](/packages/thelfensdrfer-yii2-ssh-console)[trntv/yii2-tactician

A simple, flexible command bus. This package provide it's integration with Yii2

1459.4k](/packages/trntv-yii2-tactician)

PHPackages © 2026

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