Skip to content

Installation ​

Requirements ​

  • PHP 8.3 or higher
  • Laravel 12 or higher

Install via Composer ​

bash
composer require havn/laravel-executable

The 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:

bash
php artisan vendor:publish --tag=laravel-executable-config

This creates config/executable.php with the following option:

php
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:

yaml
includes:
    - vendor/havn/laravel-executable/extension.neon

See the Static Analysis reference for details on what the rules catch.