影響度の高い変更High Impact Changes
- 依存パッケージの更新Updating Dependencies[#updating-dependencies]
- アプリケーション構造Application Structure[#application-structure]
- 浮動小数点タイプFloating-Point Types[#floating-point-types]
- カラムの変更Modifying Columns[#modifying-columns]
- SQLite最小バージョンSQLite Minimum Version[#sqlite-minimum-version]
- SanctumアップデートUpdating Sanctum[#updating-sanctum]
影響度が中程度の変更Medium Impact Changes
- Carbon3Carbon 3[#carbon-3]
- パスワードの再ハッシュPassword Rehashing[#password-rehashing]
- 毎秒のレート制限Per-Second Rate Limiting[#per-second-rate-limiting]
影響度の低い変更Low Impact Changes
- Doctrine DBALの削除Doctrine DBAL Removal[#doctrine-dbal-removal]
- Eloquentモデルの
casts
メソッドEloquent Modelcasts
Method[#eloquent-model-casts-method] - 空間タイプSpatial Types[#spatial-types]
- SpatieのOnceパッケージSpatie Once Package[#spatie-once-package]
Enumerable
契約TheEnumerable
Contract[#the-enumerable-contract]UserProvider
契約TheUserProvider
Contract[#the-user-provider-contract]Authenticatable
契約TheAuthenticatable
Contract[#the-authenticatable-contract]
10.xから11.xへのアップグレードUpgrading To 11.0 From 10.x
アップグレード見積もり時間:15分Estimated Upgrade Time: 15 Minutes
Laravel Shift を使用すると、アプリケーションのアップグレードを自動化できます。[!NOTE]We attempt to document every possible breaking change. Since some of these breaking changes are in obscure parts of the framework only a portion of these changes may actually affect your application. Want to save time? You can use Laravel Shift[https://laravelshift.com/] to help automate your application upgrades.
Note: 私たちは、互換性のない変更を可能な限りすべて文書化するよう努力しています。これらの互換性のない変更の一部はフレームワークの不明瞭な部分であり、こうした変更の一部が実際にあなたのアプリケーションに影響を与える可能性があります。時間を節約したいですか?
依存パッケージのアップデートUpdating Dependencies
影響の可能性: 高いLikelihood Of Impact: High
PHP8.2.0必須PHP 8.2.0 Required
Laravelは、PHP8.2.0以上が必要になりました。Laravel now requires PHP 8.2.0 or greater.
curl7.34.0必須curl 7.34.0 Required
LaravelのHTTPクライアントは、curl7.34.0以上が必要になりました。Laravel's HTTP client now requires curl 7.34.0 or greater.
Composerの依存パッケージComposer Dependencies
アプリケーションのcomposer.json
ファイルにある、以下の依存パッケージを更新してください。You
should
update
the
following
dependencies
in
your
application's
composer.json
file:
laravel/framework
を^11.0
へlaravel/framework
to^11.0
nunomaduro/collision
を^8.1
へnunomaduro/collision
to^8.1
laravel/breeze
を^2.0
へ(インストール済みの場合)laravel/breeze
to^2.0
(If installed)laravel/cashier
を^15.0
へ(インストール済みの場合)laravel/cashier
to^15.0
(If installed)laravel/dusk
を^8.0
へ(インストール済みの場合)laravel/dusk
to^8.0
(If installed)laravel/jetstream
を^5.0
へ(インストール済みの場合)laravel/jetstream
to^5.0
(If installed)laravel/octane
を^2.3
へ(インストール済みの場合)laravel/octane
to^2.3
(If installed)laravel/passport
を^12.0
へ(インストール済みの場合)laravel/passport
to^12.0
(If installed)laravel/sanctum
を^4.0
へ(インストール済みの場合)laravel/sanctum
to^4.0
(If installed)laravel/spark-stripe
を^5.0
へ(インストール済みの場合)laravel/spark-stripe
to^5.0
(If installed)laravel/telescope
を^5.0
へ(インストール済みの場合)laravel/telescope
to^5.0
(If installed)inertiajs/inertia-laravel
を^1.0
へ(インストール済みの場合)inertiajs/inertia-laravel
to^1.0
(If installed)
アプリケーションがLaravel Cashier Stripe、Passport、Sanctum、Spark Stripe、Telescopeを使用している場合、それらのマイグレーションをアプリケーションへリソース公開する必要があります。Cashier Stripe、Passport、Sanctum、Spark Stripe、Telescopeは、それ自体のマイグレーションディレクトリから自動的にマイグレーションをロードしなくなりました。そのため、以下のコマンドを実行して、アプリケーションへマイグレーションをリソース公開する必要があります。If your application is using Laravel Cashier Stripe, Passport, Sanctum, Spark Stripe, or Telescope, you will need to publish their migrations to your application. Cashier Stripe, Passport, Sanctum, Spark Stripe, and Telescope no longer automatically load migrations from their own migrations directory. Therefore, you should run the following command to publish their migrations to your application:
php artisan vendor:publish --tag=cashier-migrations
php artisan vendor:publish --tag=passport-migrations
php artisan vendor:publish --tag=sanctum-migrations
php artisan vendor:publish --tag=spark-migrations
php artisan vendor:publish --tag=telescope-migrations
さらに、これらの各パッケージのアップグレードガイドを確認して、追加の変更点を確実に把握してください。In addition, you should review the upgrade guides for each of these packages to ensure you are aware of any additional breaking changes:
- Laravel Cashier StripeLaravel Cashier Stripe[#cashier-stripe]
- Laravel PassportLaravel Passport[#passport]
- Laravel SanctumLaravel Sanctum[#sanctum]
- Laravel Spark StripeLaravel Spark Stripe[#spark-stripe]
- Laravel TelescopeLaravel Telescope[#telescope]
Laravelインストーラを自分でインストールした場合は、Composer経由でインストーラを更新してください:If you have manually installed the Laravel installer, you should update the installer via Composer:
composer global require laravel/installer:^5.6
最後に、Laravelがこのパッケージに依存しなくなったので、doctrine/dbal
Composer依存パッケージを削除してください。Finally,
you
may
remove
the
doctrine/dbal
Composer
dependency
if
you
have
previously
added
it
to
your
application,
as
Laravel
is
no
longer
dependent
on
this
package.
アプリケーション構造Application Structure
Laravel11では、新しいデフォルトのアプリケーション構造が導入され、デフォルトのファイルが少なくなっています。つまり、新しいLaravelアプリケーションには、サービスプロバイダ、ミドルウェア、設定ファイルの数が少なくなっています。Laravel 11 introduces a new default application structure with fewer default files. Namely, new Laravel applications contain fewer service providers, middleware, and configuration files.
しかし、Laravel10アプリケーションをLaravel11にアップグレードするときに、アプリケーション構造の移行を試みることはお勧めしません。Laravel11はLaravel10のアプリケーション構造もサポートするように注意深く調整してあります。However, we do not recommend that Laravel 10 applications upgrading to Laravel 11 attempt to migrate their application structure, as Laravel 11 has been carefully tuned to also support the Laravel 10 application structure.
認証Authentication
パスワードの再ハッシュPassword Rehashing
Laravel11は、パスワードが最後にハッシュ化されてからハッシュ化アルゴリズムの「ストレッチング(work factor)」が更新された場合、認証時にユーザーのパスワードを自動的に再ハッシュ化します。Laravel 11 will automatically rehash your user's passwords during authentication if your hashing algorithm's "work factor" has been updated since the password was last hashed.
通常、これによってアプリケーションが中断されることはありませんが、アプリケーションのconfig/hashing.php
構成ファイルにrehash_on_login
オプションを追加と、この動作を無効にできます。Typically,
this
should
not
disrupt
your
application;
however,
you
may
disable
this
behavior
by
adding
the
rehash_on_login
option
to
your
application's
config/hashing.php
configuration
file:
'rehash_on_login' => false,
UserProvider
契約The
UserProvider
Contract
影響の可能性: 低いLikelihood Of Impact: Low
Illuminate\Contracts\Auth\UserProvider
に新しいrehashPasswordIfRequired
メソッドを追加しました。このメソッドは、アプリケーションのハッシュアルゴリズムのワークファクタが変更されたときに、ユーザーのパスワードを再ハッシュしてストレージに保存する役割を担っています。The
Illuminate\Contracts\Auth\UserProvider
contract
has
received
a
new
rehashPasswordIfRequired
method.
This
method
is
responsible
for
re-hashing
and
storing
the
user's
password
in
storage
when
the
application's
hashing
algorithm
work
factor
has
changed.
アプリケーションやパッケージがこのインタフェースを実装するクラスを定義している場合、新しいrehashPasswordIfRequired
メソッドを追加で実装する必要があります。参照になる実装は、Illuminate\Auth\EloquentUserProvider
クラス内にあります。If
your
application
or
package
defines
a
class
that
implements
this
interface,
you
should
add
the
new
rehashPasswordIfRequired
method
to
your
implementation.
A
reference
implementation
can
be
found
within
the
Illuminate\Auth\EloquentUserProvider
class:
public function rehashPasswordIfRequired(Authenticatable $user, array $credentials, bool $force = false);
Authenticatable
契約The
Authenticatable
Contract
影響の可能性: 低いLikelihood Of Impact: Low
Illuminate\Contracts\Auth\Authenticatable
契約に、新しくgetAuthPasswordName
メソッドを追加しました。このメソッドは、認証可能エンティティのパスワードカラムの名前を返す役割を負っています。The
Illuminate\Contracts\Auth\Authenticatable
contract
has
received
a
new
getAuthPasswordName
method.
This
method
is
responsible
for
returning
the
name
of
your
authenticatable
entity's
password
column.
アプリケーションやパッケージがこのインターフェイスを実装したクラスを定義している場合は、新しい
getAuthPasswordName
メソッドを実装に追加する必要があります:If
your
application
or
package
defines
a
class
that
implements
this
interface,
you
should
add
the
new
getAuthPasswordName
method
to
your
implementation:
public function getAuthPasswordName()
{
return 'password';
}
Laravelに含まれるデフォルトのUser
モデルでは、このメソッドがIlluminate\Auth\Authenticatable
トレイトに含まれているため、自動的にこのメソッドを受け取ります。The
default
User
model
included
with
Laravel
receives
this
method
automatically
since
the
method
is
included
within
the
Illuminate\Auth\Authenticatable
trait.
AuthenticationException
クラスThe
AuthenticationException
Class
影響の可能性: かなり低いLikelihood Of Impact: Very Low
Illuminate\Auth\AuthenticationException
クラスのredirectTo
メソッドは、最初の引数にIlluminate\Http\Request
インスタンスが必要になりました。この例外を手作業でキャッチし、redirectTo
メソッドを呼び出している場合は、それに応じてコードを更新してください。The
redirectTo
method
of
the
Illuminate\Auth\AuthenticationException
class
now
requires
an
Illuminate\Http\Request
instance
as
its
first
argument.
If
you
are
manually
catching
this
exception
and
calling
the
redirectTo
method,
you
should
update
your
code
accordingly:
if ($e instanceof AuthenticationException) {
$path = $e->redirectTo($request);
}
キャッシュCache
Cache Key PrefixesCache Key Prefixes
影響の可能性: かなり低いLikelihood Of Impact: Very Low
以前は、DynamoDB、Memcached、Redisのキャッシュストアで、キャッシュキーの接頭辞を定義した場合、Laravelは接頭辞へ:
を追加していました。Laravel11では、キャッシュキーの接頭辞へ:
を追加しなくなりました。以前の接頭辞動作を維持したい場合は、キャッシュキーの接頭辞の最後に手作業で:
を追加してください。Previously,
if
a
cache
key
prefix
was
defined
for
the
DynamoDB,
Memcached,
or
Redis
cache
stores,
Laravel
would
append
a
:
to
the
prefix.
In
Laravel
11,
the
cache
key
prefix
does
not
receive
the
:
suffix.
If
you
would
like
to
maintain
the
previous
prefixing
behavior,
you
can
manually
add
the
:
suffix
to
your
cache
key
prefix.
コレクションCollections
Enumerable
契約The
Enumerable
Contract
影響の可能性: 低いLikelihood Of Impact: Low
Illuminate\Support\Enumerable
契約のdump
メソッドを更新し、...$args
可変長引数を取るようにしました。このインタフェースを実装している場合は、これに合わせて実装を更新する必要があります。The
dump
method
of
the
Illuminate\Support\Enumerable
contract
has
been
updated
to
accept
a
variadic
...$args
argument.
If
you
are
implementing
this
interface
you
should
update
your
implementation
accordingly:
public function dump(...$args);
データベースDatabase
SQLite 3.35.0 SQLite 3.35.0
影響の可能性: 高いLikelihood Of Impact: High
アプリケーションでSQLiteデータベースを使用する場合は、SQLite3.35.0以上が必要です。If your application is utilizing an SQLite database, SQLite 3.35.0 or greater is required.
Eloquentモデルのcasts
メソッドEloquent
Model
casts
Method
影響の可能性: 低いLikelihood Of Impact: Low
Eloquentモデルのベースクラスは、属性キャストの定義をサポートするため、casts
メソッドを定義するようになりました。もし、アプリケーションのモデルでcasts
リレーションを定義している場合、Eloquentベースモデルクラスのcasts
メソッドと衝突する可能性があります。The
base
Eloquent
model
class
now
defines
a
casts
method
in
order
to
support
the
definition
of
attribute
casts.
If
one
of
your
application's
models
is
defining
a
casts
relationship,
it
may
conflict
with
the
casts
method
now
present
on
the
base
Eloquent
model
class.
カラムの変更Modifying Columns
影響の可能性: 高いLikelihood Of Impact: High
カラムを変更する場合、変更後もカラム定義を維持したいすべての修飾子を明示的に含める必要があります。足りない属性は削除されます。例えば、unsigned
属性、default
属性、comment
属性を保持するためには、カラムを変更する際にそれぞれの修飾子を明示的に呼び出す必要があります。When
modifying
a
column,
you
must
now
explicitly
include
all
the
modifiers
you
want
to
keep
on
the
column
definition
after
it
is
changed.
Any
missing
attributes
will
be
dropped.
For
example,
to
retain
the
unsigned
,
default
,
and
comment
attributes,
you
must
call
each
modifier
explicitly
when
changing
the
column,
even
if
those
attributes
have
been
assigned
to
the
column
by
a
previous
migration.
例えば、unsigned
、default
、comment
属性を持つ
votes
カラムを作成するマイグレーションがあるとします。For
example,
imagine
you
have
a
migration
that
creates
a
votes
column
with
the
unsigned
,
default
,
and
comment
attributes:
Schema::create('users', function (Blueprint $table) {
$table->integer('votes')->unsigned()->default(1)->comment('The vote count');
});
その後で、カラムをnullable
に変更するマイグレーションを書いてみましょう。Later,
you
write
a
migration
that
changes
the
column
to
be
nullable
as
well:
Schema::table('users', function (Blueprint $table) {
$table->integer('votes')->nullable()->change();
});
Laravel10では、このマイグレーションはカラムのunsigned
、default
、comment
属性を保持していました。しかし、Laravel11からマイグレーションにはカラムに以前定義していた属性もすべて含める必要があります。含めなければ、それらを削除します。In
Laravel
10,
this
migration
would
retain
the
unsigned
,
default
,
and
comment
attributes
on
the
column.
However,
in
Laravel
11,
the
migration
must
now
also
include
all
of
the
attributes
that
were
previously
defined
on
the
column.
Otherwise,
they
will
be
dropped:
Schema::table('users', function (Blueprint $table) {
$table->integer('votes')
->unsigned()
->default(1)
->comment('The vote count')
->nullable()
->change();
});
change
メソッドはカラムのインデックスを変更しません。そのため、カラムを変更する際には、インデックス修飾子を使って明示的にインデックスを追加したり削除したりしてください。The
change
method
does
not
change
the
indexes
of
the
column.
Therefore,
you
may
use
index
modifiers
to
explicitly
add
or
drop
an
index
when
modifying
the
column:
// インデックス追加
$table->bigIncrements('id')->primary()->change();
// インデックス削除
$table->char('postal_code', 10)->unique(false)->change();
既存カラムの属性を保持するために、アプリケーション内の既存の全「変更(change)」マイグレーションを更新したくない場合は、単純にマイグレーションを圧縮してください。If you do not want to update all of the existing "change" migrations in your application to retain the column's existing attributes, you may simply squash your migrations[/docs/{{version}}/migrations#squashing-migrations]:
php artisan schema:dump
一度マイグレーション圧縮したら、Laravelは保留中のマイグレーションを実行する前に、アプリケーションのスキーマファイルを使ってデータベースを「マイグレーション」します。Once your migrations have been squashed, Laravel will "migrate" the database using your application's schema file before running any pending migrations.
浮動小数点タイプFloating-Point Types
影響の可能性: 高いLikelihood Of Impact: High
double
とfloat
のマイグレーションカラム型は、すべてのデータベースで一貫性があるように書き直された。The
double
and
float
migration
column
types
have
been
rewritten
to
be
consistent
across
all
databases.
double
カラムタイプは、合計桁数と桁数(小数点以下の桁数)
を含まない、DOUBLE
と同等のカラムを作成するようになりました。そのため、$total
と$places
の引数を削除してください。The
double
column
type
now
creates
a
DOUBLE
equivalent
column
without
total
digits
and
places
(digits
after
decimal
point),
which
is
the
standard
SQL
syntax.
Therefore,
you
may
remove
the
arguments
for
$total
and
$places
:
$table->double('amount');
float
カラム型は、合計桁数と桁数(小数点以下の桁数)のないFLOAT
相当の列を作成するようになりましたが、格納サイズを4バイトの単精度列または8バイトの倍精度列として決定するためのオプションの$precision
指定があります。したがって、$total
と$places
の引数を削除し、オプションの$precision
をデータベースのドキュメントに従って目的の値に指定することができます。The
float
column
type
now
creates
a
FLOAT
equivalent
column
without
total
digits
and
places
(digits
after
decimal
point),
but
with
an
optional
$precision
specification
to
determine
storage
size
as
a
4-byte
single-precision
column
or
an
8-byte
double-precision
column.
Therefore,
you
may
remove
the
arguments
for
$total
and
$places
and
specify
the
optional
$precision
to
your
desired
value
and
according
to
your
database's
documentation:
$table->float('amount', precision: 53);
unsignedDecimal
、unsignedDouble
、unsignedFloat
メソッドは削除しました。これは、これらのカラム型のunsigned修飾子がMySQLによって廃止され、他のデータベースシステムでは標準化されなかったからです。ただし、これらのカラム型に対して廃止されたunsigned属性を引き続き使用する場合は、unsigned
メソッドをカラムの定義にチェーンできます。The
unsignedDecimal
,
unsignedDouble
,
and
unsignedFloat
methods
have
been
removed,
as
the
unsigned
modifier
for
these
column
types
has
been
deprecated
by
MySQL,
and
was
never
standardized
on
other
database
systems.
However,
if
you
wish
to
continue
using
the
deprecated
unsigned
attribute
for
these
column
types,
you
may
chain
the
unsigned
method
onto
the
column's
definition:
$table->decimal('amount', total: 8, places: 2)->unsigned();
$table->double('amount')->unsigned();
$table->float('amount', precision: 53)->unsigned();
MariaDB専用ドライバDedicated MariaDB Driver
影響の可能性: かなり低いLikelihood Of Impact: Very Low
Laravel11では、MariaDBデータベースに接続する際、常にMySQLドライバを利用しなくなり、MariaDB専用のデータベースドライバを追加しました。Instead of always utilizing the MySQL driver when connecting to MariaDB databases, Laravel 11 adds a dedicated database driver for MariaDB.
アプリケーションがMariaDBデータベースへ接続する場合、将来のMariaDB固有の機能を利用するために、接続設定を新しいmariadb
ドライバへ更新することができます。If
your
application
connects
to
a
MariaDB
database,
you
may
update
the
connection
configuration
to
the
new
mariadb
driver
to
benefit
from
MariaDB
specific
features
in
the
future:
'driver' => 'mariadb',
'url' => env('DB_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
// ...
現在のところ、新しいMariaDBドライバは現在のMySQLドライバと同じように動作しますが、一つだけ例外があります。それは、uuid
スキーマビルダメソッドは、char(36)
カラムの代わりに、ネイティブのUUIDカラムを作成することです。Currently,
the
new
MariaDB
driver
behaves
like
the
current
MySQL
driver
with
one
exception:
the
uuid
schema
builder
method
creates
native
UUID
columns
instead
of
char(36)
columns.
既存のマイグレーションが、uuid
スキーマビルダメソッドを使用していて、新しいmariadb
データベースドライバを使用する場合は、マイグレーションのuuid
メソッドの呼び出しをchar
に更新して、ブレイキングチェンジや想定外の振る舞いを防いでください。If
your
existing
migrations
utilize
the
uuid
schema
builder
method
and
you
choose
to
use
the
new
mariadb
database
driver,
you
should
update
your
migration's
invocations
of
the
uuid
method
to
char
to
avoid
breaking
changes
or
unexpected
behavior:
Schema::table('users', function (Blueprint $table) {
$table->char('uuid', 36);
// ...
});
空間タイプSpatial Types
影響の可能性: 低いLikelihood Of Impact: Low
データベースマイグレーションの空間カラムタイプは、すべてのデータベースに渡り一貫性があるように書き換えました。そのため、point
,lineString
,polygon
,geometryCollection
,multiPoint
,multiLineString
,multiPolygon
,multiPolygonZ
メソッドをマイグレーションから削除し、代わりにgeometry
またはgeography
メソッドを使用してください。The
spatial
column
types
of
database
migrations
have
been
rewritten
to
be
consistent
across
all
databases.
Therefore,
you
may
remove
point
,
lineString
,
polygon
,
geometryCollection
,
multiPoint
,
multiLineString
,
multiPolygon
,
and
multiPolygonZ
methods
from
your
migrations
and
use
geometry
or
geography
methods
instead:
$table->geometry('shapes');
$table->geography('coordinates');
MySQL、MariaDB、PostgreSQLのカラムに格納する値の型や空間参照システムの識別子を明示的に制限するには、subtype
とsrid
をメソッドへ渡します。To
explicitly
restrict
the
type
or
the
spatial
reference
system
identifier
for
values
stored
in
the
column
on
MySQL,
MariaDB,
and
PostgreSQL,
you
may
pass
the
subtype
and
srid
to
the
method:
$table->geometry('dimension', subtype: 'polygon', srid: 0);
$table->geography('latitude', subtype: 'point', srid: 4326);
これに伴い、PostgreSQL文法のisGeometry
としました。projection
カラム修飾子を削除しました。The
isGeometry
and
projection
column
modifiers
of
the
PostgreSQL
grammar
have
been
removed
accordingly.
Doctrine DBALの削除Doctrine DBAL Removal
影響の可能性: 低いLikelihood Of Impact: Low
以下のリスト中のDoctrine DBAL関連のクラスとメソッドを削除しました。Laravelはこのパッケージに依存しなくなり、以前はカスタム型を必要としていたさまざまなカラム型の適切な作成と変更のために、Doctrineのカスタム型を登録する必要はなくなりました。The following list of Doctrine DBAL related classes and methods have been removed. Laravel is no longer dependent on this package and registering custom Doctrines types is no longer necessary for the proper creation and alteration of various column types that previously required custom types:
Illuminate\Database\Schema\Builder::$alwaysUsesNativeSchemaOperationsIfPossible
class propertyIlluminate\Database\Schema\Builder::$alwaysUsesNativeSchemaOperationsIfPossible
class propertyIlluminate\Database\Schema\Builder::useNativeSchemaOperationsIfPossible()
methodIlluminate\Database\Schema\Builder::useNativeSchemaOperationsIfPossible()
methodIlluminate\Database\Connection::usingNativeSchemaOperations()
methodIlluminate\Database\Connection::usingNativeSchemaOperations()
methodIlluminate\Database\Connection::isDoctrineAvailable()
methodIlluminate\Database\Connection::isDoctrineAvailable()
methodIlluminate\Database\Connection::getDoctrineConnection()
methodIlluminate\Database\Connection::getDoctrineConnection()
methodIlluminate\Database\Connection::getDoctrineSchemaManager()
methodIlluminate\Database\Connection::getDoctrineSchemaManager()
methodIlluminate\Database\Connection::getDoctrineColumn()
methodIlluminate\Database\Connection::getDoctrineColumn()
methodIlluminate\Database\Connection::registerDoctrineType()
methodIlluminate\Database\Connection::registerDoctrineType()
methodIlluminate\Database\DatabaseManager::registerDoctrineType()
methodIlluminate\Database\DatabaseManager::registerDoctrineType()
methodIlluminate\Database\PDO
directoryIlluminate\Database\PDO
directoryIlluminate\Database\DBAL\TimestampType
classIlluminate\Database\DBAL\TimestampType
classIlluminate\Database\Schema\Grammars\ChangeColumn
classIlluminate\Database\Schema\Grammars\ChangeColumn
classIlluminate\Database\Schema\Grammars\RenameColumn
classIlluminate\Database\Schema\Grammars\RenameColumn
classIlluminate\Database\Schema\Grammars\Grammar::getDoctrineTableDiff()
methodIlluminate\Database\Schema\Grammars\Grammar::getDoctrineTableDiff()
method
さらに、アプリケーションのdatabase
設定ファイルで
dbal.types
を使い、カスタムDoctrineの型を登録する必要はなくなりました。In
addition,
registering
custom
Doctrine
types
via
dbal.types
in
your
application's
database
configuration
file
is
no
longer
required.
Doctrine
DBALを使ってデータベースと関連テーブルを調べていたのであれば、代わりに
Laravelの新しいネイティブスキーマメソッド
(Schema::getTables()
、Schema::getColumns()
、Schema::getIndexes()
、Schema::getForeignKeys()
など)
を使用してください。If
you
were
previously
using
Doctrine
DBAL
to
inspect
your
database
and
its
associated
tables,
you
may
use
Laravel's
new
native
schema
methods
(Schema::getTables()
,
Schema::getColumns()
,
Schema::getIndexes()
,
Schema::getForeignKeys()
,
etc.)
instead.
非推奨のスキマメソッドDeprecated Schema Methods
影響の可能性: かなり低いLikelihood Of Impact: Very Low
Doctrineベースの非推奨であったSchema::getAllTables()
、Schema::getAllViews()
、Schema::getAllTypes()
メソッドを削除し、新しいLaravelネイティブのSchema::getTables()
、Schema::getViews()
、Schema::getTypes()
メソッドを使ってください。The
deprecated,
Doctrine
based
Schema::getAllTables()
,
Schema::getAllViews()
,
and
Schema::getAllTypes()
methods
have
been
removed
in
favor
of
new
Laravel
native
Schema::getTables()
,
Schema::getViews()
,
and
Schema::getTypes()
methods.
PostgreSQLとSQLServerを使用する場合、新しいスキーマメソッドはどれも3つの部分からなる参照(例えば
database.schema.table
)を受け付けません。したがって、代わりにconnection()
を使用してデータベースを宣言する必要があります。When
using
PostgreSQL
and
SQL
Server,
none
of
the
new
schema
methods
will
accept
a
three-part
reference
(e.g.
database.schema.table
).
Therefore,
you
should
use
connection()
to
declare
the
database
instead:
Schema::connection('database')->hasTable('schema.table');
スキマビルダのgetColumnType()
メソッドSchema
Builder
getColumnType()
Method
影響の可能性: かなり低いLikelihood Of Impact: Very Low
Schema::getColumnType()
メソッドは、Doctrine
DBALと同等の型ではなく、常に指定カラムの実際の型を返すようになった。The
Schema::getColumnType()
method
now
always
returns
actual
type
of
the
given
column,
not
the
Doctrine
DBAL
equivalent
type.
データベース接続インターフェイスDatabase Connection Interface
影響の可能性: かなり低いLikelihood Of Impact: Very Low
Illuminate\Database\ConnectionInterface
インターフェイスに、新しいscalar
メソッドを追加しました。このインターフェイスの独自の実装を定義している場合は、scalar
メソッドを実装に追加する必要があります。The
Illuminate\Database\ConnectionInterface
interface
has
received
a
new
scalar
method.
If
you
are
defining
your
own
implementation
of
this
interface,
you
should
add
the
scalar
method
to
your
implementation:
public function scalar($query, $bindings = [], $useReadPdo = true);
日付Dates
Carbon3Carbon 3
影響の可能性: 中程度Likelihood Of Impact: Medium
Laravel11はCarbon2とCarbon3の両方をサポートしています。Carbonは、Laravelやエコシステム全体のパッケージで広く利用されている日付操作ライブラリです。Carbon3をインストールする場合は、Carbonの変更ログを確認してください。Laravel 11 supports both Carbon 2 and Carbon 3. Carbon is a date manipulation library utilized extensively by Laravel and packages throughout the ecosystem. If you install Carbon 3, you should review Carbon's change log[https://github.com/briannesbitt/Carbon/releases/tag/3.0.0].
メールMail
Mailer
契約The
Mailer
Contract
影響の可能性: かなり低いLikelihood Of Impact: Very Low
Illuminate\Contracts\Mail\Mailer
契約に新しいsendNow
メソッドを追加しました。この契約を実装しているアプリケーションやパッケージは、新しくsendNow
メソッドを実装に追加してください。The
Illuminate\Contracts\Mail\Mailer
contract
has
received
a
new
sendNow
method.
If
your
application
or
package
is
manually
implementing
this
contract,
you
should
add
the
new
sendNow
method
to
your
implementation:
public function sendNow($mailable, array $data = [], $callback = null);
パッケージPackages
アプリケーションへのサービスプロバイダのリソース公開Publishing Service Providers to the Application
影響の可能性: かなり低いLikelihood Of Impact: Very Low
アプリケーションのapp/Providers
ディレクトリに手作業でサービスプロバイダをリソース公開し、アプリケーションのconfig/app.php
設定ファイルを手作業で修正してサービスプロバイダを登録していたLaravelパッケージを書いていた場合、新しいServiceProvider::addProviderToBootstrapFile
メソッドを利用するように、パッケージを更新する必要があります。If
you
have
written
a
Laravel
package
that
manually
publishes
a
service
provider
to
the
application's
app/Providers
directory
and
manually
modifies
the
application's
config/app.php
configuration
file
to
register
the
service
provider,
you
should
update
your
package
to
utilize
the
new
ServiceProvider::addProviderToBootstrapFile
method.
新しい
Laravel11アプリケーションでは、config/app.php
設定ファイル内にproviders
配列が存在しないため、addProviderToBootstrapFile
メソッドは、リソース公開したサービスプロバイダを自動的にアプリケーションのbootstrap/providers.php
ファイルへ追加します。The
addProviderToBootstrapFile
method
will
automatically
add
the
service
provider
you
have
published
to
the
application's
bootstrap/providers.php
file,
since
the
providers
array
does
not
exist
within
the
config/app.php
configuration
file
in
new
Laravel
11
applications.
use Illuminate\Support\ServiceProvider;
ServiceProvider::addProviderToBootstrapFile(Provider::class);
キューQueues
BatchRepository
インターフェイスThe
BatchRepository
Interface
影響の可能性: かなり低いLikelihood Of Impact: Very Low
Illuminate\Bus\BatchRepository
インターフェイスに新しいrollBack
メソッドを追加しました。自分のパッケージやアプリケーションでこのインタフェースを実装している場合、このメソッドを実装に追加する必要があります。The
Illuminate\Bus\BatchRepository
interface
has
received
a
new
rollBack
method.
If
you
are
implementing
this
interface
within
your
own
package
or
application,
you
should
add
this
method
to
your
implementation:
public function rollBack();
データベーストランザクション中の同期ジョブSynchronous Jobs in Database Transactions
影響の可能性: かなり低いLikelihood Of Impact: Very Low
以前は、キュー接続のafter_commit
設定オプションがtrue
に設定されているか、ジョブに対してafterCommit
メソッドが呼び出されているかに関係なく、同期ジョブ
(sync
キュードライバを使用するジョブ)すぐを即時に実行していました。Previously,
synchronous
jobs
(jobs
using
the
sync
queue
driver)
would
execute
immediately,
regardless
of
whether
the
after_commit
configuration
option
of
the
queue
connection
was
set
to
true
or
the
afterCommit
method
was
invoked
on
the
job.
Laravel11では、同期キュージョブはキュー接続やジョブの「コミット後(after commit)」設定を尊重するようにしました。In Laravel 11, synchronous queue jobs will now respect the "after commit" configuration of the queue connection or job.
レート制限Rate Limiting
毎秒のレート制限Per-Second Rate Limiting
影響の可能性: 中程度Likelihood Of Impact: Medium
Laravel11では、これまで分単位のレート制限をサポートしていましたが、秒単位になりました。この変更に関連して、様々な潜在的なブレイキングチェンジに注意する必要があります。Laravel 11 supports per-second rate limiting instead of being limited to per-minute granularity. There are a variety of potential breaking changes you should be aware of related to this change.
GlobalLimit
クラスのコンストラクタは、分単位の代わりに秒単位で引数を取るようにしました。このクラスはドキュメント化しておらず、通常アプリケーションで使用されることはないでしょう。The
GlobalLimit
class
constructor
now
accepts
seconds
instead
of
minutes.
This
class
is
not
documented
and
would
not
typically
be
used
by
your
application:
new GlobalLimit($attempts, 2 * 60);
Limit
クラスのコンストラクタは、分単位ではなく秒単位で指定できるようにしました。このクラスの使用法はすべてLimit::perMinute
やLimit::perSecond
などの静的コンストラクタに限定しています。しかし、このクラスを手作業でインスタンス化する場合は、このクラスのコンストラクタへ秒を指定するようにアプリケーションを更新する必要があります。The
Limit
class
constructor
now
accepts
seconds
instead
of
minutes.
All
documented
usages
of
this
class
are
limited
to
static
constructors
such
as
Limit::perMinute
and
Limit::perSecond
.
However,
if
you
are
instantiating
this
class
manually,
you
should
update
your
application
to
provide
seconds
to
the
class's
constructor:
new Limit($key, $attempts, 2 * 60);
Limit
クラスのdecayMinutes
プロパティの名前をdecaySeconds
へ変更し、分単位ではなく秒単位になりました。The
Limit
class's
decayMinutes
property
has
been
renamed
to
decaySeconds
and
now
contains
seconds
instead
of
minutes.
Illuminate\Queue\Middleware\ThrottlesExceptions
とIlluminate\Queue\Middleware\ThrottlesExceptionsWithRedis
クラスのコンストラクタが、分単位ではなく秒単位で受け付けるようにしました。The
Illuminate\Queue\Middleware\ThrottlesExceptions
and
Illuminate\Queue\Middleware\ThrottlesExceptionsWithRedis
class
constructors
now
accept
seconds
instead
of
minutes:
new ThrottlesExceptions($attempts, 2 * 60);
new ThrottlesExceptionsWithRedis($attempts, 2 * 60);
Cashier StripeCashier Stripe
Cashier StripeのアップデートUpdating Cashier Stripe
影響の可能性: 高いLikelihood Of Impact: High
Laravel11はCashier
Stripe14.xをサポートしなくなりました。そのため、composer.json
ファイルでアプリケーションのLaravel
Cashier
Stripeパッケージ依存関係を^15.0
へ更新する必要があります。Laravel
11
no
longer
supports
Cashier
Stripe
14.x.
Therefore,
you
should
update
your
application's
Laravel
Cashier
Stripe
dependency
to
^15.0
in
your
composer.json
file.
Cashier Stripe15.0では、migrationディレクトリからマイグレーションを自動的にロードしなくなりました。代わりに、以下のコマンドを実行してCashier Stripeのマイグレーションをアプリケーションへリソース公開する必要があります。Cashier Stripe 15.0 no longer automatically loads migrations from its own migrations directory. Instead, you should run the following command to publish Cashier Stripe's migrations to your application:
php artisan vendor:publish --tag=cashier-migrations
その他の変更点については、Cashier Stripeアップグレードガイドを確認してください。Please review the complete Cashier Stripe upgrade guide[https://github.com/laravel/cashier-stripe/blob/15.x/UPGRADE.md] for additional breaking changes.
Spark (Stripe)Spark (Stripe)
Spark StripeアップデートUpdating Spark Stripe
影響の可能性: 高いLikelihood Of Impact: High
Laravel11はLaravel
Spark
Stripe4.xをサポートしなくなったため、composer.json
ファイルでアプリケーションのLaravel
Spark
Stripeパッケージ依存関係を^5.0
へ更新する必要があります。Laravel
11
no
longer
supports
Laravel
Spark
Stripe
4.x.
Therefore,
you
should
update
your
application's
Laravel
Spark
Stripe
dependency
to
^5.0
in
your
composer.json
file.
Spark Stripe5.0では、migrationsディレクトリからマイグレーションを自動的にロードしなくなりました。代わりに、以下のコマンドを実行してSpark Stripeのマイグレーションをアプリケーションへリソース公開する必要があります:Spark Stripe 5.0 no longer automatically loads migrations from its own migrations directory. Instead, you should run the following command to publish Spark Stripe's migrations to your application:
php artisan vendor:publish --tag=spark-migrations
その他の変更点については、Spark Stripeアップグレードガイドをご覧ください。Please review the complete Spark Stripe upgrade guide[https://spark.laravel.com/docs/spark-stripe/upgrade.html] for additional breaking changes.
PassportPassport
PassportアップデートUpdating Passport
影響の可能性: 高いLikelihood Of Impact: High
Laravel11はLaravel
Passport11.xをサポートしなくなったため、composer.json
ファイルでアプリケーションのLaravel
Passportパッケージ依存関係を^12.0
へ更新する必要があります。Laravel
11
no
longer
supports
Laravel
Passport
11.x.
Therefore,
you
should
update
your
application's
Laravel
Passport
dependency
to
^12.0
in
your
composer.json
file.
Passport12.0では、自身のmigrationsディレクトリからマイグレーションを自動的にロードしなくなりました。代わりに、以下のコマンドを実行して、Passportのマイグレーションをアプリケーションへリソース公開する必要があります:Passport 12.0 no longer automatically loads migrations from its own migrations directory. Instead, you should run the following command to publish Passport's migrations to your application:
php artisan vendor:publish --tag=passport-migrations
さらに、パスワードグラントタイプはデフォルトで無効にしてあります。有効にするには、アプリケーションの
AppServiceProvider
のboot
メソッドでenablePasswordGrant
メソッドを呼び出してください。In
addition,
the
password
grant
type
is
disabled
by
default.
You
may
enable
it
by
invoking
the
enablePasswordGrant
method
in
the
boot
method
of
your
application's
AppServiceProvider
:
public function boot(): void
{
Passport::enablePasswordGrant();
}
SanctumSanctum
SanctumアップデートUpdating Sanctum
影響の可能性: 高いLikelihood Of Impact: High
Laravel11はLaravel
Sanctum3.xをサポートしなくなったため、composer.json
ファイルでアプリケーションのLaravel
Sanctumパッケージ依存関係を^4.0
へ更新する必要があります。Laravel
11
no
longer
supports
Laravel
Sanctum
3.x.
Therefore,
you
should
update
your
application's
Laravel
Sanctum
dependency
to
^4.0
in
your
composer.json
file.
Sanctum 4.0は migrationsディレクトリから自動的にマイグレーションをロードしなくなりました。代わりに、次のコマンドを実行してSanctumのマイグレーションをアプリケーションへリソース公開する必要があります。Sanctum 4.0 no longer automatically loads migrations from its own migrations directory. Instead, you should run the following command to publish Sanctum's migrations to your application:
php artisan vendor:publish --tag=sanctum-migrations
次に、アプリケーションのconfig/sanctum.php
設定ファイルで、authenticate_session
,
encrypt_cookies
,
validate_csrf_token
ミドルウェアへの参照を以下のように更新してください。Then,
in
your
application's
config/sanctum.php
configuration
file,
you
should
update
the
references
to
the
authenticate_session
,
encrypt_cookies
,
and
validate_csrf_token
middleware
to
the
following:
'middleware' => [
'authenticate_session' => Laravel\Sanctum\Http\Middleware\AuthenticateSession::class,
'encrypt_cookies' => Illuminate\Cookie\Middleware\EncryptCookies::class,
'validate_csrf_token' => Illuminate\Foundation\Http\Middleware\ValidateCsrfToken::class,
],
TelescopeTelescope
TelescopeアップデートUpdating Telescope
影響の可能性: 高いLikelihood Of Impact: High
Laravel11はLaravel
Telescope4.xをサポートしなくなったため、composer.json
ファイルでアプリケーションのLaravel
Telescopeパッケージ依存関係を^5.0
へ更新する必要があります。Laravel
11
no
longer
supports
Laravel
Telescope
4.x.
Therefore,
you
should
update
your
application's
Laravel
Telescope
dependency
to
^5.0
in
your
composer.json
file.
Telescope5.0 では、migrationsディレクトリから自動的にマイグレーションをロードしなくなりました。代わりに、以下のコマンドを実行してTelescopeのマイグレーションをアプリケーションへリソース公開する必要があります:Telescope 5.0 no longer automatically loads migrations from its own migrations directory. Instead, you should run the following command to publish Telescope's migrations to your application:
php artisan vendor:publish --tag=telescope-migrations
SpatieのOnceパッケージSpatie Once Package
影響の可能性: 中程度Likelihood Of Impact: Medium
Laravel11は独自のonce
関数を提供し、指定クロージャを一度だけ実行することを保証します。そのため、アプリケーションがspatie/once
パッケージへ依存している場合は、競合を避けるためにアプリケーションの
composer.json
ファイルからこれを削除する必要があります。Laravel
11
now
provides
its
own
once
function[/docs/{{version}}/helpers#method-once]
to
ensure
that
a
given
closure
is
only
executed
once.
Therefore,
if
your
application
has
a
dependency
on
the
spatie/once
package,
you
should
remove
it
from
your
application's
composer.json
file
to
avoid
conflicts.
その他Miscellaneous
また、laravel/laravel
GitHubリポジトリの変更点をご覧になることをお勧めします。これらの変更の多くは必須ではありませんが、これらのファイルをあなたのアプリケーションと同期させておくとよいでしょう。これらの変更のいくつかはこのアップグレードガイドでカバーしていますが、設定ファイルやコメントの変更など、他のものはカバーしていません。GitHub
比較ツール
を使えば簡単に変更点を確認することができ、どこのアップデートがあなたにとって重要かを選ぶことができます。We
also
encourage
you
to
view
the
changes
in
the
laravel/laravel
GitHub
repository[https://github.com/laravel/laravel].
While
many
of
these
changes
are
not
required,
you
may
wish
to
keep
these
files
in
sync
with
your
application.
Some
of
these
changes
will
be
covered
in
this
upgrade
guide,
but
others,
such
as
changes
to
configuration
files
or
comments,
will
not
be.
You
can
easily
view
the
changes
with
the
GitHub
comparison
tool[https://github.com/laravel/laravel/compare/10.x...11.x]
and
choose
which
updates
are
important
to
you.