yii2-console-runner Runs console command in yii web application

  1. Requirements
  2. Installation
  3. Usage
  4. Resources

This is component for running console command in yii2 web applications

This extension is inspired by the project https://github.com/vova07/yii2-console-runner-extension

Requirements

Yii 2.0+

Installation

The preferred way to install this extension is through composer.

To install, either run

$ composer require toriphes/yii2-console-runner "*"

or add

"toriphes/yii2-console-runner": "*"

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

Usage

You can user yii2-console-runner importing the class file

use toriphes\console\Runner;
$output = '';
$runner = new Runner();
$runner->run('controller/action param1 param2 ...', $output);
echo $output; //prints the command output

or using it like an application component:

//your config file
'components' => [
    'consoleRunner' => [
        'class' => 'toriphes\console\Runner'
    ]
]
//some application file
$output = '';
Yii::$app->consoleRunner->run('controller/action param1 param2 ...', $output);
echo $output; //prints the command output

Resources

0 0
4 followers
0 downloads
Yii Version: 2.0
License: BSD-2-Clause
Category: Console
Developed by: toriphes
Created on: Jun 13, 2015
Last updated: 8 years ago

Related Extensions