1、修改.env文件,如果没有,拷贝.env.example

 1 APP_ENV=local
 2 APP_DEBUG=true
 3 APP_KEY=bcee22b233721b47c6043e6bf35ac4ee
 4 APP_TIMEZONE=Asia/Shanghai
 5 
 6 DB_CONNECTION=mysql
 7 DB_HOST=127.0.0.1
 8 DB_PORT=3306
 9 DB_DATABASE=homestead
10 DB_USERNAME=homestead
11 DB_PASSWORD=secret
12 
13 CACHE_DRIVER=redis
14 QUEUE_DRIVER=sync

2、打开composer.json修改

1 "require": {
2         "php": ">=5.6.4",
3         "laravel/lumen-framework": "5.4.*",
4         "vlucas/phpdotenv": "~2.2",
5         "predis/predis": "~1.0",
6         "illuminate/redis" : "5.4.*"
7     },

3、然后打开运行cmd切换到你的目录 cd xampp/htdocs/lumen

输入 composer uptate

lumen安装redis教程

4、打开bootstrap/app.php添加和去掉注释

1 $app->register(Illuminate\Redis\RedisServiceProvider::class);
2 
3 $app->withFacades();
4 
5 $app->withEloquent();

lumen安装redis教程

5、验证

打开web.php路由修改

1 $app->get('/', function () use ($app) {
2     //return $app->version();
3     Cache::put('lumen', 'Hello, Lumen.', 5);
4     return Cache::get('lumen');
5 });

结果:成功

lumen安装redis教程