PHP code example of pharaonic / laravel-executor

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

    

pharaonic / laravel-executor example snippets


use App\Jobs\RecalculateRatings;
use Pharaonic\Laravel\Executor\Classes\Executor;
use Pharaonic\Laravel\Executor\Enums\ExecutorType;

return new class () extends Executor {
    public $type = ExecutorType::ONCE;

    public $tags = ['cache'];

    public $servers = [];

    public function up(): void
    {
        $this->command('optimize');
        $this->job(RecalculateRatings::class, 'electronics')->onQueue('ratings');
    }

    public function down(): void
    {
        $this->command('optimize:clear');
    }
};

public $servers = ['web-1', 'web-2'];
bash
php artisan make:executor WarmCaches
bash
php artisan execute
bash
php artisan execute 2026_01_15_120000_warm_caches
php artisan execute --tags=cache,search