Posts Learn Components Snippets Categories Tags About

Setting up Laravel Queue worker on Heroku

Learn how to set up a Laravel queue worker on Heroku to allow your long process task to run in the background.

3 months ago

4 mins read


Setting up Laravel Queue worker on Heroku is quite straightforward. All you have to do is define the queue configuration on the Procfile that’s located in the root level of the project directory as well as spin up a new Heroku dyno instance.

To define the queue, you have to name the queue first (which can be anything that you want, for this example "sqs") `sqs: php artisan queue:work --timeout=1800` and then continue to chain it with the `php artisan queue:work` command to ensure it's running.

You can also pass any of the flags that are provided by the `queue:work` command depending on your needs. The next step that you have to do is to deploy the Laravel application to Heroku so that your online application gets updated.

Next, you have to run `heroku ps:scale web=1 sqs=1 --app your-heroku-app` from your command line, and this will ensure that your Laravel application has another dyno called `sqs`. Once you have done that, Heroku will be able to process your Laravel queues.

Final Code

# procfile
sqs: php artisan queue:work --timeout=1800

# terminal
heroku ps:scale web=1 sqs=1 --app your-heroku-app

Load comments for Setting up Laravel Queue worker on Heroku


PostSrc Code Snippets

Learn new snippets today, level up your Laravel, Alpine JS, Vue JS, Tailwind CSS skills and more.

Learn New Snippets

Authored by

PostSrc poster


Full stack developer mainly focusing on the front end side of the web. The main author of PostSrc and loves writing tutorial and guides online.


PostSrc Code Components

Collection of Tailwind CSS components for everyone to use. Browse all of the components that's right for your project.

View Components