PHP code example of rubenvanerk / laravel-parallel-console-tasks

1. Go to this page and download the library: Download rubenvanerk/laravel-parallel-console-tasks library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

rubenvanerk / laravel-parallel-console-tasks example snippets




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;
            },
        ]);
        
    }
}