# Laravel 5.5 升级到 6.0 踩坑记录

1. 使用 phpredis 替代 predis

Laravel 开始推荐使用 phpredis 来代替 predis

所以要记得先安装 phpredis, 然后在 config/app.php 中去掉 Redis 别名

Mac 安装

# 这里需要将当前版本设置为主版本才可以, 如果不是主版本则安装会太费劲
$ brew link --force php@{version}
$ pecl install igbinary
$ pecl install redis
$ brew services restart php@7.2

其他平台

应该是直接安装即可(未测试)

2. Unable to create configured logger. Using emergency logger

在 5.6 之后已经将配置文件独立 config/logging.php, 将这个文件放置到指定目录, 然后 app.php 移除日志的配置 Logging Configuration

3. Call to undefined method Illuminate\Events\Dispatcher::fire()

在 (5.8 升级指南)(https://learnku.com/docs/laravel/5.8/upgrade) 指出,

Likelihood Of Impact: Low

deprecated and removed
Events The fire Method

使用 dispatch 方法替代 You should use the dispatch method instead.

4. Class 'Illuminate\Support\Facades\Input' not found

使用 Request 替代 Input

Input no longer exists. Either use the Request facade or alias that instead of Input.

5. str_contains 等 helper 函数

这些函数均需要替换成静态函数方法 Str::contains

下面是 辅助函数列表

5.1 辅助函数列表

本作品采用《CC 协议》,转载必须注明作者和本文链接
《L05 电商实战》
从零开发一个电商项目,功能包括电商后台、商品 & SKU 管理、购物车、订单管理、支付宝支付、微信支付、订单退款流程、优惠券等
《L02 从零构建论坛系统》
以构建论坛项目 LaraBBS 为线索,展开对 Laravel 框架的全面学习。应用程序架构思路贴近 Laravel 框架的设计哲学。
讨论数量: 1

laravel基于什么考虑用 phpredis 来代替 predis

5年前 评论
imvkmark (楼主) 5年前

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!