Questions? We're happy to help

How do I use Redis with Laravel?

Laravel supports Redis caching out-of-the-box. In this article, we explain how you make Laravel use Redis.


The PHP module redis must be activated before using Redis Caching with PHP. Read how to activate this module. Also, a Redis database must be created through 'My Account' on our website. The databases are identified by the port number. Therefore, database '0' must always be used.

Add Predis to Laravel

Before you can use Redis with Laravel, add 'predis' to Laravel via Composer. Log in via SSH, navigate to the folder where your Laravel installation is located and run the following command:

composer require predis/predis

Adjust Laravel configuration

To tell Laravel that you want to use Redis, adjust the configuration in the config/database.php file. Scroll down until you see 'redis' => [.

There you enter the following information:

  • host. Enter here
  • password. Enter the password here that was created while creating the Redis database.
  • port. Enter the port number here that was created while creating the Redis database.

Save the file. The Laravelfunction cache() now uses default redis.


This knowledgebase article was last updated on: 20 November 2017

Did this article help you?


Ga naar onze statuspagina voor een overzicht van recente storingen en onderhoud.

Opening hours

Maandag — vrijdag 9:00 — 17:00