# 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 协议》,转载必须注明作者和本文链接
《L03 构架 API 服务器》
你将学到如 RESTFul 设计风格、PostMan 的使用、OAuth 流程,JWT 概念及使用 和 API 开发相关的进阶知识。
《G01 Go 实战入门》
从零开始带你一步步开发一个 Go 博客项目,让你在最短的时间内学会使用 Go 进行编码。项目结构很大程度上参考了 Laravel。
讨论数量: 1

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

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

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