Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Laravel Short Schedule

Laravel Short Schedule Laravel Package

spatie/laravel-short-schedule

Schedule Artisan commands at sub-minute frequencies—every second or half-second—using a long-running ReactPHP event loop kept separate from Laravel's native scheduler, so short tasks never delay your regular schedule.

View on GitHub
Deep Wiki
Context7

spatie/laravel-short-schedule lets you run Artisan commands at sub-minute frequencies, something Laravel's native scheduler can't do since it only ticks once per minute. Define schedules with the ShortSchedule facade in routes/console.php or via the shortSchedule method in your console kernel, then run the long-running short-schedule:run process.

It uses a ReactPHP event loop to give each command its own periodic timer and launch it as an independent background process, so your short-scheduled tasks stay fully separate from—and never delay—your regular schedule:run schedule.

  • Run commands every second, or every 0.5/30 seconds
  • Fluent, expressive scheduling API
  • Accepts command signatures or command classes
  • Isolated ReactPHP process, independent of the native scheduler
Frequently asked questions about Laravel Short Schedule
What is spatie/laravel-short-schedule used for?
It schedules Laravel Artisan commands at sub-minute frequencies such as every second, every 30 seconds, or every half second. It runs a separate long-running process powered by ReactPHP so short tasks do not delay Laravel's native scheduler. Use it for short operational commands like polling, cache warming, heartbeat checks, or lightweight queue helpers, not as a replacement for queues or event-driven jobs.
How do I install and configure spatie/laravel-short-schedule in Laravel?
Install it with Composer, then define schedules using the ShortSchedule facade in routes/console.php or the shortSchedule method in your console kernel. Run php artisan short-schedule:run under Supervisor or systemd. The worker must be restarted after schedule changes or deployments. Check version compatibility carefully because the latest 1.7.0 release requires PHP 8.3 or newer and supports Laravel 13 while dropping Laravel 10 and 11.
Does laravel-short-schedule support Laravel 10 or 11?
The latest 1.7.0 release drops Laravel 10 and 11 and adds Laravel 13 support, requiring PHP 8.3 or newer. If you need Laravel 10 or 11, pin an earlier compatible package release. Check the release notes and your PHP version before upgrading. This matters if your application is still on an older Laravel version.
How is spatie/laravel-short-schedule different from Laravel's native scheduler?
Laravel's native scheduler runs commands at most once per minute through schedule:run. Short schedule uses a separate ReactPHP event loop and one periodic timer per command to launch commands more often, including sub-second intervals. That separation means short tasks never delay or get delayed by your regular schedule. It also adds a second scheduling runtime that must be supervised and restarted when schedules change.
Can short-scheduled commands overlap or run more than once?
Commands overlap by default unless you use withoutOverlapping, so a long-running command can be launched again before its previous run finishes. Across multiple app instances, duplicate execution can occur unless you use onOneServer with a shared cache and lock backend. Use both options for commands that must not run concurrently or on more than one node. Plan for lock or cache outages that could affect duplicate prevention.
How do I run short-schedule in production with Supervisor?
Run php artisan short-schedule:run as a long-lived process supervised by Supervisor, systemd, or an equivalent process monitor. Configure the supervisor to restart the worker, especially if you use --lifetime to mitigate memory leaks. Restart the worker on deployment or whenever schedule definitions change. Monitor process health and command failures externally because the package provides no built-in alerting or execution dashboard.
What are the risks of high-frequency short-scheduled commands?
High frequency can create process fan-out and host resource pressure if commands are slow or overlap. Constraints and event listeners run inside the ReactPHP loop, so slow when callbacks or event handlers can delay every short-scheduled task. Keep command runtime short, move heavy work to queues, and set a clear concurrency budget. Use withoutOverlapping and onOneServer where appropriate.
How do I test short-scheduled commands in Laravel?
Keep the scheduled Artisan command logic testable independently with Laravel's usual command and feature tests. Test schedule definitions separately if your application exposes them, and verify constraints and event listeners behave as expected. The long-running ReactPHP worker is operational infrastructure, so integration tests should focus on command idempotency and overlap behavior. Avoid relying on real sub-second timing in unit tests.
Does spatie/laravel-short-schedule work with multiple servers?
It can run on multiple app instances, but each worker will launch its own timers and commands unless onOneServer is enabled. onOneServer depends on a shared cache or lock backend so only one node executes a given task. Even then, plan for duplicate execution risks during cache outages or lock failures. Use a single worker where possible or coordinate through shared locks.
What alternatives should I consider before using laravel-short-schedule?
First check whether native Laravel scheduling, cron, queues, or event-driven jobs can meet the actual requirement. If the need is truly sub-minute and command-based, this package is a focused option. Alternatives include custom supervised workers, system cron with sleep loops, or queue-based recurring jobs depending on your architecture. Choose based on operational ownership, observability, and whether commands are short and idempotent.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
cgv/localized-resource