Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

t0berius's avatar

Class redis not found

Using a simple console command to update some values inside the cache:

    Cache::put('latestOrder', 'someData'
        , 600);

I receive the following output:

    Class "Redis" not found

at vendor/laravel/framework/src/Illuminate/Redis/Connectors/PhpRedisConnector.php:81
    77▕      * @throws \LogicException
    78▕      */
    79▕     protected function createClient(array $config)
    80▕     {
➜  81▕         return tap(new Redis, function ($client) use ($config) {
    82▕             if ($client instanceof RedisFacade) {
    83▕                 throw new LogicException(
    84▕                     extension_loaded('redis')
    85▕                         ? 'Please remove or rename the Redis facade alias in your "app" configuration file in order to avoid collision with the PHP Redis extension.'

I've checked the app.php but I'm only able to find redis under:

'providers' => [

    /*
     * Laravel Framework Service Providers...
     */
	....
    Illuminate\Redis\RedisServiceProvider::class,

phpredis extension is installed and enabled (verified by phpinfo()). Any idea how to solve this?

0 likes
6 replies
digitalbart's avatar

Is Redis running? Do you get a response from the command line?

What shows when you run: redis-server

sos99's avatar

please check your

$ redis-cli
127.0.0.1:6379: ping
Output:
PONG

if you do not get PONG something wrong with your local Redis.

if you getting PONG Please check your Redis settings on Laravel

REDIS_CLIENT=phpredis

and other Redis settings on the env file

https://laravel.com/docs/9.x/redis#configuration

and clear the cache if exists

t0berius's avatar

Redis is running (whole setup is running as docker container). The session driver is set to redis and is working fine too, updating

      - REDIS_CLIENT=phpredis

but no effect.

sos99's avatar

OK, and the port number is the same as default over Docker? Do you get PONG on the terminal ?

digitalbart's avatar

In your .env the Redis host should equal your name of the docker container. If you can match what it shows in your Docker desktop container name .

You may need to reload the config if it is cached also?

REDIS_HOST=docker_redis

1 like
GdS's avatar

I solved the very same error using frankenphp and laravel 9.x. For brevity, I'll omit docker commands.

I tried dd(config('app.aliases')) in tinker and I found out that the Redis facade is not configured by default anymore. Manually adding the facade solved it immediately.

// in /config/app.php
    'aliases' => Facade::defaultAliases()->merge([
		// your aliases...
        'Redis' => Illuminate\Support\Facades\Redis::class,
    ])->toArray(),

Remember to php artisan config:clear if you are still getting issues

1 like

Please or to participate in this conversation.