filsh / yii2-runner
Component for run different objects or functions
Installs: 186
Dependents: 2
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Type:yii2-extension
Requires
- yiisoft/yii2: *
This package is auto-updated.
Last update: 2024-10-29 04:19:25 UTC
README
Installation
It is recommended that you install the Gearman library through composer. To do so, add the following lines to your composer.json
file.
{ "require": { "filsh/yii2-runner": "dev-master" } }
Examples
// example runner class Example extends \filsh\yii2\runner\BaseRunner { public $fooValue; public $barValue; public function run() { echo 'example runner with param: ' . json_encode([$this->fooValue, $this->barValue]); } } // configure component 'components' => [ 'runner' => [ 'class' => 'filsh\yii2\runner\RunnerComponent', 'runners' => [ 'example' => [ 'class' => Example::className(), 'fooValue' => 'foo' ] ] ] ], // run examples $this->runner->run('example', ['barValue' => 'bar']); // example runner with param: ["foo","bar"] $this->runner->run(function(array $params) { echo 'inline runner with params: ' . json_encode($params); }, ['fooValue' => 'foo']); // inline runner with params: {"fooValue":"foo"}