[Solved] Lumen Error: Class redis does not exist

The company deployed a new project using lumen. The access interface reported a class redis does not exist error, which literally means that redis could not be found. After looking for a solution for a long time, it was later found that the redis plug-in was not added in composer.json, so the container could not find the redis service when loading. The solution is as follows:

1. Add “illuminate/redis” in composer.json: “^ 5.4”

2. Re execute composer install (if the lock file cannot be executed, delete composer.lock and then execute). After successful execution, the redis folder will be generated under vendor\illuminate

3. In bootstrap/app.php, add $app ->; register(Illuminate\Redis\RedisServiceProvider::class);

Read More: