Looking to hire Laravel developers? Try LaraJobs

laravel-parallel-console-tasks maintained by rubenvanerk

Description
Run tasks in parallel in console commands
Author
Last update
2023/07/03 10:17 (dev-main)
License
Downloads
39

Comments
comments powered by Disqus

Run tasks in parallel in console commands

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

A simple trait to run Laravel Zero-like tasks in parallel.

Installation

You can install the package via composer:

composer require rubenvanerk/laravel-parallel-console-tasks

Usage

<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;
use RubenVanErk\LaravelParallelConsoleTasks\RunsParallelTasks;

class Tasks extends Command
{
    use RunsParallelTasks;
    
    // ...
    
    public function handle() {
    
        $this->tasks([
            'Task 1' => function () {
                // Do a thing
                return true;
            },
            'Task 2' => function () {
                // Do another thing in parallel
                return true;
            },
        ]);
        
    }
}

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Credits

License

The MIT License (MIT). Please see License File for more information.