Skip to main content
Tutorial Free

Laravel: Class "Redis" Not Found Error - What To Do?

August 08, 2023
1 min read

When you set up a new Laravel application to use Redis as a cache driver or broadcast driver, you may encounter the following error:


Why Does This Error Occur?

The reason for this error is usually either a missing Composer package or a missing Redis installation. In both cases, it appears once you try to use Redis in your system for the following:

  • Cache driver by setting CACHE_DRIVER=redis
  • Broadcast driver by setting BROADCAST_DRIVER=redis

Before going into the solutions, make sure you need Redis in your system. If you don't use it, you should change your drivers to something else.


Missing Composer Package

This is the most common reason to have this error. To fix it, run the following command:

composer require predis/predis

And once the package is installed, you should be able to use Redis as a cache or broadcast driver.


Missing Redis Installation

If you have installed the package, but the error is still there, you may need the Redis installation. To install Redis, follow the instructions on the official Redis website.

Enjoyed This Tutorial?

Get access to all premium tutorials, video and text courses, and exclusive Laravel resources. Join our community of 10,000+ developers.

Comments & Discussion

P
porrapat ✓ Link copied!

Just noted, if you do all of that above and still see the error.

Maybe, you have to add this too your Laravel .env configuration.

REDIS_CLIENT=predis

After that it will work.

I
IRESIS ✓ Link copied!

Thanks!

S
Sjoerd24 ✓ Link copied!

Thanks! This also fixed my problem!

D
duaneandrea ✓ Link copied!

sudo apt-get install php8.x-redis sudo service apache2 restart

and you are done N.B: - 8.x for your version

We'd Love Your Feedback

Tell us what you like or what we can improve

Feel free to share anything you like or dislike about this page or the platform in general.