Readouble

Laravel 5.7 リリースノート

バージョニング規約Versioning Scheme

Laravelのバージョニングは、「パラダイム.メジャー・マイナー」の規約を維持しています。メジャーフレームワークリリースは、1月と6月の半年ごとにリリースします。一方、マイナーリリースは毎週のように、頻繁にリリースされます。マイナーリリースは、ブレーキングチェンジを絶対に含めません。Laravel's versioning scheme maintains the following convention: paradigm.major.minor. Major framework releases are released every six months (February and August), while minor releases may be released as often as every week. Minor releases should never contain breaking changes.

アプリケーションやパッケージで、Laravelフレームワークやコンポーネントを利用する場合、常に5.7.*のようにバージョンを指定してください。理由は上記の通り、Laravelのメジャーリリースは、ブレーキングチェンジを含んでいるからです。新しいメジャーリリースへの更新は、一日かからない程度になるように努力しています。When referencing the Laravel framework or its components from your application or package, you should always use a version constraint such as 5.7.*, since major releases of Laravel do include breaking changes. However, we strive to always ensure you may update to a new major release in one day or less.

パラダイムシフトリリースは数年空けています。これはフレームワークの構造と規約に重要な変更が起きたことを表します。現在、パラダイムシフトリリースは開発されていません。Paradigm shifting releases are separated by many years and represent fundamental shifts in the framework's architecture and conventions. Currently, there is no paradigm shifting release under development.

サポートポリシーSupport Policy

Laravel5.5のようなLTSリリースでは、バグフィックスは2年間、セキュリティフィックスは3年間提供します。これらのリリースは長期間に渡るサポートとメンテナンスを提供します。 一般的なリリースでは、バグフィックスは6ヶ月、セキュリティフィックスは1年です。Lumenを含め、すべての付加的なライブラリは、最新リリースのバグフィックスのみを受け付けます。For LTS releases, such as Laravel 5.5, bug fixes are provided for 2 years and security fixes are provided for 3 years. These releases provide the longest window of support and maintenance. For general releases, bug fixes are provided for 6 months and security fixes are provided for 1 year. For all additional libraries, including Lumen, only the latest release receives bug fixes.

バージョンVersion リリースRelease バグフィックス期限Bug Fixes Until セキュリティフィックス期限Security Fixes Until
5.05.0 2015年2月4日February 4th, 2015 2015年8月4日August 4th, 2015 2016年2月4日February 4th, 2016
5.1 (LTS)5.1 (LTS) 2015年5月9日June 9th, 2015 2017年6月9日June 9th, 2017 2018年6月9日June 9th, 2018
5.25.2 2015年12月21日December 21st, 2015 2016年6月21日June 21st, 2016 2016年12月21日December 21st, 2016
5.35.3 2016年8月23日August 23rd, 2016 2017年2月23日February 23rd, 2017 2017年8月23日August 23rd, 2017
5.45.4 2017年1月24日January 24th, 2017 2017年7月24日July 24th, 2017 2018年1月24日January 24th, 2018
5.5 (LTS)5.5 (LTS) 2017年8月30日August 30th, 2017 2019年8月30日August 30th, 2019 2020年8月30日August 30th, 2020
5.65.6 2018年2月7日February 7th, 2018 2018年8月7日August 7th, 2018 2019年2月7日February 7th, 2019
5.75.7 2018年9月4日September 4th, 2018 2019年3月4日March 4th, 2019 2019年9月4日September 4th, 2019

Laravel5.7Laravel 5.7

