Description
Schedule artisan commands to run at a sub-minute frequency.
As the Laravel Scheduler now supports sub-minute scheduled tasks, this package is no longer needed.
Laravel's native scheduler allows you to schedule Artisan commands to run every minute.
If you need to execute something with a higher frequency, for example every second, than you've come to the right package. With laravel-short-schedule installed, you can do this:
// in your routes/console.php file use Spatie\ShortSchedule\Facades\ShortSchedule; // this command will run every secondShortSchedule::command('artisan-command')->everySecond(); // this command will run every 30 secondsShortSchedule::command('another-artisan-command')->everySeconds(30); // this command will run every half a secondShortSchedule::command('another-artisan-command')->everySeconds(0.5);
Alternatively, you could add this to the shortSchedule method in your console kernel:
// in app\Console\Kernel.php protected function shortSchedule(\Spatie\ShortSchedule\ShortSchedule $shortSchedule){ // this command will run every second $shortSchedule->command('artisan-command')->everySecond(); // this command will run every 30 seconds $shortSchedule->command('another-artisan-command')->everySeconds(30); // this command will run every half a second $shortSchedule->command('another-artisan-command')->everySeconds(0.5); // this command will run every second and its signature will be retrieved from command automatically $shortSchedule->command(\Spatie\ShortSchedule\Tests\Unit\TestCommand::class)->everySecond();}
Recent Courses on Laravel Daily
Laravel 13 Starter Kit Teams and Customizations
10 lessons
33 min
Roles and Permissions in Laravel 13
14 lessons
57 min
Laravel 13 Eloquent: Expert Level
41 lessons
1 h 34 min