Setting Up Lumen + Redis

This is more of an extension of my previous post "Setting Up Lumen + Mail". I wanted to take it a step furthur and show the basic setup for getting Redis to work, so you can queue not only mail, but jobs.

First, run composer require illuminate/redis:5.5 to grab the Redis components.

Next, open app/Providers/AppServiceProvider.php and add the following to the register method:

// ...

// Configs

// Enable queues

Next, create config/database.php and add the following:


return [
  'redis' => [
    'client' => 'predis',
    'default' => [
      'host' => env('REDIS_HOST', ''),
      'password' => env('REDIS_PASSWORD', null),
      'port' => env('REDIS_PORT', 6379),
      'database' => 0

Don't forget to setup all your environment variables for Redis, as well, to enable Redis for job processing and cache, set the following environment variables:


That's it! You can now queue mail or process jobs.

Cover image credit: Jingyi Wang

Show Comments