Laravel5.7はLaravel5.6からの持続的な向上に付け加え、Laravel Nova、認証のスカフォールドへのオプショナルなメール確認の導入、認可のゲートとポリシーでのゲストユーザーのサポート、コンソールのテスト向上、Symfonyのdump-serverの統合、通知のローカライズ化、それと様々なバグ修正に、使い勝手の向上が行われました。Laravel 5.7 continues the improvements made in Laravel 5.6 by introducing Laravel Nova[https://nova.laravel.com], optional email verification to the authentication scaffolding, support for guest users in authorization gates and policies, console testing improvements, Symfony dump-server integration, localizable notifications, and a variety of other bug fixes and usability improvements.

Laravel NovaLaravel Nova

Laravel NovaはLaravelアプリケーションの美しく、クラス最高な管理ダッシュボードです。Novaのメインな機能は、裏で働いているEloquentを使用したデータベースレコードを管理する能力です。さらに、Novaはフィルター、レンズ、アクション、キューされたアクション、メトリクス、認証、カスタムツール、カスタムカード、カスタムフィールドなども提供しています。Laravel Nova[https://nova.laravel.com] is a beautiful, best-in-class administration dashboard for Laravel applications. The primary feature of Nova is the ability to administer your underlying database records using Eloquent. Additionally, Nova offers support for filters, lenses, actions, queued actions, metrics, authorization, custom tools, custom cards, custom fields, and more.

Laravel Novaについてより詳しく学ぶには、NovaのWebサイトで確認してください。To learn more about Laravel Nova, check out the Nova website[https://nova.laravel.com].

メール確認Email Verification

フレームワークに含まれている認証スカフォールドへ、オプショナルなメール確認をLaravel5.7から導入しました。この機能を取り入れるために、フレームワークに含まれているusersテーブルデフォルトマイグレーションへ、email_verified_atタイムスタンプを追加しました。Laravel 5.7 introduces optional email verification to the authentication scaffolding included with the framework. To accommodate this feature, an email_verified_at timestamp column has been added to the default users table migration that is included with the framework.

新しい登録ユーザーへメールで登録を確認してもらうのを促すには、UserモデルにMustVerifyEmailインターフェイスを実装します。To prompt newly registered users to verify their email, the User model should be marked with the MustVerifyEmail interface:

<?php

namespace App;

use Illuminate\Notifications\Notifiable;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Foundation\Auth\User as Authenticatable;

class User extends Authenticatable implements MustVerifyEmail
{
    // ...
}

UserモデルにMustVerifyEmailインターフェイスを実装すると、新しい登録ユーザーは、サイン付きの確認リンクを含んだメールを受信します。このリンクがクリックされると、Laravelは自動的に確認時間をデータベースに登録し、あなたの選んだページへユーザーをリダイレクトします。Once the User model is marked with the MustVerifyEmail interface, newly registered users will receive an email containing a signed verification link. Once this link has been clicked, Laravel will automatically record the verification time in the database and redirect users to a location of your choosing.

verifiedミドルウェアをデフォルトのアプリケーションのHTTPカーネルへ追加しました。このミドルウェアは、追加したルートへ確認済みのユーザーだけを許可します。A verified middleware has been added to the default application's HTTP kernel. This middleware may be attached to routes that should only allow verified users:

'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,

lightbulb">Tip!! メール確認についてもっと知るには、完全なドキュメントをチェックしてください。{tip} To learn more about email verification, check out the complete documentation[/docs/{{version}}/verification].

ゲストユーザーゲート/ポリシーGuest User Gates / Policies

以前のバージョンのLaravelでは、認可ゲートとポリシーは、アプリケーションの未認証な訪問者に対し、自動的にfalseを返していました。しかし今バージョンからはユーザーの引数定義で、「オプショナル」なタイプヒントを宣言するか、nullデフォルト値を指定することにより、ゲストを認可チェックにパスさせることができます。In previous versions of Laravel, authorization gates and policies automatically returned false for unauthenticated visitors to your application. However, you may now allow guests to pass through authorization checks by declaring an "optional" type-hint or supplying a null default value for the user argument definition:

Gate::define('update-post', function (?User $user, Post $post) {
    // ...
});

SymfonyダンプサーバSymfony Dump Server

Laravel5.7では、Marcel Pociotによるパッケージにより、Symfonyのdump-serverコマンドを統合しました。利用開始するには、dump-server Artisanコマンドを起動します。Laravel 5.7 offers integration with Symfony's dump-server command via a package by Marcel Pociot[https://github.com/beyondcode/laravel-dump-server]. To get started, run the dump-server Artisan command:

php artisan dump-server

サーバを起動すると、すべてのdump呼び出しはブラウザの代わりに、dump-serverコンソールウィンドウに表示されます。それにより、HTTPレスポンス出力をごちゃごちゃにしなくても、値を確認できます。Once the server has started, all calls to dump will be displayed in the dump-server console window instead of in your browser, allowing you to inspect the values without mangling your HTTP response output.

通知のローカライズ化Notification Localization

Laravelは現在の言語ではなく、ローケルにより通知を送れるようになりました。このローケルは通知がキューされていても保持されます。Laravel now allows you to send notifications in a locale other than the current language, and will even remember this locale if the notification is queued.

これを実現するため、希望する言語を指定するlocaleメソッドをIlluminate\Notifications\Notificationクラスに提供しました。アプリケーションは通知を整形する時に、指定のローケルへ変更します。その後に整形が完了したら、以前のローケルへ戻ります。To accomplish this, the Illuminate\Notifications\Notification class now offers a locale method to set the desired language. The application will change into this locale when the notification is being formatted and then revert back to the previous locale when formatting is complete:

$user->notify((new InvoicePaid($invoice))->locale('es'));

複数のNotifiableエントリーのローカリゼーションも、Notificationファサードにより達成できます。Localization of multiple notifiable entries may also be achieved via the Notification facade:

Notification::locale('es')->send($users, new InvoicePaid($invoice));

コンソールテストConsole Testing

Laravel5.7でexpectsQuestionメソッドを使用すれば、コンソールコマンドのユーザー入力を簡単に「モック」できます。更に、終了コードをassertExitCodeメソッドで、コンソールコマンドに期待する出力をexpectsOutputメソッドで指定することもできます。Laravel 5.7 allows you to easily "mock" user input for your console commands using the expectsQuestion method. In addition, you may specify the exit code and text that you expect to be output by the console command using the assertExitCode and expectsOutput methods. For example, consider the following console command:

Artisan::command('question', function () {
    $name = $this->ask('What is your name?');

    $language = $this->choice('Which language do you program in?', [
        'PHP',
        'Ruby',
        'Python',
    ]);

    $this->line('Your name is '.$name.' and you program in '.$language.'.');
});

このコマンドを以下のように、expectsQuestionexpectsOutputassertExitCodeメソッドを活用してテストできます。You may test this command with the following test which utilizes the expectsQuestion, expectsOutput, and assertExitCode methods:

/**
 * コンソールコマンドのテスト
 *
 * @return void
 */
public function test_console_command()
{
    $this->artisan('question')
         ->expectsQuestion('What is your name?', 'Taylor Otwell')
         ->expectsQuestion('Which language do you program in?', 'PHP')
         ->expectsOutput('Your name is Taylor Otwell and you program in PHP.')
         ->assertExitCode(0);
}

URLジェネレータとコールバック記法URL Generator & Callable Syntax

コントローラアクションに対するURLを生成する場合、LaravelのURLジェネレータは文字列を受け取るだけでなく、"callable"記法も受け付けるようになりました。Instead of only accepting strings, Laravel's URL generator now accepts "callable" syntax when generating URLs to controller actions:

action([UserController::class, 'index']);

ペジネーションリンクPaginator Links

Laravel5.7では、ペギネータのURL「ウィンドウ」の両サイドに、いくつの追加のリンクを表示するかを調整できます。デフォルトでは、メインのペジネータリンクの両サイドに3つのリンクが表示されます。この数を調整するには、onEachSideメソッドを使用します。Laravel 5.7 allows you to control how many additional links are displayed on each side of the paginator's URL "window". By default, three links are displayed on each side of the primary paginator links. However, you may control this number using the onEachSide method:

{{ $paginator->onEachSide(5)->links() }}

ファイルシステム読み込み/書き込みストリームFilesystem Read / Write Streams

Laravelのファイルシステムに、readStreamwriteStreamメソッドが用意されました。Laravel's Flysystem integration now offers readStream and writeStream methods:

Storage::disk('s3')->writeStream(
    'remote-file.zip',
    Storage::disk('local')->readStream('local-file.zip')
);

章選択

設定

明暗テーマ
light_mode
dark_mode
brightness_auto システム設定に合わせる
テーマ選択
photo_size_select_actual デフォルト
photo_size_select_actual モノクローム(白黒)
photo_size_select_actual Solarized風
photo_size_select_actual GitHub風(青ベース)
photo_size_select_actual Viva(黄緑ベース)
photo_size_select_actual Happy(紫ベース)
photo_size_select_actual Mint(緑ベース)
コードハイライトテーマ選択

明暗テーマごとに、コードハイライトのテーマを指定できます。

テーマ配色確認
スクリーン表示幅
640px
80%
90%
100%

768px以上の幅があるときのドキュメント部分表示幅です。

インデント
無し
1rem
2rem
3rem
原文確認
原文を全行表示
原文を一行ずつ表示
使用しない

※ 段落末のEボタンへカーソルオンで原文をPopupします。

Diff表示形式
色分けのみで区別
行頭の±で区別
削除線と追記で区別

※ [tl!…]形式の挿入削除行の表示形式です。

Pagination和文
ペジネーション
ペギネーション
ページネーション
ページ付け
Scaffold和文
スカフォールド
スキャフォールド
型枠生成
本文フォント

総称名以外はCSSと同様に、"〜"でエスケープしてください。

コードフォント

総称名以外はCSSと同様に、"〜"でエスケープしてください。

保存内容リセット

localStrageに保存してある設定項目をすべて削除し、デフォルト状態へ戻します。

ヘッダー項目移動

キーボード操作