spatie/laravel-dynamic-servers
Dynamically spin up and destroy servers from Laravel to handle variable queue workloads. Uses provider snapshots as templates and lets you determine server count (e.g., based on Horizon wait times) so extra workers are created automatically and removed when no longer needed.
ServerCreated events can trigger downstream jobs).scheduler to auto-terminate idle servers.env or Vault integration to avoid hardcoding.ServerCreated events to trigger Laravel jobs (e.g., dispatch(new ProcessDataJob($server->ip))).ServerTerminated to clean up resources (e.g., database connections).php artisan server:create --queue=high).ServerProvider interface.DigitalOceanServerProvider with DO API calls.laravel/framework:^9.0).strict_types=1 usage in your codebase.servers table) is required. Use Laravel migrations:
Schema::create('servers', function (Blueprint $table) {
$table->id();
$table->string('provider');
$table->string('identifier'); // e.g., EC2 instance ID
$table->json('config');
$table->timestamps();
});
app-{job-id}-{timestamp}).composer require spatie/laravel-dynamic-servers
php artisan vendor:publish --provider="Spatie\DynamicServers\DynamicServersServiceProvider"
.env with provider credentials (e.g., AWS_ACCESS_KEY_ID).ServerCreated/ServerTerminated to sync with other systems.public function handle(ServerCreated $event) {
// Update DNS, notify Slack, etc.
}
ServerProvider interface.php artisan server:create --env=staging).DYNAMIC_SERVERS.md with provider configs and runbooks.failed_jobs table for provisioning timeouts.DynamicServersServiceProvider::enableDebugMode() for verbose logs.php artisan server:list toHow can I help you explore Laravel packages today?