Melih Polat
Melih Polat

Reputation: 91

Lumen first install - ReflectionException: Class redis does not exist

I am playing around with Lumen, I installed it via Lumen installer. After I do composer install, I try to use artisan but it throws the following error:

ReflectionException: Class redis does not exist in Container.php on line 752

My composer.json:

"require": {
        "php": ">=7",
        "ext-pdo_pgsql": "*",
        "ext-soap": "*",
        "guzzlehttp/guzzle": "^6.3",
        "laravel/lumen-framework": "5.5.*",
        "laravel/tinker": "^1.0",
        "vlucas/phpdotenv": "~2.2"
    },
    "require-dev": {
        "barryvdh/laravel-ide-helper": "^2.4",
        "doctrine/dbal": "^2.5"
    },

Thanks in advance.

Upvotes: 5

Views: 7596

Answers (2)

Ostap Brehin
Ostap Brehin

Reputation: 3992

I had the same.

Solution:

composer require illuminate/redis

Register it in bootstrap/app.php by calling

$app->register(Illuminate\Redis\RedisServiceProvider::class); 

in the file, under Register Service Providers.

From this aricle.

Upvotes: 11

Ketan Yekale
Ketan Yekale

Reputation: 2223

From Lumen's official documentation at https://lumen.laravel.com/docs/7.x/cache :

Redis Support:

Before using a Redis cache with Lumen, you will need to install the illuminate/redis package via Composer. Then, you should register the Illuminate\Redis\RedisServiceProvider in your bootstrap/app.php file:

$app->register(Illuminate\Redis\RedisServiceProvider::class);

If you have not called $app->withEloquent() in your bootstrap/app.php file, then you should call $app->configure('database'); in the bootstrap/app.php file to ensure the Redis database configuration is properly loaded.

Upvotes: 0

Related Questions