Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

kmnurunnabi's avatar

Laravel Scheduler Commands Definition

Here has some scheduler commands below of laravel.

php artisan schedule:run
php artisan schedule:test
php artisan  schedule:work 

Can anybody say some scenarios or use-cases when to use one over another?

0 likes
5 replies
tisuchi's avatar

@kmnurunnabi This is my understanding:

  • Use php artisan schedule:run for the standard execution of scheduled tasks in a production environment, typically via a Cron job.
  • Use php artisan schedule:test to manually test and debug individual scheduled tasks.
  • Use php artisan schedule:work in environments where setting up a Cron job is not feasible, or for local development.
1 like
kmnurunnabi's avatar

@tisuchi Can you clearify me how to run indivisual? Do I need to pass any options after php artisan schedule:test???

tisuchi's avatar

@kmnurunnabi Well, here is my illustration:

This is how you can call the command:

php artisan schedule:test [command name]

Now, let’s say you have a scheduled command defined in your Kernel.php like this:

protected function schedule(Schedule $schedule)
{
    $schedule->command('inspire')
             ->hourly()
             ->description('Send an inspiring quote');
}

To test this command, you would run:

php artisan schedule:test inspire

The [command name] should match the name of the command or the description provided in the ->description() method.

martinbean's avatar

@kmnurunnabi The Laravel task scheduling docs describes these commands:

From https://laravel.com/docs/10.x/scheduling#running-the-scheduler:

Now that we have learned how to define scheduled tasks, let's discuss how to actually run them on our server. The schedule:run Artisan command will evaluate all of your scheduled tasks and determine if they need to run based on the server's current time.

And from https://laravel.com/docs/10.x/scheduling#running-the-scheduler-locally:

Typically, you would not add a scheduler cron entry to your local development machine. Instead, you may use the schedule:work Artisan command. This command will run in the foreground and invoke the scheduler every minute until you terminate the command:

Please or to participate in this conversation.