Configure Redis with Laravel/Lumen 5.8

What is Redis

Redis is a storage server that stores data in memory for very fast Read/Write transactions.

It supports data structures such as strings, hashes, lists, sets, sorted sets with range queries, bitmaps, hyperloglogs, geospatial indexes with radius queries and streams.

Read more about Redis.

Laravel/Lumen supports Redis integration by default, before you start using Redis you need to install the predis/predis package via Composer:

composer require predis/predis

In order to configure Redis in Laravel, you can change these settings in config/database.php.

'redis' => [

    'cluster' => false,

    'default' => [
        'host'     => '',
        'port'     => 6379,
        'database' => 0,


If you want to manage these settings by .env file do the following.

'redis' => [

    'cluster' => false,

    'default' => [
        'host'     => env('REDIS_HOST', ''),
        'port'     => env('REDIS_PORT', 6379),
        'database' => env('REDIS_DATABASE', 0),


And your .env file add:


If you are using Laravel remember to run:

php artisan config:clear

And if you are using Lumen remember to add:

in bootstrap/app.php

That’s it for configurations, enjoy!

Author: Danyal
I'm working as programmer since 2002. Born, grew up, studied and worked in Pakistan now Im located in Denmark since 2006.