You can find the repo here: https://github.com/jsafe00/laravel-queues-redis-horizon

I tried to run using xampp and laragon but unfortunately it was not successful. Redis was successfuly installed in xampp as well as in laragon. But in  horizon, it gave below error when running php artisan horizon:   

Symfony\Component\Debug\Exception\FatalThrowableError : Call to undefined function Laravel\Horizon\Console\pcntlasyncsignals()

It said on the blogs that I'd read that this is due to "not compatible with windows". So, I decided to use docker.

I’m using the docker-template from https://github.com/ahmedash95/laravel-docker-template  with a few changes since I’m using php 8 on my laravel app example.

I will not go through how to implement laravel-export and how to set up mailtrap since I will just focus on how to setup laravel queues using redis and horizon.

If you want to know more about redis and horizon, you can check the laravel documentation.

https://laravel.com/docs/8.x/redis

https://laravel.com/docs/8.x/horizon 

Procedure:

1.  Lets install first redis by executing composer require predis/predis.

2.  Open .env file and change queue_driver from database to redis.

3.  In this line, we are using Redis::throttle command and passing in the ‘key’. You can change that anything you want. The Redis::throttle using the ‘key’ will be limited to running 10 times and 60 seconds in our example.

App\Jobs\SendUserEmail.php

Alt Text

4. Next we’ll install horizon by executing:

**composer require laravel/horizon **

Then publish the configuration: php artisan vendor:publish --provider="Laravel\Horizon\HorizonServiceProvider"

5. Then, in config/horizon.php add the following in Queue Worker Configuration part.

Alt Text

6. Execute horizon in the terminal.

7. Make sure when you check horizon dashboard the status is active.