1.安装器安装
1. composer global require "laravel/lumen-installer"
2. lumen new blog
2.composer安装
1.composer create-project --prefer-dist laravel/lumen blog
*指定框架版本:composer create-project --prefer-dist laravel/lumen=5.5 blog
服务提供者
使用缓存cache(redis缓存)
安装依赖包
composerrequirepredis/predis1.0.*
composerrequireilluminate/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');
//门面
RedisRedis::set('redisKey','abc123');
默认使用predis客户端
vendor/illuminate/redis/RedisServiceProvider.php
returnnewRedisManager(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
网友评论