Laravel 5.6 を 5.7 へアップグレードした手順メモ

スポンサードリンク


参考ページを上から順番に実施していきました。

依存パッケージのアップデート

$ git diff composer.json
diff --git a/composer.json b/composer.json
index 2e0dfa8..5547847 100644
--- a/composer.json
+++ b/composer.json
@@ -7,7 +7,7 @@
     "require": {
         "php": ">=7.1.3",
         "fideloper/proxy": "^4.0",
-        "laravel/framework": "5.6.*",
+        "laravel/framework": "5.7.*",
         "laravel/tinker": "~1.0"
     },
     "require-dev": {
composer update

実際

$ docker-compose run --rm composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 15 installs, 2 updates, 0 removals
  - Installing opis/closure (3.3.1): Downloading (100%)
  - Updating nesbot/carbon (1.25.3 => 1.39.0): Downloading (100%)
  - Installing guzzlehttp/promises (v1.3.1): Downloading (100%)
  - Installing ralouphie/getallheaders (3.0.3): Downloading (100%)
  - Installing psr/http-message (1.0.1): Downloading (100%)
  - Installing guzzlehttp/psr7 (1.6.1): Downloading (100%)
  - Installing guzzlehttp/guzzle (6.3.3): Downloading (100%)
  - Installing laravel/slack-notification-channel (v1.0.3): Downloading (100%)
  - Updating laravel/framework (v5.6.39 => v5.7.28): Downloading (100%)
  - Installing lcobucci/jwt (3.3.1): Downloading (100%)
  - Installing php-http/promise (v1.0.0): Downloading (100%)
  - Installing php-http/httplug (v1.1.0): Downloading (100%)
  - Installing php-http/guzzle6-adapter (v1.1.1): Downloading (100%)
  - Installing psr/http-factory (1.0.1): Downloading (100%)
  - Installing zendframework/zend-diactoros (2.1.3): Downloading (100%)
  - Installing nexmo/client (1.8.1): Downloading (100%)
  - Installing laravel/nexmo-notification-channel (v1.0.1): Downloading (100%)
guzzlehttp/psr7 suggests installing zendframework/zend-httphandlerrunner (Emit PSR-7 responses)
Writing lock file
Generating optimized autoload files
Carbon 1 is deprecated, see how to migrate to Carbon 2.
https://carbon.nesbot.com/docs/#api-carbon-2
    You can run './vendor/bin/upgrade-carbon' to get help in updating carbon and other frameworks and libraries that depend on it.
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover
Discovered Package: barryvdh/laravel-debugbar
Discovered Package: fideloper/proxy
Discovered Package: krlove/eloquent-model-generator
Discovered Package: laravel/nexmo-notification-channel
Discovered Package: laravel/slack-notification-channel
Discovered Package: laravel/tinker
Discovered Package: nesbot/carbon
Discovered Package: orangehill/iseed
Discovered Package: xethron/migrations-generator
Package manifest generated successfully.
... 略 ...

Assetディレクトリの非階層化

$ git show
commit 94d9bdd1ae1dde53252d49b02da59cb24e178cb4 (HEAD -> feat-update-laravel-from-5-6-to-5-7)
Author: oki2a24 <oki2a24@gmail.com>
Date:   Sat Jul 20 12:10:30 2019 +0900

    feat: Assetディレクトリの非階層化をする

diff --git a/resources/assets/js/app.js b/resources/js/app.js
similarity index 100%
rename from resources/assets/js/app.js
rename to resources/js/app.js
diff --git a/resources/assets/js/bootstrap.js b/resources/js/bootstrap.js
similarity index 100%
rename from resources/assets/js/bootstrap.js
rename to resources/js/bootstrap.js
diff --git a/resources/assets/sass/_variables.scss b/resources/sass/_variables.scss
similarity index 100%
rename from resources/assets/sass/_variables.scss
rename to resources/sass/_variables.scss
diff --git a/resources/assets/sass/app.scss b/resources/sass/app.scss
similarity index 100%
rename from resources/assets/sass/app.scss
rename to resources/sass/app.scss
diff --git a/webpack.mix.js b/webpack.mix.js
index 72fdbb1..20141cd 100644
--- a/webpack.mix.js
+++ b/webpack.mix.js
@@ -11,5 +11,5 @@ let mix = require('laravel-mix');
  |
  */

-mix.js('resources/assets/js/app.js', 'public/js')
-   .sass('resources/assets/sass/app.scss', 'public/css');
+mix.js('resources/js/app.js', 'public/js')
+   .sass('resources/sass/app.scss', 'public/css');

Cache

mkdir -p storage/framework/cache/data
cp storage/framework/cache/.gitignore storage/framework/cache/data/.gitignore
vim storage/framework/cache/.gitignore
$ git diff storage/framework/cache/.gitignore
diff --git a/storage/framework/cache/.gitignore b/storage/framework/cache/.gitignore
index d6b7ef3..01e4a6c 100644
--- a/storage/framework/cache/.gitignore
+++ b/storage/framework/cache/.gitignore
@@ -1,2 +1,3 @@
 *
+!data/
 !.gitignore
$

おわりに

今回は、前回の Laravel 5.5 を 5.6 へアップグレードした手順メモ – oki2a24 よりも楽でした。

慣れてきましたし、量も少なかったです。

次は 5.7 から 5.8 へのアップグレードです。

すんなり行くとよいのですけれども。

コメントを残す

コメントを残す