spatie/laravel-signal-aware-command
Add signal awareness to Laravel Artisan commands. Gracefully handle SIGINT/SIGTERM (Ctrl+C, container stop, deploy) to stop work cleanly, run shutdown logic, and avoid half-finished jobs—ideal for long-running CLI tasks and workers.
Architecture fit: Seamlessly integrates with Laravel's Artisan command architecture by extending the base Command class, leveraging Symfony's console component. No architectural conflicts; designed specifically for Laravel's ecosystem.
Integration feasibility: High for Unix-based environments (Linux/macOS) with pcntl extension enabled. Windows support is impossible due to pcntl limitations. Requires verification of PHP environment compatibility.
Technical risk: Dependency on pcntl (not available on Windows or some shared hosting), potential Laravel version incompatibility, and undefined behavior if signals are overridden by other handlers. Risk of silent failures if pcntl is missing.
Key questions: What is the minimum Laravel version supported? Are there known issues with specific PHP versions? How does the package handle pcntl unavailability (e.g., graceful fallback or error)? Does it support custom signal handlers alongside other packages?
Stack fit: Ideal for Laravel projects using Artisan commands. No additional stack components required; works natively within Laravel's CLI framework.
Migration path: Replace Illuminate\Console\Command with Spatie\SignalAwareCommand\SignalAwareCommand in existing commands. Implement handleSignal() method for shutdown logic. Minimal code changes required for each command.
Compatibility: Requires PHP with pcntl enabled (Linux/macOS only). Compatible with Laravel 8+ (verify via package composer.json). Not compatible with Windows or environments without pcntl.
Sequencing: 1) Confirm pcntl is installed and enabled in target environments. 2)
How can I help you explore Laravel packages today?