https://github.com/edofre/yii2-command-caller
Run console commands async
https://github.com/edofre/yii2-command-caller
async command console yii2
Last synced: 9 months ago
JSON representation
Run console commands async
- Host: GitHub
- URL: https://github.com/edofre/yii2-command-caller
- Owner: Edofre
- License: mit
- Created: 2017-10-26T11:53:28.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-10-26T13:08:23.000Z (over 8 years ago)
- Last Synced: 2025-07-16T00:52:07.260Z (about 1 year ago)
- Topics: async, command, console, yii2
- Language: PHP
- Size: 8.79 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGE.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Yii2 Command Caller component
[](https://packagist.org/packages/edofre/yii2-command-caller)
[](https://packagist.org/packages/edofre/yii2-command-caller)
[](https://packagist.org/packages/edofre/yii2-command-caller)
[](https://packagist.org/packages/edofre/yii2-command-caller)
[](https://packagist.org/packages/edofre/yii2-command-caller)
## Installation
The preferred way to install this extension is through [composer](http://getcomposer.org/download/).
To install, either run
```
$ php composer.phar require edofre/yii2-command-caller "V1.0.1"
```
or add
```
"edofre/yii2-command-caller": "V1.0.1"
```
to the ```require``` section of your `composer.json` file.
## Usage
### As application component
Add the component to your configuration file
```php
'components' => [
'consoleRunner' => [
'class' => 'edofre\commandcaller\CommandCaller',
// Default values, not required
'script' => '@app/yii',
'executable' => '/usr/bin/php',
]
]
```
```php
// We will change the $result variable in the CommandCaller class
Yii::$app->consoleRunner->run('command parameter1 parameter2');
```
### As single class
```php
$commandCaller = new \edofre\commandcaller\CommandCaller();
$commandCaller->run('command parameter1 parameter2');
```