hdgarau / runners
Control process runned for Laravel like migrations
Installs: 2 580
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: ^8.1
This package is auto-updated.
Last update: 2025-05-29 01:48:28 UTC
README
DESCRIPTION
Package from laravel to store the processes runned. You can run N times a procces (once by default)
INSTALATION
composer require hdgarau/runners
# if you use DB Model (eloquent by default)
php artisan runner:tables
php artisan migrate
HANDLER CLASS
CONFIG FILE
You can define your own model to store data runner. Package provides two models. "eloquent" (by default) and "file" You can define the model on enviroment variable RUNNER_MODEL. That one must implements iRunnerModel.
<?php
return [
'default' => env('RUNNER_MODEL','eloquent'),
'path' => database_path ('runners/'),
'table' => 'runners',
'models' => [
'eloquent' => [
'class' => \Hdgarau\Runners\RunnerModel::class,
'params' => []
],
'file' => [
'class' => \Hdgarau\Runners\RunnerFileModel::class,
'params' => [ storage_path('runner-data.json') ]
],
]
];
RUNNERS METHODS
\Hdgarau\Runners\RunnerHandler
# Execute without check. if $store is false, Runner will not registred
static public function run( string $className, array $params = [],bool $store = true ) : bool
# Execute if it never was executed
static public function once( string $className, array $params = [] ) : bool
# Execute if it was count times executed lower than $times
static public function times( string $className, int $times, array $params = [] ) : bool
CONSOLE
CREATE A NEW PROCESS
Make a new runner
php artisan make:runner [NAME]
Make a new runner (that one will run every times)
php artisan make:runner --always [NAME]
RUN
Run once all runners made
php artisan runner
RESET STATUS
Delete all store
php artisan runner:clear