Installation
Requirements
- PHP 8.3 or higher
- Laravel 12 or higher
Install via Composer
composer require havn/laravel-executableThe package uses Laravel's auto-discovery, so the service provider is registered automatically. No manual setup needed.
Configuration
The package works out of the box with sensible defaults. If you need to customize behavior, publish the config file:
php artisan vendor:publish --tag=laravel-executable-configThis creates config/executable.php with the following option:
return [
"serialize_models_with_relations" => true,
];When a queued job runs, Laravel re-fetches any Eloquent models, including their previously loaded relations. That's often more than the job actually needs.
You can use Laravel's #[WithoutRelations] attribute on individual executable classes, or set serialize_models_with_relations to false here to disable it globally for all executables.
Static Analysis
The package ships with PHPStan rules that catch common mistakes. If you use phpstan/extension-installer, the rules are registered automatically. Otherwise, add the extension manually in your phpstan.neon:
includes:
- vendor/havn/laravel-executable/extension.neonSee the Static Analysis reference for details on what the rules catch.
