Laravel Executor
Laravel Executor turns the steps you run after a deploy into versioned PHP files called executors. Each executor has an up() method that does the work and a down() method that reverses it. php artisan execute runs every executor the server still needs and records the run in a database table, in batches you can roll back, filter by tag, and limit to specific servers.
Run Once or Always
An executor runs a single time per database, or again on every deploy.
Commands and Jobs
Call Artisan commands and dispatch queued jobs from inside an executor.
Batches and Rollback
Every run is recorded in a batch, and the latest batches can be rolled back.
Tags
Group executors with tags and run only the groups you need.
Server Targeting
List the server IP addresses an executor belongs to: other servers skip it, and each listed server keeps its own record.
Status
See every executor with its type, tags, servers, batch and whether it ran.
Add php artisan execute to your deploy script right after php artisan migrate, and run it on every server.
#Installation
Install the package with Composer and create its table.
#Requirements
- PHP 8.2, 8.3, 8.4 or 8.5
- Laravel 12
#Composer Installation
composer require pharaonic/laravel-executorThe service provider is registered automatically.
#Run Migrations
The package loads its migration automatically, so the executors table is created with your other migrations:
php artisan migrateTo change the migration before it runs, publish it into database/migrations:
php artisan vendor:publish --tag=executor-migrations#Publish Configuration
Publish the configuration only when you need another connection or table name:
php artisan vendor:publish --tag=executor-configThe file is published to config/pharaonic/executor.php.
You're all set! Create your first executor with php artisan make:executor.
#Upgrading
Pick the part for the release you're on: 12.0.x needs a few renames, while 1.x needs a new table and changes to every executor file.
#From 12.0.x
This line keeps the table and the executor classes of 12.0.x. Run php artisan migrate after updating, which adds the server column, then update the case names and check the behavior changes below.
#Executor Types Are Upper Case
The ExecutorType cases are renamed, and the old names are removed. Executors that still use them stop with an Undefined constant error, so update every executor file:
| 12.0.x | 12.1.0 |
|---|---|
ExecutorType::Always | ExecutorType::ALWAYS |
ExecutorType::Once | ExecutorType::ONCE |
ExecutorType::ALWAYS->name returns ALWAYS. Compare the case itself ($type === ExecutorType::ONCE), call isOnce(), or use label(), which returns Always or Once.
#Behavior Changes
- An executor with
$serversruns only on those servers, including on its first run. In 12.0.x, the first run happened on every server. php artisan execute,execute:rollbackandexecute:freshtake a lock in the executors table, so servers that deploy at the same time run them one after another, as described in Running Executors.- Invalid executor declarations throw
InvalidArgumentException, and duplicate executor names throwLogicException, instead ofException.
#Deprecated Names
| Deprecated | Use |
|---|---|
php artisan execute:make, php artisan make:execute | php artisan make:executor |
--tag=config | --tag=executor-config |
--tag=migrations | --tag=executor-migrations |
The deprecated names still work.
#From 1.x
On Laravel 12, this line replaces 1.x. Executors become classes with up() and down(), and the executors table has a new shape. Plan the upgrade as a deploy of its own: update the package, recreate the table, then update every executor file.
#1. Update the Package
Composer doesn't move from 1.x to this line on its own, so require it explicitly:
composer require pharaonic/laravel-executor:^12.1#2. Recreate the Table
The executors table has a new shape, and the package doesn't convert the 1.x table:
| 1.x column | Now |
|---|---|
executor | name |
tag (text) | tags (JSON array: cache becomes ["cache"]) |
servers (new, empty) | |
batch (1 by default) | batch (required, no default) |
1.x created the table with the same migration file name, 2024_07_07_000001_create_executors_table, so php artisan migrate treats it as already run and keeps the 1.x table. Recreate the table yourself and copy the records into it, so executors that already ran don't run again. In php artisan tinker:
1$rows = DB::table('executors')->orderBy('id')->get(); 2 3Schema::drop('executors'); 4DB::table('migrations')->where('migration', '2024_07_07_000001_create_executors_table')->delete(); 5Artisan::call('migrate', ['--path' => 'vendor/pharaonic/laravel-executor/database/migrations', '--force' => true]); 6 7$rows->each(fn ($row) => DB::table('executors')->insert([ 8 'type' => $row->type, 9 'name' => $row->executor,10 'tags' => $row->tag === null ? null : json_encode([$row->tag]),11 'batch' => $row->batch,12 'executed' => $row->executed,13 'last_executed_at' => $row->last_executed_at,14]));The records live only in the tinker session between dropping the table and inserting them again. Back up the executors table before you start. If you skip the copy, every ONCE executor runs again on the next php artisan execute.
#3. Update Every Executor File
| 1.x | Now |
|---|---|
use Pharaonic\Laravel\Executor\Executor; | use Pharaonic\Laravel\Executor\Classes\Executor; |
public function handle(): void | public function up(): void, plus a down() method |
public $tag = 'cache'; | public $tags = ['cache']; |
ExecutorType::Always / ExecutorType::Once | ExecutorType::ALWAYS / ExecutorType::ONCE |
1use Pharaonic\Laravel\Executor\Enums\ExecutorType; 2use Pharaonic\Laravel\Executor\Executor; 3 4return new class extends Executor 5{ 6 public $type = ExecutorType::Once; 7 8 public $tag = 'cache'; 9 10 public function handle(): void11 {12 $this->command('cache:clear');13 }14}; 1use Pharaonic\Laravel\Executor\Classes\Executor; 2use Pharaonic\Laravel\Executor\Enums\ExecutorType; 3 4return new class () extends Executor { 5 public $type = ExecutorType::ONCE; 6 7 public $tags = ['cache']; 8 9 public function up(): void10 {11 $this->command('cache:clear');12 }13 14 public function down(): void15 {16 //17 }18};Keep each file name: it is the executor's name, and the migrated records point at it.
php artisan execute reads every executor file. A file that still extends the 1.x class, uses handle(), or uses ExecutorType::Once stops the whole command with an error, so update all of them before you deploy.
#4. Update Code That Uses the Package
| 1.x | Now |
|---|---|
Pharaonic\Laravel\Executor\Facades\ExecutorPool::addPath($path) | Pharaonic\Laravel\Executor\Facades\Executor::getPool()->addPath($path) |
ExecutorPool::getPaths() | Executor::getPool()->getPaths() |
php artisan execute:make | php artisan make:executor (the old name still works and prints a deprecation notice) |
--tag=migrations | --tag=executor-migrations |
ExecutorType::ALWAYS->name returns ALWAYS. Compare the case itself ($type === ExecutorType::ONCE), call isOnce(), or use label(), which returns Always or Once.
#What's New
- Rolling back batches with
down(). - Server targeting with
$servers, and several tags per executor. - A lock so servers deploying at the same time don't run a
ONCEexecutor twice. - A configuration file for the connection, table and lock.
#Configuration
The package works without any configuration. Publish the file when you need another connection or table:
php artisan vendor:publish --tag=executor-config 1return [ 2 /** 3 * The database connection that should be used by the executor. 4 */ 5 'connection' => env('EXECUTOR_CONNECTION', config('database.default')), 6 7 /** 8 * The table that should be used to store the executors. 9 */10 'table' => env('EXECUTOR_TABLE', 'executors'),11 12 /**13 * The name of this server, matched against the executors' `$servers`14 * next to the server's IP addresses. Give each server a fixed name when15 * its addresses change, such as in containers.16 */17 'server' => env('EXECUTOR_SERVER'),18 19 /**20 * The lock that makes servers deploying at the same time run the21 * executors one after another. It is a row of the executors table, so22 * every server that shares the table shares the lock. `seconds` is how23 * long a run may hold the lock and how long the next server waits for it.24 */25 'lock' => [26 'seconds' => env('EXECUTOR_LOCK_SECONDS', 600),27 ],28];| Key | Environment variable | Default | Description |
|---|---|---|---|
pharaonic.executor.connection | EXECUTOR_CONNECTION | your default connection | Database connection of the executors table |
pharaonic.executor.table | EXECUTOR_TABLE | executors | Name of the executors table |
pharaonic.executor.server | EXECUTOR_SERVER | none | Name of this server for $servers |
pharaonic.executor.lock.seconds | EXECUTOR_LOCK_SECONDS | 600 | How long a run may hold the lock, and how long another server waits for it |
All your servers should share the same executors table. The table is how a ONCE executor knows it already ran, and it holds the lock. When each server has its own application database, point EXECUTOR_CONNECTION at a connection every server shares.
#Basic Usage
Create an executor, describe the work in up(), and run it.
#1. Create an Executor
php artisan make:executor WarmCachesThe command creates a timestamped file in the executors folder of your project, such as executors/2026_01_15_120000_warm_caches.php. The file name without .php is the executor's name.
#2. Write the Task
1use Pharaonic\Laravel\Executor\Classes\Executor; 2use Pharaonic\Laravel\Executor\Enums\ExecutorType; 3 4return new class () extends Executor { 5 public $type = ExecutorType::ONCE; 6 7 public $tags = []; 8 9 public $servers = [];10 11 public function up(): void12 {13 $this->command('optimize');14 }15 16 public function down(): void17 {18 $this->command('optimize:clear');19 }20};#3. Run It
php artisan executeExecuting 2026_01_15_120000_warm_caches...Running the command again does nothing, because a ONCE executor has already run:
There are no executors need to be executed.#4. Check the Status
php artisan execute:status+-----------------------------------+------+------+---------+-------+----------+| Name | Type | Tags | Servers | Batch | Executed |+-----------------------------------+------+------+---------+-------+----------+| 2026_01_15_120000_warm_caches | Once | None | All | 1 | Yes |+-----------------------------------+------+------+---------+-------+----------+#Writing Executors
An executor is a PHP file that returns an instance of an anonymous class extending Pharaonic\Laravel\Executor\Classes\Executor. Files that don't return an executor are skipped.
#Type
$type decides how often the executor runs. It defaults to ExecutorType::ALWAYS.
| Type | Runs |
|---|---|
ExecutorType::ONCE | The first time php artisan execute sees it, then never again |
ExecutorType::ALWAYS | Every time php artisan execute runs |
1public $type = ExecutorType::ONCE;#Tags
$tags groups executors, so you can run only some of them with --tags.
1public $tags = ['cache', 'search'];#Servers
$servers lists the servers the executor belongs to, by name or by IP address. Leave it empty to run on every server.
1public $servers = ['web-1', 'web-2'];#Naming Servers
Give each server a fixed name with EXECUTOR_SERVER, and list those names in $servers. Names are the recommended way: they stay the same when a server's address changes, and they read better than addresses.
EXECUTOR_SERVER=web-1A server matches an entry of $servers when the entry is its EXECUTOR_SERVER name or one of the addresses of its network interfaces, ignoring 127.0.0.1 and ::1. A list can mix both, such as ['web-1', '10.0.0.12']. On the other servers, the executor is skipped and doesn't appear as run.
Inside a container, the package sees the container's own address, such as 172.17.0.5, not the address of the host, and the address changes when the container is recreated. Host addresses in $servers then never match, and container addresses match only until the next recreate, after which ONCE executors run again. Set EXECUTOR_SERVER in each container's environment and list the names instead.
#Records per Server
An executor with servers keeps one record per server, stored under the first entry of the list that matches the server:
| Type | Without $servers | With $servers |
|---|---|---|
ONCE | Runs once, on the first server that deploys | Runs once on each listed server |
ALWAYS | Runs on every server, every deploy | Runs on each listed server, every deploy |
Use $servers with ONCE for setup each server needs once, such as linking local storage, and leave $servers empty for work one server does for all of them, such as dispatching a job.
#Changing the List
- Removing a server: it stops running the executor, and
execute:rollbackon it leaves the executor alone. Its record stays, so aONCEexecutor doesn't run again if you add the server back. - Adding a server: it runs the executor on its next deploy.
- Emptying the list: the servers that already ran a
ONCEexecutor skip it, and the first other server that deploys runs it once for all of them. - A server's address changes: a server listed by address counts as a new server and runs its
ONCEexecutors again. A server listed by itsEXECUTOR_SERVERname keeps its record. - Switching a server from its address to a name: set
EXECUTOR_SERVERwhile the old address is still in the list, deploy once, then replace the address with the name. The record stays under the old address and the server still finds it by that address; it keeps finding it as long as the address doesn't change.
A record written before per-server records has no server, so it counts as run on every server and its ONCE executor doesn't run again.
#Running Artisan Commands
$this->command() calls an Artisan command, prints its output, and returns its exit code.
1public function up(): void2{3 $this->command('cache:clear');4 $this->command('queue:restart');5}#Dispatching Jobs
$this->job() dispatches a job. Pass the class name and its constructor arguments, or a job instance. It returns Laravel's pending dispatch, so you can chain onQueue(), delay() and the other dispatch options.
1use App\Jobs\RecalculateRatings;2 3public function up(): void4{5 $this->job(RecalculateRatings::class, 'electronics')->onQueue('ratings');6 $this->job(new RecalculateRatings('books'))->delay(now()->addMinutes(5));7}job() doesn't accept closures or other callables and throws InvalidArgumentException. Use a job class.
#Writing Output
Executors use Laravel's console output helpers, such as info(), line(), warn(), error() and table().
1public function up(): void2{3 $count = Product::query()->whereNull('slug')->count();4 5 $this->info("Generating {$count} slugs...");6}#Reversing an Executor
down() runs when the executor's batch is rolled back. Leave it empty when there's nothing to undo.
#Validation
The executor checks its properties when it is created and throws InvalidArgumentException when:
$typeisn't anExecutorTypecase;$tagsisn't an array;$serversisn't an array.
#Running Executors
php artisan execute reads every executor file, picks the ones that should run, and runs them in file-name order.
php artisan executeAn executor runs when it has never run before, or when its type is ALWAYS. Executors limited to other servers are skipped.
#Batches
Every executor that runs for the first time in the same php artisan execute call gets the same batch number, one higher than the highest batch in the table. An ALWAYS executor keeps the batch of its first run; the package counts its runs and stores the time of the last one.
#Several Servers at Once
When servers deploy at the same time, php artisan execute takes a lock, so they run the executors one after another. The next server reads the executors table only after the lock is free, so a ONCE executor that another server just ran is skipped. execute:rollback and execute:fresh take the same lock.
The lock is a reserved row of the executors table, so every server that shares the table shares the lock, without any cache setup. A server that stops while holding it frees it after pharaonic.executor.lock.seconds. The records are read from the write connection, so a read replica that lags behind can't hide a run.
If the lock isn't free within pharaonic.executor.lock.seconds (600 by default), the command fails with exit code 1:
Another server has been running the executors for more than 600 seconds.If the lock can't be written, for example before php artisan migrate has added the server column, the command stops with exit code 1 before running any executor, and prints the database error.
#Running One Executor
Pass the executor name, which is its file name without .php:
php artisan execute 2026_01_15_120000_warm_caches#Filtering by Tags
--tags takes a comma-separated list and runs the executors that have at least one of the tags:
php artisan execute --tags=cache,search#Starting Over
execute:fresh empties the executors table and runs php artisan execute, so every executor runs again:
php artisan execute:freshexecute:fresh runs every ONCE executor again. Use it in local and testing environments.
#Rolling Back
execute:rollback reverses the latest batch: it calls down() on each executor of the batch and deletes their records, so they run again on the next php artisan execute.
php artisan execute:rollbackRoll back several batches with --steps:
php artisan execute:rollback --steps=3A rollback only touches the records this server sees: the records of executors without $servers, and this server's own records of executors with $servers. It never runs down() for an executor limited to other servers, and it leaves their records for them. To roll back an executor on each of its servers, run execute:rollback on each of them. --steps counts the batches of this server.
The records of the rolled-back batches are deleted even when an executor file no longer exists; down() only runs for the files that do.
#Status
execute:status lists every executor file with its record:
php artisan execute:status+-----------------------------------+--------+---------------+-----------+-------+----------+| Name | Type | Tags | Servers | Batch | Executed |+-----------------------------------+--------+---------------+-----------+-------+----------+| 2026_01_15_120000_warm_caches | Once | cache, search | 10.0.0.11 | 1 | Yes || 2026_01_16_090000_sync_currencies | Always | None | All | N/A | No |+-----------------------------------+--------+---------------+-----------+-------+----------+| Column | Shows |
|---|---|
| Name | The file name without .php |
| Type | Once or Always |
| Tags | The executor's tags, or None |
| Servers | The server names or IP addresses, or All |
| Batch | The batch of the first run, or N/A when it never ran |
| Executed | Whether it has run at least once; for an executor with $servers, whether it has run on this server |
The same data is available in code through the facade:
1use Pharaonic\Laravel\Executor\Facades\Executor;2 3Executor::info();4// ['2026_01_15_120000_warm_caches' => ['name' => ..., 'path' => ..., 'type' => ExecutorType::ONCE, 'tags' => ['cache', 'search'], 'servers' => ['10.0.0.11'], 'batch' => 1, 'executed' => true], ...]#Executor Paths
Executors live in the executors folder of your project. Create one somewhere else with --path, relative to the project root:
php artisan make:executor ImportCountries --path=modules/geo/executorsThen register the folder in a service provider, so execute, execute:rollback and execute:status read it too:
1use Pharaonic\Laravel\Executor\Facades\Executor;2 3public function boot(): void4{5 Executor::getPool()->addPath(base_path('modules/geo/executors'));6}The package reads the .php files directly inside each folder, not in subfolders.
Executor names must be unique across all folders. Two files with the same name throw LogicException.
#API Reference
#Artisan Commands
| Command | Description |
|---|---|
make:executor {name} {--path=} | Create an executor in executors, or in --path relative to the project root |
execute {name?} {--tags=} | Run the executors that should run, optionally one by name or those with one of the tags |
execute:rollback {--steps=1} | Call down() on the executors of the latest batches and delete their records |
execute:fresh | Empty the executors table and run execute |
execute:status | List every executor with its type, tags, servers, batch and status |
#Executor
Pharaonic\Laravel\Executor\Classes\Executor, the class every executor extends.
| Member | Description |
|---|---|
public $type | ExecutorType::ONCE or ExecutorType::ALWAYS (default) |
public $tags | Array of tags, empty by default |
public $servers | Array of server names (EXECUTOR_SERVER) or IP addresses, empty for every server |
up(): void | Runs the task |
down(): void | Reverses the task on rollback |
command(string $command, array $parameters = []): int | Calls an Artisan command and returns its exit code |
job(string|object $job, mixed ...$arguments): PendingDispatch | Dispatches a job class with its constructor arguments, or a job instance |
#ExecutorType
Pharaonic\Laravel\Executor\Enums\ExecutorType, a backed enum that uses Pharaonic\SmartEnum\SmartEnum.
| Member | Description | Returns |
|---|---|---|
ExecutorType::ALWAYS | Runs on every execute, stored as 1 | ExecutorType |
ExecutorType::ONCE | Runs a single time, stored as 2 | ExecutorType |
isAlways() | Whether the type is ALWAYS | bool |
isOnce() | Whether the type is ONCE | bool |
label() | Always or Once | string |
options() | Labels keyed by value: [1 => 'Always', 2 => 'Once'] | array |
names() / values() / labels() | Every case name, value or label | array |
fromName() / tryFromName() / hasName() | Find a case by name ('ONCE') | ExecutorType / ?ExecutorType / bool |
hasValue() | Whether a case has the value | bool |
is() / isNot() / in() / notIn() / eq() | Compare with a case, name or value | bool |
from() / tryFrom() / cases() | PHP's native enum methods |
#Facade
Pharaonic\Laravel\Executor\Facades\Executor
| Method | Description | Returns |
|---|---|---|
getPool() | The pool of executor folders | ExecutorPool |
getRecords() | The executor records this server sees, keyed by name: its own record of an executor with $servers, or else the shared record | Collection |
getNextBatchNumber() | One higher than the highest batch | int |
getIPs() | The server's IP addresses, without 127.0.0.1 and ::1 | array |
getServer() | The server's EXECUTOR_SERVER name | ?string |
isServer(string $server) | Whether a name or IP address is this server | bool |
info() | Every executor's name, path, type, tags, servers, batch and status, keyed by name | array |
#ExecutorPool
Pharaonic\Laravel\Executor\Classes\ExecutorPool, returned by Executor::getPool().
| Method | Description | Returns |
|---|---|---|
addPath(string $path) | Adds a folder of executors | static |
getPaths() | The executor folders | array |
#Model
Pharaonic\Laravel\Executor\Models\Executor, one record per executor that has run.
| Attribute | Type | Description |
|---|---|---|
id | int | Primary key |
type | ExecutorType | The executor's type |
name | string | The executor's file name without .php |
server | ?string | The server of the record for an executor with $servers, or null for a shared record; unique together with name |
tags | ?array | The executor's tags |
servers | ?array | The executor's server names or IP addresses |
batch | int | The batch of the first run |
executed | int | How many times it has run |
last_executed_at | ?CarbonInterface | When it last ran |
| Method | Description | Returns |
|---|---|---|
isNew() | Whether it has never run | bool |
isExecutable() | Whether its type is ALWAYS or it has never run | bool |
execute() | Counts a run and stores its time | void |
#Publish Tags
| Tag | Publishes |
|---|---|
executor-config, pharaonic-config | config/pharaonic/executor.php |
executor-migrations, pharaonic-migrations | The migration, into database/migrations |
laravel-executor, pharaonic | Both |
#Examples
#1. Deploy Script
Run the executors on every server after the migrations.
1php artisan down2git pull origin main3composer install --no-dev --optimize-autoloader4php artisan migrate --force5php artisan execute6php artisan up#2. One-Time Data Fix
Fill a new column once, in chunks, and clear it again on rollback.
1use App\Models\Product; 2use Illuminate\Support\Str; 3use Pharaonic\Laravel\Executor\Classes\Executor; 4use Pharaonic\Laravel\Executor\Enums\ExecutorType; 5 6return new class () extends Executor { 7 public $type = ExecutorType::ONCE; 8 9 public function up(): void10 {11 Product::query()->whereNull('slug')->chunkById(500, function ($products) {12 foreach ($products as $product) {13 $product->update(['slug' => Str::slug($product->name)]);14 }15 });16 }17 18 public function down(): void19 {20 Product::query()->update(['slug' => null]);21 }22};#3. Caches on Every Deploy
Rebuild the caches on every deploy, on every server.
1use Pharaonic\Laravel\Executor\Classes\Executor; 2use Pharaonic\Laravel\Executor\Enums\ExecutorType; 3 4return new class () extends Executor { 5 public $type = ExecutorType::ALWAYS; 6 7 public $tags = ['cache']; 8 9 public function up(): void10 {11 $this->command('optimize');12 $this->command('view:cache');13 }14 15 public function down(): void16 {17 $this->command('optimize:clear');18 }19};Rebuild only the caches, without the other executors:
php artisan execute --tags=cache#4. Queue a Job Once
Queue a recalculation once, from whichever server deploys first. The workers pick it up from the shared queue.
1use App\Jobs\RecalculateRatings; 2use Pharaonic\Laravel\Executor\Classes\Executor; 3use Pharaonic\Laravel\Executor\Enums\ExecutorType; 4 5return new class () extends Executor { 6 public $type = ExecutorType::ONCE; 7 8 public $tags = ['ratings']; 9 10 public function up(): void11 {12 $this->info('Queueing the rating recalculation...');13 14 $this->job(RecalculateRatings::class)->onQueue('ratings');15 }16 17 public function down(): void18 {19 //20 }21}; 1namespace App\Jobs; 2 3use App\Models\Product; 4use Illuminate\Bus\Queueable; 5use Illuminate\Contracts\Queue\ShouldQueue; 6use Illuminate\Foundation\Bus\Dispatchable; 7use Illuminate\Queue\InteractsWithQueue; 8 9class RecalculateRatings implements ShouldQueue10{11 use Dispatchable, InteractsWithQueue, Queueable;12 13 public function handle(): void14 {15 Product::query()->chunkById(500, function ($products) {16 foreach ($products as $product) {17 $product->update(['rating' => $product->reviews()->avg('stars') ?? 0]);18 }19 });20 }21}#5. A Task for Each Web Server
Link the public storage folder once on each web server, because every server has its own disk.
1use Pharaonic\Laravel\Executor\Classes\Executor; 2use Pharaonic\Laravel\Executor\Enums\ExecutorType; 3 4return new class () extends Executor { 5 public $type = ExecutorType::ONCE; 6 7 public $servers = ['web-1', 'web-2']; 8 9 public function up(): void10 {11 $this->command('storage:link');12 }13 14 public function down(): void15 {16 //17 }18};Each web server sets its name with EXECUTOR_SERVER=web-1 or EXECUTOR_SERVER=web-2. Each listed server runs the executor on its first deploy and skips it after that. A server added to the list later runs it on its next deploy.
#Troubleshooting
#"There are no executors need to be executed."
Every ONCE executor has already run and there's no ALWAYS executor. Check the list with php artisan execute:status. If the executor lives outside the executors folder, register its folder with Executor::getPool()->addPath().
#"Undefined constant ExecutorType::Once"
The executor uses a case name from 1.x or 12.0.x. Rename ExecutorType::Always to ExecutorType::ALWAYS and ExecutorType::Once to ExecutorType::ONCE, as described in Upgrading.
#"Class Pharaonic\Laravel\Executor\Executor not found"
The executor still extends the 1.x class. Use Pharaonic\Laravel\Executor\Classes\Executor, rename handle() to up(), and add a down() method, as described in Upgrading.
#"Column not found: name" after upgrading from 1.x
The executors table still has the 1.x shape, and php artisan migrate doesn't change it. Recreate the table and copy its records, as described in Upgrading.
#"Another server has been running the executors for more than 600 seconds."
Another php artisan execute, execute:rollback or execute:fresh holds the lock: a deploy is still running, or a run stopped before releasing it and the lock hasn't expired yet. Wait for the other deploy, or raise EXECUTOR_LOCK_SECONDS when your executors take longer than 600 seconds.
#"Couldn't take the executor lock: …"
The command couldn't write the lock row to the executors table, so it stopped before running anything. The message ends with the database error. Run php artisan migrate, which adds the server column the lock needs, and check that EXECUTOR_CONNECTION reaches the database.
#A ONCE executor ran on two servers
When the executor has $servers, it runs once on each listed server; leave $servers empty to run it once for all of them. Otherwise the servers don't share the executors table: point EXECUTOR_CONNECTION at a connection every server uses.
#An executor doesn't appear in execute:status
The file must be directly inside an executor folder, end in .php, and return the executor instance (return new class () extends Executor { ... };). Files that return anything else are skipped.
#"Duplicate Executor name"
Two folders contain a file with the same name. Rename one of them, keeping its timestamp prefix.
#"The type of the executor must be an instance of ExecutorType."
$type holds something other than a case, such as 1 or 'once'. Use ExecutorType::ONCE or ExecutorType::ALWAYS.
#An executor runs on the wrong server
$servers is compared with the server's EXECUTOR_SERVER name and the addresses of its network interfaces. Behind NAT or a load balancer, use the server's private address; inside Docker or another container, the package sees the container's address, so set EXECUTOR_SERVER and list names instead. Check what the package sees with php artisan tinker, Executor::getServer() and Executor::getIPs().
#execute:make prints a deprecation notice
The command was renamed. Use php artisan make:executor.
Contributors
Amazing people who made this package possible
This package wouldn't exist without the contributions of our amazing community. A huge thank you to everyone who has helped improve Executor!
Want to Contribute?
We welcome contributions from everyone! Whether it's bug fixes, new features, or documentation improvements - every contribution counts.