001-laravel 5.3 升級(jí)到 laravel 5.5

記錄升級(jí)時(shí)的問(wèn)題與執(zhí)行步驟

第一步 修改composer.json(項(xiàng)目根目錄下)配置:

...
    "require": {
        ...
        "laravel/framework": "5.5.*",
        ...
     }
...
    "require-dev": {
        ...
        "phpunit/phpunit": "^7.0",
        ...
     }
...

第二步 執(zhí)行更新并刪除緩存、文件

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() 相關(guān)的 Blade 錯(cuò)誤
php artisan route:clear
php artisan cache:clear
php artisan config:clear
rm -rf  bootstrap/cache/compiled.php #刪除編譯的服務(wù)文件 它不再被框架使用。

第三步 Redis 集群支持。

如果你正在使用 Redis 集群,則應(yīng)該將集群連接置于config/database.php配置文件的 Redis 部分中的 clusters 配置選項(xiàng)內(nèi)

原來(lái):

    '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 郵件組件

你需要添加如下區(qū)域配置到 config/mail.php 配置文件底部:

    'markdown' => [
        'theme' => 'default',

        'paths' => [
            resource_path('views/vendor/mail'),
        ],
    ],

遇到的問(wèn)題

問(wèn)題1

Package phpoffice/phpexcel is abandoned, you should avoid using it. Use phpoffice/phpspreadsheet instead.

phpoffice/phpexcel 棄用。升級(jí)為phpoffice/phpspreadsheet。在composer.json中沒(méi)有直接使用phpoffice/phpexcel組件,于是查找依賴(lài)它的組件:

composer depends phpoffice/phpexcel

結(jié)果為:

maatwebsite/excel  2.1.20  requires  phpoffice/phpexcel (1.8.*)  

于是將maatwebsite/excel版本升級(jí)^3.0,編輯composer.json:

    "require": {
        ...
       "maatwebsite/excel": "^3.0",
        ...
     }

然后執(zhí)行升級(jí),參考:前面第二步 執(zhí)行更新并刪除緩存、文件


問(wèn)題2

Package phpunit/phpunit-mock-objects is abandoned, you should avoid using it. No replacement was suggested.

phpunit/phpunit-mock-objects 棄用。在composer.json中沒(méi)有直接使用phpunit/phpunit-mock-objects組件,于是查找依賴(lài)它的組件:

composer depends phpunit/phpunit-mock-objects

結(jié)果為:

phpunit/phpunit  5.7.21  requires  phpunit/phpunit-mock-objects (^3.2)

于是將phpunit/phpunit版本升級(jí)^3.0,編輯composer.json:

    "require-dev": {
        ...
       "phpunit/phpunit": "^7.0",
        ...
     }

然后執(zhí)行升級(jí),參考:前面第二步 執(zhí)行更新并刪除緩存、文件


laravel 5.5中沒(méi)有tinker,可以自行安裝:

安裝Laravel Tinker
為了繼續(xù)使用 tinker Artisan 命令,你還應(yīng)該安裝 laravel/tinker 包:

composer require laravel/tinker
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀(guān)點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

友情鏈接更多精彩內(nèi)容