Executor: Ship the code, then run the tasks
Laravel Executor turns the steps you run after every deploy into versioned files. Write an executor once, run php artisan execute in your deploy script, and every server runs exactly the tasks it still needs, recorded in batches you can roll back.
Everything a deploy step needs
One file per task and one command in your deploy script.
Run Once or Always
Mark an executor ExecutorType::ONCE to run it a single time, or ALWAYS to run it on every deploy.
Commands and Jobs
Call Artisan with $this->command() and dispatch queued jobs with $this->job() from up().
Batches and Rollback
Every run is recorded in a batch, and execute:rollback calls down() on the latest batches.
Tags
Tag executors and run a subset with php artisan execute --tags=cache,search.
Server Targeting
List server IPs in $servers to keep an executor to the machines it belongs on.
Status at a Glance
execute:status shows every executor with its type, tags, servers, batch and whether it ran.
A quick look
An executor that rebuilds the caches on every deploy, on the web servers only.
1use Pharaonic\Laravel\Executor\Classes\Executor; 2use Pharaonic\Laravel\Executor\Enums\ExecutorType; 3 4return new class () extends Executor { 5 public $type = ExecutorType::ALWAYS; 6 public $tags = ['cache']; 7 public $servers = ['10.0.0.11', '10.0.0.12']; 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};Executor Questions
Quick answers about installing and using Executor.
What is Executor?
Run deployment tasks in Laravel once or on every deploy: Artisan commands, queued jobs and data fixes, tracked in batches with rollback, tags, server targeting and a cross-server lock. It's a free, open-source Laravel package by Pharaonic.
How do I install Executor?
Run composer require pharaonic/laravel-executor in your project's root directory, then php artisan migrate.
What does Executor require?
The latest release requires PHP 8.3+ and Laravel 13.
How is an executor different from a migration?
Migrations change the database schema. Executors run anything else a deploy needs, such as Artisan commands, queued jobs or data fixes, and can run once or on every deploy.
When should I run `php artisan execute`?
Run it in your deploy script after php artisan migrate, on every server. Each server runs only the executors it still needs.
What happens when several servers deploy at the same time?
php artisan execute takes a cache lock, so the servers run the executors one after another and a ONCE executor runs only once. Use a cache store every server shares, such as Redis or the database.
Can I keep executors outside the `executors` folder?
Yes. Create them with php artisan make:executor Name --path=other/folder, and register the folder with Executor::getPool()->addPath(base_path('other/folder')) in a service provider.
Is Executor free to use?
Yes. Executor is open source under the MIT license, so you can use it in personal and commercial projects.
Where can I find the Executor documentation?
Read the Executor documentation for setup, configuration, and usage examples.
How do I report a bug or contribute to Executor?
Open an issue or a pull request on GitHub, or ask in the Pharaonic Discord.
Ready to dig in?
Read the full documentation for installation, configuration, writing executors, running, rolling back and inspecting them, tags and server targeting, the API reference, and the upgrade guide.