0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Laravel: 5.8 を 10.40 にアップグレードする

Last updated at Posted at 2024-01-13

次のステップで行います。

  • 6.0 にアップグレード
  • 7.0 にアップグレード
  • 8.0 にアップグレード
  • PHP を 8.0 にアップグレード
  • 9.0 にアップグレード
  • 10.0 にアップグレード

開始時のソフトのバージョン

$ php artisan --version
Laravel Framework 5.8.38

$ composer --version
Composer version 2.6.6 2023-12-08 18:32:26

$ php --version
PHP 7.4.33 (cli) (built: Sep  2 2023 08:03:46) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.33, Copyright (c), by Zend Technologies

6.0 にアップグレード

composer.json
(省略)
    "php": "^7.4",
(省略      
    "laravel/framework": "^6.0",
(省略)
rm -rf vendor
composer install

バージョンの確認

$ php artisan --version
Laravel Framework 6.20.44

7.0 にアップグレード

composer.json
(省略)
    "php": "^7.4",
(省略      
    "laravel/framework": "^7.0",
    "laravel/tinker": "^2.0",
(省略)
    "nunomaduro/collision": "^4.1",
(省略)
app/Exceptions/Handler.php
<?php

namespace App\Exceptions;

use Illuminate\Support\Facades\Log;
use Throwable;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
省略
public function report(Throwable $exception)
省略
public function render($request, Throwable $exception)
省略
composer update -W

バージョンの確認

$ php artisan --version
Laravel Framework 7.30.6

8.0 にアップグレード

参考ページ
Laravel 8.x アップグレードガイド

composer.json
(省略)
    "guzzlehttp/guzzle": "^7.0.1",
(省略)    
    "laravel/framework": "^8.0",
(省略)
    "nunomaduro/collision": "^5.0",
    "phpunit/phpunit": "^9.0"
(省略)
composer update -W

バージョンの確認

$ php artisan --version
Laravel Framework 8.83.27

PHP 8.0 を使う

PHP 8.0 をインストール後、バージョンの確認

public/test_a002.php
<?php phpinfo();
?>

サーバーの起動

php artisan serve --host 0.0.0.0

ブラウザーでアクセス
image.png

Laravel 8.0 を PHP 8.0 で使う

composer.json
(省略)
        "php": "^8.0",
(省略)
        "php-ffmpeg/php-ffmpeg": "^1.0.0"
(省略)
composer update -W

9.0 にアップグレード

参考ページ
EC2 を PHP8 ,Laravel9 にバージョン アップ デート(version up)

composer.json
(省略)    
    "laravel/framework": "^9.0",
(省略)
    "nunomaduro/collision": "^6.1",

(省略)
app/Http/Middleware/TrustProxies.php
<?php

namespace App\Http\Middleware;

use Illuminate\Http\Request;
use Illuminate\Http\Middleware\TrustProxies as Middleware;
省略
 protected $headers =
   Request::HEADER_X_FORWARDED_FOR |
   Request::HEADER_X_FORWARDED_HOST |
   Request::HEADER_X_FORWARDED_PORT |
   Request::HEADER_X_FORWARDED_PROTO |
   Request::HEADER_X_FORWARDED_AWS_ELB;
}
composer update -W

バージョンの確認

$ php artisan --version
Laravel Framework 9.52.16

10.0 にアップグレード

composer.json
(省略)    
    "laravel/framework": "^10.0",
(省略)
    "nunomaduro/collision": "^7.0",
    "phpunit/phpunit": "^10.0"
(省略)

"fideloper/proxy": "^4.0", は削除

composer update -W

バージョンの確認

$ php artisan --version
Laravel Framework 10.40.0
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?