Readouble

Laravel 9.x リリースノート

バージョニング規約Versioning Scheme

Laravelとファーストパーティパッケージは、セマンティックバージョニングにしたがっています。メジャーなフレームのリリースは、毎年2月にリリースします。マイナーとパッチリリースはより細かく毎週リリースします。マイナーとパッチリリースは、決してブレーキングチェンジを含みませんLaravel and its other first-party packages follow Semantic Versioning[https://semver.org]. Major framework releases are released every year (~February), while minor and patch releases may be released as often as every week. Minor and patch releases should never contain breaking changes.

あなたのアプリケーションやパッケージから、Laravelフレームワーク、もしくはコンポーネントを参照する場合は、Laravelのメジャーリリースには重大な変更が含まれているため、常に^ 9.0などのようにバージョンを指定する必要があります。ただし、私たちは1日中以内に新しいメジャーリリースへ更新できるように、常に努力しています。When referencing the Laravel framework or its components from your application or package, you should always use a version constraint such as ^9.0, 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.

名前付き引数Named Arguments

名前付き引数は、Laravelの下位互換性ガイドラインの対象外です。Laravelコードベースを改善するために、必要に応じて関数の引数の名前を変更することもできます。したがって、Laravelメソッドを呼び出すときに名前付き引数を使用する場合は、パラメーター名が将来変更される可能性があることを理解した上で、慎重に行う必要があります。Named arguments[https://www.php.net/manual/en/functions.arguments.php#functions.named-arguments] are not covered by Laravel's backwards compatibility guidelines. We may choose to rename function arguments when necessary in order to improve the Laravel codebase. Therefore, using named arguments when calling Laravel methods should be done cautiously and with the understanding that the parameter names may change in the future.

サポートポリシーSupport Policy

Laravelのすべてのリリースは、バグフィックスは18ヶ月、セキュリティフィックスは2年です。Lumenのようなその他の追加ライブラリでは、最新のメジャーリリースのみでバグフィックスを受け付けています。また、Laravelがサポートするデータベースのサポートについても確認してください。For all Laravel releases, bug fixes are provided for 18 months and security fixes are provided for 2 years. For all additional libraries, including Lumen, only the latest major release receives bug fixes. In addition, please review the database versions supported by Laravel[/docs/{{version}}/database#introduction].

バージョンVersion PHP (*)PHP (*) リリースRelease バグフィックス期日Bug Fixes Until セキュリティ修正期日Security Fixes Until
6 (LTS)6 (LTS) 7.2 - 8.07.2 - 8.0 2019年9月3日September 3rd, 2019 2022年1月25日January 25th, 2022 2022年9月6日September 6th, 2022
77 7.2 - 8.07.2 - 8.0 2020年3月3日March 3rd, 2020 2020年10月6日October 6th, 2020 2021年3月3日March 3rd, 2021
88 7.3 - 8.17.3 - 8.1 2020年9月8日September 8th, 2020 2022年7月26日July 26th, 2022 2023年1月24日January 24th, 2023
99 8.0 - 8.28.0 - 8.2 2022年2月8日February 8th, 2022 2023年8月8日August 8th, 2023 2024年2月6日February 6th, 2024
1010 8.1 - 8.28.1 - 8.2 2023年第一四半期Q1 2023 2024年8月6日August 6th, 2024 2025年2月4日February 4th, 2025
End of life
Security fixes only

(*) 対応PHPバージョン(*) Supported PHP versions

Laravel9Laravel 9

ご存知かもしれませんが、Laravel8のリリース時から、Laravelは年次リリースに移行しました。以前は、メジャーバージョンを6か月ごとにリリースしていました。この変更はコミュニティのメンテナンスの負担を軽減することと、開発チームが互換性を失う変更を加えることなく、驚くべき強力な新機能を出荷する試みができることを目的としています。そのため、下位互換性を損なうことなく、さまざまな堅牢な機能をLaravel8へ取り入れました。並列テストのサポート、Breezeスターターキットの改善、HTTPクライアントの改善、さらに"has one of many"を含む、新しいEloquentリレーションシップタイプなどです。As you may know, Laravel transitioned to yearly releases with the release of Laravel 8. Previously, major versions were released every 6 months. This transition is intended to ease the maintenance burden on the community and challenge our development team to ship amazing, powerful new features without introducing breaking changes. Therefore, we have shipped a variety of robust features to Laravel 8 without breaking backwards compatibility, such as parallel testing support, improved Breeze starter kits, HTTP client improvements, and even new Eloquent relationship types such as "has one of many".

したがって、現在のリリースへ優れた新機能を導入するこの取り組みにより、将来の「メジャー」リリースが主にアップストリームの依存関係のアップグレードなど、「メンテナンス」タスクに使用されるようになります。これは、これらのリリースノートに記載されています。Therefore, this commitment to ship great new features during the current release will likely lead to future "major" releases being primarily used for "maintenance" tasks such as upgrading upstream dependencies, which can be seen in these release notes.

Laravel9、Symfony6.0コンポーネントの動作には、PHP8.0以上が必要です。Flysystem3.0のサポート、改良したroute:list表示、Laravel Scoutデータベースドライバ、新しいEloquentアクセサ/ミューテタ構文、Enumによる暗黙のルート結合、その他様々なバグ修正とユーザービリティ向上によりLaravel8.xで改善されたことを継続しています。Laravel 9 continues the improvements made in Laravel 8.x by introducing support for Symfony 6.0 components, Symfony Mailer, Flysystem 3.0, improved route:list output, a Laravel Scout database driver, new Eloquent accessor / mutator syntax, implicit route bindings via Enums, and a variety of other bug fixes and usability improvements.

PHP8.0PHP 8.0

Laravel9.xの動作には、PHP8.0以上が必要です。Laravel 9.x requires a minimum PHP version of 8.0.

Symfony MailerSymfony Mailer

Symfony Mailerのサポートは、Dries VintsJames BrooksJulius Kiekbuschが貢献しました。Symfony Mailer support was contributed by Dries Vints[https://github.com/driesvints], James Brooks[https://github.com/jbrooksuk], and Julius Kiekbusch[https://github.com/Jubeki].

以前のLaravelリリースは、送信メールの送信にSwift Mailerライブラリが利用していました。しかし、このライブラリはすでにメンテナンスされておらず、Symfony Mailerに継承されています。Previous releases of Laravel utilized the Swift Mailer[https://swiftmailer.symfony.com/docs/introduction.html] library to send outgoing email. However, that library is no longer maintained and has been succeeded by Symfony Mailer.

皆さんのアプリケーションとSymfony Mailerとの互換性の詳細を確認するには、アップグレードガイドを参照してください。Please review the upgrade guide[/docs/{{version}}/upgrade#symfony-mailer] to learn more about ensuring your application is compatible with Symfony Mailer.

Flysystem3.xFlysystem 3.x

Flysystem3.xのサポートは、Dries Vintsが貢献しました。Flysystem 3.x support was contributed by Dries Vints[https://github.com/driesvints].

Laravel9.xは、上流のFlysystem依存パッケージをFlysystem3.xへアップグレードしています。Flysystemは、Storageファサードが提供するファイルシステム操作のすべてを提供しています。Laravel 9.x upgrades our upstream Flysystem dependency to Flysystem 3.x. Flysystem powers all of filesystem interactions offered by the Storage facade.

皆さんのアプリケーションが、Flysystem3.xと互換性を持つための詳細は、アップグレードガイドを参照してください。Please review the upgrade guide[/docs/{{version}}/upgrade#flysystem-3] to learn more about ensuring your application is compatible with Flysystem 3.x.

Eloquentアクセサ/ミューテタの向上Improved Eloquent Accessors / Mutators

Eloquentアクセサ/ミューテタの改良は、Taylor Otwellが貢献しました。Improved Eloquent accessors / mutators was contributed by Taylor Otwell[https://github.com/taylorotwell].

Laravel9.xは、Eloquentのアクセサとミューテタを定義する新しい方法を提供しました。以前のLaravelのリリースでは、アクセサやミューテタを定義する方法は、以下のようにモデルにプレフィックス付きのメソッドを定義することのみでした。Laravel 9.x offers a new way to define Eloquent accessors and mutators[/docs/{{version}}/eloquent-mutators#accessors-and-mutators]. In previous releases of Laravel, the only way to define accessors and mutators was by defining prefixed methods on your model like so:

public function getNameAttribute($value)
{
    return strtoupper($value);
}

public function setNameAttribute($value)
{
    $this->attributes['name'] = $value;
}

しかし、Laravel9.xでは、Illuminate\Database\Eloquent\Casts\Attributeタイプの戻り値をタイプヒントすることで、プレフィックスを使わない単独のメソッドを使用して、アクセサとミューテタを定義することができます。However, in Laravel 9.x you may define an accessor and mutator using a single, non-prefixed method by type-hinting a return type of Illuminate\Database\Eloquent\Casts\Attribute:

use Illuminate\Database\Eloquent\Casts\Attribute;

public function name(): Attribute
{
    return new Attribute(
        get: fn ($value) => strtoupper($value),
        set: fn ($value) => $value,
    );
}

さらに、アクセサを定義するこの新しいアプローチにより、カスタムキャストクラスのように、属性が返したオブジェクト値をキャッシュするようになります。In addition, this new approach to defining accessors will cache object values that are returned by the attribute, just like custom cast classes[/docs/{{version}}/eloquent-mutators#custom-casts]:

use App\Support\Address;
use Illuminate\Database\Eloquent\Casts\Attribute;

public function address(): Attribute
{
    return new Attribute(
        get: fn ($value, $attributes) => new Address(
            $attributes['address_line_one'],
            $attributes['address_line_two'],
        ),
        set: fn (Address $value) => [
            'address_line_one' => $value->lineOne,
            'address_line_two' => $value->lineTwo,
        ],
    );
}

Enum Eloquent属性キャストEnum Eloquent Attribute Casting

warning Warning! EnumキャストはPHP8.1以上で利用できます。Warning
Enum casting is only available for PHP 8.1 .

Enumキャストは、Mohamed Saidが貢献しました。Enum casting was contributed by Mohamed Said[https://github.com/themsaid].

Eloquentは、属性値をPHPの「値に依存した(backed)」 Enumsへキャストできるようになりました。これを使用するには、モデルの$castsプロパティ配列で、キャストしたい属性と列挙型を指定します。Eloquent now allows you to cast your attribute values to PHP "backed" Enums[https://www.php.net/manual/en/language.enumerations.backed.php]. To accomplish this, you may specify the attribute and enum you wish to cast in your model's $casts property array:

use App\Enums\ServerStatus;

/**
 * キャストする属性
 *
 * @var array
 */
protected $casts = [
    'status' => ServerStatus::class,
];

一度、モデルでキャストを定義したら、属性を操作するとき、指定した属性は自動的にenumへキャストされたり、enumからキャストされたりします。Once you have defined the cast on your model, the specified attribute will be automatically cast to and from an enum when you interact with the attribute:

if ($server->status == ServerStatus::Provisioned) {
    $server->status = ServerStatus::Ready;

    $server->save();
}

Enumによる暗黙のルート結合Implicit Route Bindings With Enums

Enumによる暗黙のルート結合は、Nuno Maduroが貢献しました。Implicit Enum bindings was contributed by Nuno Maduro[https://github.com/nunomaduro].

PHP 8.1では、Enumsがサポートされました。Laravel9.xでは、ルート定義にEnumをタイプヒントする機能が導入され、LaravelはそのルートセグメントがURIの有効なEnum値である場合にのみルートを呼び出します。そうでない場合は、HTTP 404レスポンスを自動的に返します。例えば、次のようなEnumがあるとします。PHP 8.1 introduces support for Enums[https://www.php.net/manual/en/language.enumerations.backed.php]. Laravel 9.x introduces the ability to type-hint an Enum on your route definition and Laravel will only invoke the route if that route segment is a valid Enum value in the URI. Otherwise, an HTTP 404 response will be returned automatically. For example, given the following Enum:

enum Category: string
{
    case Fruits = 'fruits';
    case People = 'people';
}

{category}ルートセグメントが、fruitsまたはpeopleである場合にのみ呼び出されるルートを定義しています。そうでない場合は、HTTP 404レスポンスを返します。You may define a route that will only be invoked if the {category} route segment is fruits or people. Otherwise, an HTTP 404 response will be returned:

Route::get('/categories/{category}', function (Category $category) {
    return $category->value;
});

ルート結合における制限の強制Forced Scoping Of Route Bindings

制限の強制付き結合は、Claudio Dekkerが貢献しました。Forced scoped bindings was contributed by Claudio Dekker[https://github.com/claudiodekker].

以前のLaravelリリースで、ルート定義の2番目のEloquentモデルを前のEloquentモデルの子になるように制限したい場合があったとしましょう。例として、特定ユーザーのブログ記事をスラッグで取得するルート定義について考えてみましょう。In previous releases of Laravel, you may wish to scope the second Eloquent model in a route definition such that it must be a child of the previous Eloquent model. For example, consider this route definition that retrieves a blog post by slug for a specific user:

use App\Models\Post;
use App\Models\User;

Route::get('/users/{user}/posts/{post:slug}', function (User $user, Post $post) {
    return $post;
});

ネストしたルートパラメータとして、カスタムキー付きの暗黙の結合を使用する場合、Laravelは親のリレーション名を推測する命名規約を使用することにより、ネストしたモデルを取得するためのクエリを自動的に制限します。しかし、この動作は以前、カスタムキーが子ルートの結合に使用されたときのみ、Laravelはサポートしていました。When using a custom keyed implicit binding as a nested route parameter, Laravel will automatically scope the query to retrieve the nested model by its parent using conventions to guess the relationship name on the parent. However, this behavior was only previously supported by Laravel when a custom key was used for the child route binding.

しかし、Laravel9.xでは、カスタムキーが提供されない場合でも、Laravelに「子」結合を限定するよう指示できるようになりました。これを行うには、ルートの定義でscopeBindingsメソッドを呼び出します。However, in Laravel 9.x, you may now instruct Laravel to scope "child" bindings even when a custom key is not provided. To do so, you may invoke the scopeBindings method when defining your route:

use App\Models\Post;
use App\Models\User;

Route::get('/users/{user}/posts/{post}', function (User $user, Post $post) {
    return $post;
})->scopeBindings();

また、ルート定義のグループ全体へ、スコープ付き結合を使用するように指示することもできます。Or, you may instruct an entire group of route definitions to use scoped bindings:

Route::scopeBindings()->group(function () {
    Route::get('/users/{user}/posts/{post}', function (User $user, Post $post) {
        return $post;
    });
});

コントローラルートグループController Route Groups

ルートグループの改良は、Luke Downingが貢献しました。Route group improvements were contributed by Luke Downing[https://github.com/lukeraymonddowning].

controller メソッドにより、グループ内のすべてのルートに共通のコントローラを定義できるようになりました。それにより、ルート定義時に呼び出すコントローラメソッドを指定するだけでよくなりました。You may now use the controller method to define the common controller for all of the routes within the group. Then, when defining the routes, you only need to provide the controller method that they invoke:

use App\Http\Controllers\OrderController;

Route::controller(OrderController::class)->group(function () {
    Route::get('/orders/{id}', 'show');
    Route::post('/orders', 'store');
});

フルテキストインデックス/WHERE句Full Text Indexes / Where Clauses

全文インデックスと"WHERE"句は、Taylor OtwellDries Vintsの貢献です。Full text indexes and "where" clauses were contributed by Taylor Otwell[https://github.com/taylorotwell] and Dries Vints[https://github.com/driesvints].

MySQLかPostgreSQLを使用している場合、カラム定義でfullTextメソッドを追加し、フルテキストインデックスを生成できるようにしました。When using MySQL or PostgreSQL, the fullText method may now be added to column definitions to generate full text indexes:

$table->text('bio')->fullText();

さらに、whereFullTextorWhereFullTextメソッドを使用すると、フルテキストインデックス を持つカラムのクエリに、フルテキストの"WHERE"節を追加できます。これらのメソッドは、裏で動作するデータベースシステムに適したSQLへ、Laraelが変換します。例えば、MySQLを利用するアプリケーションでは、MATCH AGAINST句を生成します。In addition, the whereFullText and orWhereFullText methods may be used to add full text "where" clauses to a query for columns that have full text indexes[/docs/{{version}}/migrations#available-index-types]. These methods will be transformed into the appropriate SQL for the underlying database system by Laravel. For example, a MATCH AGAINST clause will be generated for applications utilizing MySQL:

$users = DB::table('users')
           ->whereFullText('bio', 'web developer')
           ->get();

Laravel ScoutデータベースエンジンLaravel Scout Database Engine

Laravel Scoutデータベースエンジンは、Taylor OtwellDries Vintsが、貢献しました。The Laravel Scout database engine was contributed by Taylor Otwell[https://github.com/taylorotwell] and Dries Vints[https://github.com/driesvints].

中小規模のデータベースを操作するアプリケーションや、作業負荷が軽いアプリケーションでは、AlgoliaやMeiliSearchのような専用の検索サービスではなく、Scoutで「データベース」エンジンを利用できるようにしました。データベースエンジンは、既存のデータベースから検索結果をフィルタリングするとき、"WHERE LIKE"句と全文インデックスを使用して、クエリの検索結果を決定します。If your application interacts with small to medium sized databases or has a light workload, you may now use Scout's "database" engine instead of a dedicated search service such as Algolia or MeiliSearch. The database engine will use "where like" clauses and full text indexes when filtering results from your existing database to determine the applicable search results for your query.

Scoutデータベースエンジンの詳細は、Scoutのドキュメントを参照してください。To learn more about the Scout database engine, consult the Scout documentation[/docs/{{version}}/scout].

インラインBladeテンプレートのレンダRendering Inline Blade Templates

インラインBladeテンプレートのレンダは、Jason Beggsが貢献しました。インラインBladeコンポーネントのレンダは、Toby Zernerが貢献しました。Rendering inline Blade templates was contributed by Jason Beggs[https://github.com/jasonlbeggs]. Rendering inline Blade components was contributed by Toby Zerner[https://github.com/tobyzerner].

素のBladeテンプレート文字列を有効なHTMLへ変換する必要が起きることもあるでしょう。このような場合は、Bladeファサードが提供するrenderメソッドを使用します。renderメソッドはBladeテンプレート文字列と、テンプレートに提供するデータの配列をオプションで受け取ります。Sometimes you may need to transform a raw Blade template string into valid HTML. You may accomplish this using the render method provided by the Blade facade. The render method accepts the Blade template string and an optional array of data to provide to the template:

use Illuminate\Support\Facades\Blade;

return Blade::render('Hello, {{ $name }}', ['name' => 'Julian Bashir']);

同様に、renderComponentメソッドは、クラスコンポーネントのインスタンスをメソッドへ渡し、レンダするために使用します。Similarly, the renderComponent method may be used to render a given class component by passing the component instance to the method:

use App\View\Components\HelloComponent;

return Blade::renderComponent(new HelloComponent('Julian Bashir'));

スロット名の短期法Slot Name Shortcut

スロット名の短期法は、Caleb Porzioの貢献です。Slot name shortcuts were contributed by Caleb Porzio[https://github.com/calebporzio].

以前のLaravelリースでは、スロット名をx-slotタグのname属性で指定していました。In previous releases of Laravel, slot names were provided using a name attribute on the x-slot tag:

<x-alert>
    <x-slot name="title">
        Server Error
    </x-slot>

    <strong>Whoops!</strong> Something went wrong!
</x-alert>

しかし、Laravel9.xからは、スロットの名前を便利な短期法で指定できます。However, beginning in Laravel 9.x, you may specify the slot's name using a convenient, shorter syntax:

<x-slot:title>
    Server Error
</x-slot>

Checked / Selected Blade DirectivesChecked / Selected Blade Directives

*checkedとselected Bladeディレクティブは、Ash AllenTaylor Otwellの貢献です。Checked and selected Blade directives were contributed by Ash Allen[https://github.com/ash-jc-allen] and Taylor Otwell[https://github.com/taylorotwell].

利便が良いよう、指定したHTMLのチェックボックス入力が"checked"であることを簡単に表すため、@checkedディレクティブを使用できます。このディレクティブは、指定条件がtrueと評価された場合、checkedをechoします。For convenience, you may now use the @checked directive to easily indicate if a given HTML checkbox input is "checked". This directive will echo checked if the provided condition evaluates to true:

<input type="checkbox"
        name="active"
        value="active"
        @checked(old('active', $user->active)) />

同様に、@selectedディレクティブは、特定のセレクトオプションが"selected"であることを表すために使用します。Likewise, the @selected directive may be used to indicate if a given select option should be "selected":

<select name="version">
    @foreach ($product->versions as $version)
        <option value="{{ $version }}" @selected(old('version') == $version)>
            {{ $version }}
        </option>
    @endforeach
</select>

Bootstrap5ペジネーションビューBootstrap 5 Pagination Views

Bootstrap5ペジネーションビューは、Jared Lewisの貢献ですBootstrap 5 pagination views were contributed by Jared Lewis[https://github.com/jrd-lewis].

Laravelは、Bootstrap5を使用したペジネーションビューを用意しました。デフォルトのTailwindビューの代わりにこのビューを使うには、App\Providers\AppServiceProviderクラスのbootメソッド内で、ペジネタのuseBootstrapFiveメソッドを呼び出してください。Laravel now includes pagination views built using Bootstrap 5[https://getbootstrap.com/]. To use these views instead of the default Tailwind views, you may call the paginator's useBootstrapFive method within the boot method of your App\Providers\AppServiceProvider class:

use Illuminate\Pagination\Paginator;

/**
 * 全アプリケーションサービスの初期起動処理
 *
 * @return void
 */
public function boot()
{
    Paginator::useBootstrapFive();
}

ネストした配列データのバリデーション向上Improved Validation Of Nested Array Data

ネストした配列入力のバリデーションの向上は、Steve Baumanが貢献しました。Improved validation of nested array inputs was contributed by Steve Bauman[https://github.com/stevebauman].

バリデーションルールを属性へ割り当てるとき、ネストした配列要素の値へアクセスする必要があることがあります。このような場合には、Rule::forEachメソッドを使います。forEachメソッドは、バリデーション対象の配列属性の繰り返しごとに呼び出されるクロージャを受け取り、属性の値と完全に展開された明確な属性名を受け取ります。クロージャは、配列の要素へ割り当てるルールの配列を返す必要があります。Sometimes you may need to access the value for a given nested array element when assigning validation rules to the attribute. You may now accomplish this using the Rule::forEach method. The forEach method accepts a closure that will be invoked for each iteration of the array attribute under validation and will receive the attribute's value and explicit, fully-expanded attribute name. The closure should return an array of rules to assign to the array element:

use App\Rules\HasPermission;
use Illuminate\Support\Facades\Validator;
use Illuminate\Validation\Rule;

$validator = Validator::make($request->all(), [
    'companies.*.id' => Rule::forEach(function ($value, $attribute) {
        return [
            Rule::exists(Company::class, 'id'),
            new HasPermission('manage-company', $value),
        ];
    }),
]);

Laravel Breeze APIとNext.jsLaravel Breeze API & Next.js

Laravel Breeze APIスカフォールドとNext.jsスターターキットは、Taylor OtwellMiguel Piedrafitaの貢献です。The Laravel Breeze API scaffolding and Next.js starter kit was contributed by Taylor Otwell[https://github.com/taylorotwell] and Miguel Piedrafita[https://twitter.com/m1guelpf].

Laravel Breezeスターターキットに「API」スカフォールドモードと賞賛すべきNext.jsフロントエンド実装を追加しました。このスターターキットのスカフォールドはバックグラウンドとして動作するLaravelアプリケーションや、Laravel Sanctum認証APIのJavaScriptフロントエンドのジャンプスタートに利用できるでしょう。The Laravel Breeze[/docs/{{version}}/starter-kits#breeze-and-next] starter kit has received an "API" scaffolding mode and complimentary Next.js[https://nextjs.org] frontend implementation[https://github.com/laravel/breeze-next]. This starter kit scaffolding may be used to jump start your Laravel applications that are serving as a backend, Laravel Sanctum authenticated API for a JavaScript frontend.

Ignition例外ページの向上Improved Ignition Exception Page

Ignitionは、Spatieが開発しています。Ignition is developed by Spatie[https://spatie.be/].

Spatieが開発しているオープンソースの例外デバッグページ、Ignitionが一から設計し直されました。新しくなったIgnitionはLaravel9.xに同梱され、ライト/ダークテーマ、カスタマイズ可能な「エディタで開く」機能などが用意されました。Ignition, the open source exception debug page created by Spatie, has been redesigned from the ground up. The new, improved Ignition ships with Laravel 9.x and includes light / dark themes, customizable "open in editor" functionality, and more.

route:list CLI表示の向上Improved route:list CLI Output

route:listのCLI出力の改良は、Nuno Maduroの貢献です。Improved route:list CLI output was contributed by Nuno Maduro[https://github.com/nunomaduro].

Laravel9.xリリースでは、route:list CLI表示を大幅に改善し、ルート定義の表示の際に素晴らしいエクスペリエンスを提供します。The route:list CLI output has been significantly improved for the Laravel 9.x release, offering a beautiful new experience when exploring your route definitions.

Artisan testコマンドを使ったテストカバレージTest Coverage Using Artisan test Command

Artisan testコマンド使用のテストカバレッジは、Nuno Maduroの貢献です。Test coverage when using the Artisan test command was contributed by Nuno Maduro[https://github.com/nunomaduro].

Artisan の test コマンドに、新たに--coverageオプションを追加し、アプリケーションに用意したテストのコードカバレッジの量を調べられるようになりました。The Artisan test command has received a new --coverage option that you may use to explore the amount of code coverage your tests are providing to your application:

php artisan test --coverage

テストカバレッジの結果は、CLI出力内に直接表示しています。The test coverage results will be displayed directly within the CLI output.

さらに、満たすべき最小のテストカバレッジパーセンテージの閾値を指定する場合は、--min オプションを使用します。指定した最小閾値を満たさない場合、テストスイートは失敗します。In addition, if you would like to specify a minimum threshold that your test coverage percentage must meet, you may use the --min option. The test suite will fail if the given minimum threshold is not met:

php artisan test --coverage --min=80.3

Soketi サーバSoketi Echo Server

Soketi Echoサーバは、Alex Renokiが開発しました。The Soketi Echo server was developed by Alex Renoki[https://github.com/rennokki].

Laravel9.x専用ではありませんが、最近LaravelはNode.js用に書かれたLaravel Echo対応のWeb Socketサーバ、Soketiのドキュメント作成を支援しました。Soketiは、PusherやAblyに代わる、素晴らしいオープンソースのWeb Socketサーバを提供します。Although not exclusive to Laravel 9.x, Laravel has recently assisted with the documentation of Soketi, a Laravel Echo[/docs/{{version}}/broadcasting] compatible Web Socket server written for Node.js. Soketi provides a great, open source alternative to Pusher and Ably for those applications that prefer to manage their own Web Socket server.

Soketiの使い方は、ブロードキャストのドキュメントおよび[Soketiのドキュメント](https://docs.soketi.app/ を参照してください。For more information on using Soketi, please consult the broadcasting documentation[/docs/{{version}}/broadcasting] and Soketi documentation[https://docs.soketi.app/].

コレクションとIDEサポートの向上Improved Collections IDE Support

コレクションとIDEサポートの向上は、Nuno Maduroの貢献です。Improved collections IDE support was contributed by Nuno Maduro[https://github.com/nunomaduro].

Laravel9.xは、改良した「ジェネリック」スタイルの型定義をコレクションコンポーネントへ追加し、IDEと静的解析へのサポートを向上しました。PHPStormなどのIDEや、PHPStanなどの静的解析ツールは、Laravelコレクションをより自然に理解できるようになりました。Laravel 9.x adds improved, "generic" style type definitions to the collections component, improving IDE and static analysis support. IDEs such as PHPStorm[https://blog.jetbrains.com/phpstorm/2021/12/phpstorm-2021-3-release/#support_for_future_laravel_collections] or static analysis tools such as PHPStan[https://phpstan.org] will now better understand Laravel collections natively.

新ヘルパNew Helpers

Laravel 9.xでは、皆さん自身のアプリケーションでも使ってもらえる、便利なヘルパ関数を2つ導入しました。Laravel 9.x introduces two new, convenient helper functions that you may use in your own application.

strstr

str関数は、指定した文字列に対する新しいIlluminate\Support\Stringableインスタンスを返します。この関数は、Str::ofメソッドと等価です。The str function returns a new Illuminate\Support\Stringable instance for the given string. This function is equivalent to the Str::of method:

$string = str('Taylor')->append(' Otwell');

// 'Taylor Otwell'

str関数へ、引数を指定しなかった場合、この関数はIlluminate\Support\Strインスタンスを返します。If no argument is provided to the str function, the function returns an instance of Illuminate\Support\Str:

$snake = str()->snake('LaravelFramework');

// 'laravel_framework'

to_routeto_route

to_route関数は、指定名前付きルートへのリダイレクトHTTPレスポンスを生成し、ルートやコントローラから名前付きルートへリダイレクトするための表現力豊かな手法を提供しています。The to_route function generates a redirect HTTP response for a given named route, providing an expressive way to redirect to named routes from your routes and controllers:

return to_route('users.show', ['user' => 1]);

必要に応じ、リダイレクトへ割り当てるHTTPステータスコードと追加のレスポンスヘッダを、to_routeメソッドの第3、第4引数へ渡せます。If necessary, you may pass the HTTP status code that should be assigned to the redirect and any additional response headers as the third and fourth arguments to the to_route method:

return to_route('users.show', ['user' => 1], 302, ['X-Framework' => 'Laravel']);

章選択

設定

明暗テーマ
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!…]形式の挿入削除行の表示形式です。

テストコード表示
両コード表示
Pestのみ表示
PHPUnitのみ表示
和文変換

対象文字列と置換文字列を半角スペースで区切ってください。(最大5組各10文字まで)

本文フォント

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

コードフォント

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

保存内容リセット

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

ヘッダー項目移動

キーボード操作