记录升级时的问题与执行步骤
第一步 修改composer.json
(项目根目录下)配置:
...
"require": {
...
"laravel/framework": "5.5.*",
...
}
...
"require-dev": {
...
"phpunit/phpunit": "^7.0",
...
}
...
第二步 执行更新并删除缓存、文件
composer update -vvv
composer update
chmod 777 -R storage/
chmod 777 -R bootstrap/cache/
composer dump-autoload
php artisan clear-compiled
php artisan view:clear #避免与删除 Illuminate\View\Factory::getFirstLoop() 相关的 Blade 错误
php artisan route:clear
php artisan cache:clear
php artisan config:clear
rm -rf bootstrap/cache/compiled.php #删除编译的服务文件 它不再被框架使用。
第三步 Redis 集群支持。
如果你正在使用 Redis
集群,则应该将集群连接置于config/database.php
配置文件的 Redis 部分中的 clusters
配置选项内
原来:
'redis' => [
'cluster' => true,
'default' => [
'host' => env('REDIS_HOST', 'localhost'),
'password' => env('REDIS_PASSWORD', null),
'port' => env('REDIS_PORT', 6379),
'database' => 0,
],
],
修改为:
/*
|--------------------------------------------------------------------------
| Redis Databases
|--------------------------------------------------------------------------
|
| Redis is an open source, fast, and advanced key-value store that also
| provides a richer set of commands than a typical key-value systems
| such as APC or Memcached. Laravel makes it easy to dig right in.
|
*/
'redis' => [
'cluster' => true,
'client' => 'predis',
'options' => [
'cluster' => 'redis',
],
'clusters' => [
'default' => [
[
'host' => env('REDIS_HOST', '127.0.0.1'),
'password' => env('REDIS_PASSWORD', null),
'port' => env('REDIS_PORT', 6379),
'database' => 0,
],
],
],
],
第四步 Markdown 邮件组件
你需要添加如下区域配置到 config/mail.php
配置文件底部:
'markdown' => [
'theme' => 'default',
'paths' => [
resource_path('views/vendor/mail'),
],
],
遇到的问题
问题1
Package phpoffice/phpexcel is abandoned, you should avoid using it. Use phpoffice/phpspreadsheet instead.
phpoffice/phpexcel
弃用。升级为phpoffice/phpspreadsheet
。在composer.json中没有直接使用phpoffice/phpexcel
组件,于是查找依赖它的组件:
composer depends phpoffice/phpexcel
结果为:
maatwebsite/excel 2.1.20 requires phpoffice/phpexcel (1.8.*)
于是将maatwebsite/excel
版本升级^3.0
,编辑composer.json
:
"require": {
...
"maatwebsite/excel": "^3.0",
...
}
然后执行升级,参考:前面第二步 执行更新并删除缓存、文件
问题2
Package phpunit/phpunit-mock-objects is abandoned, you should avoid using it. No replacement was suggested.
phpunit/phpunit-mock-objects
弃用。在composer.json中没有直接使用phpunit/phpunit-mock-objects
组件,于是查找依赖它的组件:
composer depends phpunit/phpunit-mock-objects
结果为:
phpunit/phpunit 5.7.21 requires phpunit/phpunit-mock-objects (^3.2)
于是将phpunit/phpunit
版本升级^3.0
,编辑composer.json
:
"require-dev": {
...
"phpunit/phpunit": "^7.0",
...
}
然后执行升级,参考:前面第二步 执行更新并删除缓存、文件
laravel 5.5中没有tinker,可以自行安装:
安装Laravel Tinker
为了继续使用 tinker Artisan 命令,你还应该安装 laravel/tinker 包:
composer require laravel/tinker
网友评论