PHP code example of tohidplus / paravel

1. Go to this page and download the library: Download tohidplus/paravel 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/ */

    

tohidplus / paravel example snippets


return [
    'artisan_path' => env('PARAVEL_ARTISAN_PATH', base_path('artisan')),
];


use Tohidplus\Paravel\Facades\Paravel;

$time = microtime(true);        

$results = Paravel::add('label_1',function (){
    sleep(5);
    return 'Hello there';
})->add('label_2',function (){
     sleep(5);
     return 'Hello again';
})->wait();

//Check the total execution time
dump(microtime(true)-$time); // 5.* Secs



use Tohidplus\Paravel\Facades\Paravel;
   
Paravel::add('label_1',function (){
    return 'Hello there';
})->add('label_2',function (){
     return 'Hello again';
})->run();



use Tohidplus\Paravel\Facades\Paravel;

$results = Paravel::add('label_1',function (){
    return 'Hello there';
})->add('label_2',function (){
     return 'Hello again';
})->wait();

// Get the item by label
$results->get('label_1');
// Get result of item
$results->resultOf('label_1');
// Get error of item
$results->errorOf('label_1');
// Get status of item
$results->statusOf('label_1');

// Check if all processes were succeeded.
$results->succeeded();
// Check if any of the processes was failed.
$results->failed();
bash
php artisan vendor:publish --provider="Tohidplus\Paravel\ParavelServiceProvider"