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 is successfuly installed in xampp as well as in laragon. But in horizon, it throws below error when running php artisan horizon:
Symfony\Component\Debug\Exception\FatalThrowableError : Call to undefined function Laravel\Horizon\Console\pcntlasyncsignals()
If you know the solution on this, please let me know. I tried everything I read on the internet but none of it works for me. Until I read some blogs, it says it is 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.
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.
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.
6. Execute horizon in the terminal.
7. Make sure when you check horizon dashboard the status is active.