- Is spatie/laravel-short-schedule still needed for Laravel 11+ projects?
- No, Laravel 11+ natively supports sub-minute scheduling, making this package obsolete for new projects. However, it may still be useful for legacy Laravel 10 or older systems requiring sub-second precision.
- How do I install and configure ShortSchedule in Laravel?
- Run `composer require spatie/laravel-short-schedule`, then add commands to `routes/console.php` or the `shortSchedule` method in `app/Console/Kernel.php` using methods like `everySecond()` or `everySeconds(30)`. Ensure Supervisor is configured to run the scheduler.
- What Laravel versions does this package officially support?
- The package is officially supported for Laravel 13 (PHP 8.3+). Laravel 10/11 are unsupported, though minor tweaks might make it work. For Laravel 11+, use the native scheduler instead.
- Can I schedule commands with sub-second precision (e.g., every 0.5 seconds)?
- Yes, the package supports fractional seconds (e.g., `everySeconds(0.5)`). However, ReactPHP’s event loop may introduce slight latency, so test thoroughly for time-sensitive applications.
- How does ShortSchedule handle overlapping or concurrent executions?
- Use the `withoutOverlapping()` method to prevent overlapping executions of the same command. This is useful for idempotent operations like rate-limited API calls or real-time data processing.
- Will this package work with Lumen or non-Laravel PHP applications?
- Lumen support is limited—you’ll need to manually copy the command logic. For non-Laravel PHP apps, the package isn’t designed for direct use, as it relies on Laravel’s Artisan and service container.
- How do I monitor or debug tasks scheduled with ShortSchedule?
- Debugging is more complex than traditional cron jobs due to ReactPHP’s non-blocking nature. Use Laravel’s logging, Supervisor logs, and the `ShortScheduledTaskStarting` event to track executions. Avoid long-running event listeners to prevent task delays.
- Are there performance or resource concerns with high-frequency tasks?
- Yes, spawning processes for sub-second tasks can increase CPU/memory usage. ReactPHP’s event loop may struggle with >100 tasks/sec without optimization. Monitor process counts and consider batching tasks if possible.
- Can I run ShortSchedule tasks in maintenance mode?
- By default, tasks skip maintenance mode. To override this, use `whenNotInMaintenance()` or explicitly allow them in your configuration. This is useful for critical background tasks during deployments.
- What are the alternatives to ShortSchedule for sub-minute scheduling?
- For Laravel 11+, use the native scheduler’s sub-minute support. For older versions, consider custom cron entries with `*` syntax (e.g., `* * * * * *`) or third-party tools like `cron-plus` or `systemd timers`. Each has trade-offs in precision and complexity.