Lumen 首次安装 - 反射异常:类 redis 不存在



我正在玩Lumen,我通过Lumen安装程序安装了它。执行composer install后,我尝试使用artisan但它抛出以下错误:

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

我的作曲家.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"
    },

提前谢谢。

我也有同样的情况。

溶液:

composer require illuminate/redis

在引导程序/应用程序中注册它.php方法是调用

$app->register(IlluminateRedisRedisServiceProvider::class); 

在文件中的"注册服务提供商"下。

从这个算术。

来自 Lumen 在 https://lumen.laravel.com/docs/7.x/cache 的官方文档:

瑞迪斯支持:

在将 Redis 缓存与 Lumen 一起使用之前,您需要通过 Composer 安装 illuminate/redis 包。然后,您应该在bootstrap/app.php文件中注册Illuminate\Redis\RedisServiceProvider:

$app->register(IlluminateRedisRedisServiceProvider::class);

如果您尚未在引导程序/app.php 文件中调用$app->withEloquent(),则应在引导程序/app.php 文件中调用$app->configure('database');,以确保正确加载 Redis 数据库配置。

相关内容

最新更新