lumen安装
- 安装器安装
1. composer global require "laravel/lumen-installer"
2. lumen new blog
- composer安装
composer create-project --prefer-dist laravel/lumen blog
服务提供者
使用缓存cache(redis缓存)
- 安装依赖包
composer require predis/predis 1.0.*
composer require illuminate/redis
- 配置
bootstrap/app.php 文件中注册Illuminate\Redis\RedisServiceProvider
$app->register( Illuminate\Redis\RedisServiceProvider::class );
- 加载Eloquent/配置
3.1 只加载配置
$app->configure('database');
3.2同时加载Eloquent
$app->withEloquent();
- 使用门面
$app->withFacades();
- 使用
app('redis')->set('redisKey', 'abc123');
//门面Redis
Redis::set('redisKey', 'abc123');
- 默认使用predis客户端
vendor/illuminate/redis/RedisServiceProvider.php
return new RedisManager(Arr::pull($config, 'client', 'predis'), $config);
app('cache')->put('cacheKey', '123abc', 2);
//门面Cache
Cache::put('cacheKey', '123abc', 2);
lumen辅助函数位置
vendor/illuminate/support/helpers.php
lumen配置文件位置
vendor/laravel/lumen-framework/config