Running scheduled Laravel jobs on a VM is a simple matter of adding a single crontab job to call the Laravel scheduler every minute, and that’s basically it. However, if you would like to run a scalable Laravel Laravel app on Heroku, the notion of servers and cron is essentially nonexistent, so it’s not as easy.

So how can you still schedule your background tasks to run on Heroku? In the following guide, we will walk you through all of the necessary steps to make this possible.

If you do not have an active Laravel app on Heroku already, please follow the instructions here.

First: Setting up Cron To Go

Cron To Go is a reliable cloud scheduler that is available for use with your Heroku app. It allows you to utilize Cron expressions on one-off dynos when running any command or background task, all in a friendly GUI or with APIs if you’re into automating automation. Additionally, you have the advantage of receiving email or webhook notifications regarding your job statuses.

To install Cron To Go, you can either:

1. Use the following Heroku command line:

heroku addons:create crontogo:bronze


2. Proceed through your Heroku app dashboard:

Which one do you prefer? CLI or GUI?

Then : Adding the Cron To Go job

After installation, open Cron To Go’s dashboard via your Heroku app dashboard or by using the following command line:

Heroku addons:open crontogo

Next, add a job using the cron expression that stands for “every minute”:

* * * * *

and enter the following command:

php artisan schedule:run

Add a job in Cron To Go
Setting up Cloud Cron jobs has never been easier!

If you haven’t changed the Laravel log destination, as described here, you should use another command that makes sure that your background tasks’ logs make it to Heroku’s logplex:

touch ./storage/logs/laravel.log; tail -f ./storage/logs/laravel.log & php artisan schedule:run

You can read more about this solution here but for now, that’s it! You now have your Laravel scheduled jobs running on Heroku.