digitalnoise/command-launcher
Laravel package for launching and managing console commands programmatically. Provides a simple API to trigger Artisan commands, pass arguments/options, and handle execution flow for scheduled tasks, integrations, and background processes.
ffmpeg, composer) are embedded in PHP workflows.| Risk | Impact | Mitigation |
|---|---|---|
| Shell Injection | Unsanitized commands risk code execution. | Use whitelisted commands or Laravel’s Process facade with input validation. |
| Resource Leaks | Long-running commands block workers. | Set strict timeouts and use queue workers for CPU-heavy tasks. |
| Observability Gaps | Minimal native logging for debugging. | Extend with Laravel’s logging channels or custom event listeners. |
| Environment Portability | CLI tools may not be available everywhere. | Containerize workers (e.g., Docker) or use feature flags for CLI-heavy features. |
| Package Maturity | 0 stars/dependents signals unproven stability. | Start with a proof-of-concept (e.g., replace 1 manual CLI task). |
ShouldQueue.Process Facade: Simpler but synchronous-only.exec() calls in controllers with async dispatch:
// Before
exec('php artisan optimize');
// After
CommandLauncher::dispatch('php artisan optimize')->run();
ShouldQueue job for background processing:
class OptimizeJob implements ShouldQueue {
public function handle() {
CommandLauncher::dispatch('php artisan optimize')->run();
}
}
CommandLauncher::dispatch('composer dump-autoload')
->then('php artisan migrate')
->onFailure(fn ($exitCode) => Log::error("Migration failed: $exitCode"));
ffmpeg) installed in the runtime.| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Queue Worker Crashes | Jobs pile up or time out. | Use Supervisor/Kubernetes for process resilience; implement retries. |
| Command Fails (Exit Code ≠ 0) | Job marked as failed. | Configure retries with exponential backoff; route failures to a dead-letter queue. |
| CLI Tool Unavailable | Commands hang or fail. | Health checks for required tools; alert on missing dependencies. |
| Timeout Exceeded | Job killed; partial work done. | Increase timeout or optimize command performance. |
| Disk/Resource Exhaustion | Workers OOM or disk full. | Set resource limits (e.g., Docker mem_limit); monitor usage. |
| Network Issues (Redis/DB) | Queue stalls or jobs lost. | Use persistent queue drivers; implement circuit breakers. |
How can I help you explore Laravel packages today?