Skip to content

Commit 7c67aee

Browse files
committed
2025-08-11までの原文変更点反映。
1 parent 80b3c3a commit 7c67aee

30 files changed

+609
-65
lines changed

original-en/broadcasting.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ By default, broadcasting is not enabled in new Laravel applications. You may ena
6969
php artisan install:broadcasting
7070
```
7171

72-
The `install:broadcasting` command with prompt you for which event broadcasting service you would like to use. In addition, it will create the `config/broadcasting.php` configuration file and the `routes/channels.php` file where you may register your application's broadcast authorization routes and callbacks.
72+
The `install:broadcasting` command will prompt you for which event broadcasting service you would like to use. In addition, it will create the `config/broadcasting.php` configuration file and the `routes/channels.php` file where you may register your application's broadcast authorization routes and callbacks.
7373

7474
Laravel supports several broadcast drivers out of the box: [Laravel Reverb](/docs/{{version}}/reverb), [Pusher Channels](https://pusher.com/channels), [Ably](https://ably.com), and a `log` driver for local development and debugging. Additionally, a `null` driver is included which allows you to disable broadcasting during testing. A configuration example is included for each of these drivers in the `config/broadcasting.php` configuration file.
7575

original-en/collections.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ For the majority of the remaining collection documentation, we'll discuss each m
128128
[diffAssocUsing](#method-diffassocusing)
129129
[diffKeys](#method-diffkeys)
130130
[doesntContain](#method-doesntcontain)
131+
[doesntContainStrict](#method-doesntcontainstrict)
131132
[dot](#method-dot)
132133
[dump](#method-dump)
133134
[duplicates](#method-duplicates)
@@ -843,6 +844,11 @@ $collection->doesntContain('product', 'Bookcase');
843844

844845
The `doesntContain` method uses "loose" comparisons when checking item values, meaning a string with an integer value will be considered equal to an integer of the same value.
845846

847+
<a name="method-doesntcontainstrict"></a>
848+
#### `doesntContainStrict()` {.collection-method}
849+
850+
This method has the same signature as the [doesntContain](#method-doesntcontain) method; however, all values are compared using "strict" comparisons.
851+
846852
<a name="method-dot"></a>
847853
#### `dot()` {.collection-method}
848854

original-en/container.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,9 @@ $this->app->singletonIf(Transistor::class, function (Application $app) {
178178
});
179179
```
180180

181+
<a name="singleton-attribute"></a>
182+
#### Singleton Attribute
183+
181184
Alternatively, you may mark an interface or class with the `#[Singleton]` attribute to indicate to the container that it should be resolved one time:
182185

183186
```php
@@ -217,6 +220,9 @@ $this->app->scopedIf(Transistor::class, function (Application $app) {
217220
});
218221
```
219222

223+
<a name="scoped-attribute"></a>
224+
#### Scoped Attribute
225+
220226
Alternatively, you may mark an interface or class with the `#[Scoped]` attribute to indicate to the container that it should be resolved one time within a given Laravel request / job lifecycle:
221227

222228
```php
@@ -272,6 +278,45 @@ public function __construct(
272278
) {}
273279
```
274280

281+
<a name="bind-attribute"></a>
282+
#### Bind Attribute
283+
284+
Laravel also provides a `Bind` attribute for added convenience. You can apply this attribute to any interface to tell Laravel which implementation should be automatically injected whenever that interface is requested. When using the `Bind` attribute, there is no need to perform any additional service registration in your application's service providers.
285+
286+
In addition, multiple `Bind` attributes may be placed on an interface in order to configure a different implementation that should be injected for a given set of environments:
287+
288+
```php
289+
<?php
290+
291+
namespace App\Contracts;
292+
293+
use App\Services\FakeEventPusher;
294+
use App\Services\RedisEventPusher;
295+
use Illuminate\Container\Attributes\Bind;
296+
297+
#[Bind(RedisEventPusher::class)]
298+
#[Bind(FakeEventPusher::class, environments: ['local', 'testing'])]
299+
interface EventPusher
300+
{
301+
// ...
302+
}
303+
```
304+
305+
Furthermore, [Singleton](#singleton-attribute) and [Scoped](#scoped-attribute) attributes may be applied to indicate if the container bindings should be resolved once or once per request / job lifecycle:
306+
307+
```php
308+
use App\Services\RedisEventPusher;
309+
use Illuminate\Container\Attributes\Bind;
310+
use Illuminate\Container\Attributes\Singleton;
311+
312+
#[Bind(RedisEventPusher::class)]
313+
#[Singleton]
314+
interface EventPusher
315+
{
316+
// ...
317+
}
318+
```
319+
275320
<a name="contextual-binding"></a>
276321
### Contextual Binding
277322

original-en/events.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
- [Handling Failed Jobs](#handling-failed-jobs)
1717
- [Dispatching Events](#dispatching-events)
1818
- [Dispatching Events After Database Transactions](#dispatching-events-after-database-transactions)
19+
- [Deferring Events](#deferring-events)
1920
- [Event Subscribers](#event-subscribers)
2021
- [Writing Event Subscribers](#writing-event-subscribers)
2122
- [Registering Event Subscribers](#registering-event-subscribers)
@@ -799,6 +800,26 @@ class OrderShipped implements ShouldDispatchAfterCommit
799800
}
800801
```
801802

803+
<a name="deferring-events"></a>
804+
### Deferring Events
805+
806+
Deferred events allow you to delay the dispatching of model events and execution of event listeners until after a specific block of code has completed. This is particularly useful when you need to ensure that all related records are created before event listeners are triggered.
807+
808+
To defer events, provide a closure to the `Event::defer()` method:
809+
810+
```php
811+
use App\Models\User;
812+
use Illuminate\Support\Facades\Event;
813+
814+
Event::defer(function () {
815+
$user = User::create(['name' => 'Victoria Otwell']);
816+
817+
$user->posts()->create(['title' => 'My first post!']);
818+
});
819+
```
820+
821+
All events triggered within the closure will be dispatched after the closure is executed. This ensures that event listeners have access to all related records that were created during the deferred execution. If an exception occurs within the closure, the deferred events will not be dispatched.
822+
802823
<a name="event-subscribers"></a>
803824
## Event Subscribers
804825

@@ -935,6 +956,9 @@ test('orders can be shipped', function () {
935956
// Assert an event was dispatched twice...
936957
Event::assertDispatched(OrderShipped::class, 2);
937958

959+
// Assert an event was dispatched once...
960+
Event::assertDispatchedOnce(OrderShipped::class);
961+
938962
// Assert an event was not dispatched...
939963
Event::assertNotDispatched(OrderFailedToShip::class);
940964

@@ -970,6 +994,9 @@ class ExampleTest extends TestCase
970994
// Assert an event was dispatched twice...
971995
Event::assertDispatched(OrderShipped::class, 2);
972996

997+
// Assert an event was dispatched once...
998+
Event::assertDispatchedOnce(OrderShipped::class);
999+
9731000
// Assert an event was not dispatched...
9741001
Event::assertNotDispatched(OrderFailedToShip::class);
9751002

original-en/helpers.md

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ Laravel includes a variety of global "helper" PHP functions. Many of these funct
4646
[Arr::crossJoin](#method-array-crossjoin)
4747
[Arr::divide](#method-array-divide)
4848
[Arr::dot](#method-array-dot)
49+
[Arr::every](#method-array-every)
4950
[Arr::except](#method-array-except)
5051
[Arr::exists](#method-array-exists)
5152
[Arr::first](#method-array-first)
@@ -79,6 +80,7 @@ Laravel includes a variety of global "helper" PHP functions. Many of these funct
7980
[Arr::set](#method-array-set)
8081
[Arr::shuffle](#method-array-shuffle)
8182
[Arr::sole](#method-array-sole)
83+
[Arr::some](#method-array-some)
8284
[Arr::sort](#method-array-sort)
8385
[Arr::sortDesc](#method-array-sort-desc)
8486
[Arr::sortRecursive](#method-array-sort-recursive)
@@ -152,6 +154,7 @@ Laravel includes a variety of global "helper" PHP functions. Many of these funct
152154
[route](#method-route)
153155
[secure_asset](#method-secure-asset)
154156
[secure_url](#method-secure-url)
157+
[to_action](#method-to-action)
155158
[to_route](#method-to-route)
156159
[uri](#method-uri)
157160
[url](#method-url)
@@ -388,6 +391,25 @@ $flattened = Arr::dot($array);
388391
// ['products.desk.price' => 100]
389392
```
390393

394+
<a name="method-array-every"></a>
395+
#### `Arr::every()` {.collection-method}
396+
397+
The `Arr::every` method ensures that all values in the array pass a given truth test:
398+
399+
```php
400+
use Illuminate\Support\Arr;
401+
402+
$array = [1, 2, 3];
403+
404+
Arr::every($array, fn ($i) => $i > 0);
405+
406+
// true
407+
408+
Arr::every($array, fn ($i) => $i > 2);
409+
410+
// false
411+
```
412+
391413
<a name="method-array-except"></a>
392414
#### `Arr::except()` {.collection-method}
393415

@@ -1062,6 +1084,21 @@ $value = Arr::sole($array, fn (string $value) => $value === 'Desk');
10621084
// 'Desk'
10631085
```
10641086

1087+
<a name="method-array-some"></a>
1088+
#### `Arr::some()` {.collection-method}
1089+
1090+
The `Arr::some` method ensures that at least one of the values in the array passes a given truth test:
1091+
1092+
```php
1093+
use Illuminate\Support\Arr;
1094+
1095+
$array = [1, 2, 3];
1096+
1097+
Arr::some($array, fn ($i) => $i > 2);
1098+
1099+
// true
1100+
```
1101+
10651102
<a name="method-array-sort"></a>
10661103
#### `Arr::sort()` {.collection-method}
10671104

@@ -2100,6 +2137,28 @@ $url = secure_url('user/profile');
21002137
$url = secure_url('user/profile', [1]);
21012138
```
21022139

2140+
<a name="method-to-action"></a>
2141+
#### `to_action()` {.collection-method}
2142+
2143+
The `to_action` function generates a [redirect HTTP response](/docs/{{version}}/responses#redirects) for a given controller action:
2144+
2145+
```php
2146+
use App\Http\Controllers\UserController;
2147+
2148+
return to_action([UserController::class, 'show'], ['user' => 1]);
2149+
```
2150+
2151+
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_action` method:
2152+
2153+
```php
2154+
return to_action(
2155+
[UserController::class, 'show'],
2156+
['user' => 1],
2157+
302,
2158+
['X-Framework' => 'Laravel']
2159+
);
2160+
```
2161+
21032162
<a name="method-to-route"></a>
21042163
#### `to_route()` {.collection-method}
21052164

@@ -3165,6 +3224,9 @@ By default, deferred functions will only be executed if the HTTP response, Artis
31653224
defer(fn () => Metrics::reportOrder($order))->always();
31663225
```
31673226

3227+
> [!WARNING]
3228+
> If you have the **swoole** PHP extension installed, Laravel's `defer` function may conflict with Swoole's own global `defer` function, leading to web server errors. Make sure you call Laravel's `defer` helper by explicitly namespacing it: `use function Illuminate\Support\defer;`
3229+
31683230
<a name="cancelling-deferred-functions"></a>
31693231
#### Cancelling Deferred Functions
31703232

@@ -3311,6 +3373,19 @@ $user = Pipeline::send($user)
33113373
->thenReturn();
33123374
```
33133375

3376+
The `withinTransaction` method may be invoked on the pipeline to automatically wrap all steps of the pipeline within a single database transaction:
3377+
3378+
```php
3379+
$user = Pipeline::send($user)
3380+
->withinTransaction()
3381+
->through([
3382+
ProcessOrder::class,
3383+
TransferFunds::class,
3384+
UpdateInventory::class,
3385+
])
3386+
->thenReturn();
3387+
```
3388+
33143389
<a name="sleep"></a>
33153390
### Sleep
33163391

original-en/http-tests.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,13 @@ class ExampleTest extends TestCase
258258
You may also specify which guard should be used to authenticate the given user by passing the guard name as the second argument to the `actingAs` method. The guard that is provided to the `actingAs` method will also become the default guard for the duration of the test:
259259

260260
```php
261-
$this->actingAs($user, 'web')
261+
$this->actingAs($user, 'web');
262+
```
263+
264+
If you would like to ensure the request is unauthenticated, you may use the `actingAsGuest` method:
265+
266+
```php
267+
$this->actingAsGuest();
262268
```
263269

264270
<a name="debugging-responses"></a>

original-en/mail.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1291,6 +1291,9 @@ test('orders can be shipped', function () {
12911291
// Assert a mailable was not sent...
12921292
Mail::assertNotSent(AnotherMailable::class);
12931293

1294+
// Assert a mailable was sent twice...
1295+
Mail::assertSentTimes(OrderShipped::class, 2);
1296+
12941297
// Assert 3 total mailables were sent...
12951298
Mail::assertSentCount(3);
12961299
});
@@ -1331,6 +1334,9 @@ class ExampleTest extends TestCase
13311334
// Assert a mailable was not sent...
13321335
Mail::assertNotSent(AnotherMailable::class);
13331336

1337+
// Assert a mailable was sent twice...
1338+
Mail::assertSentTimes(OrderShipped::class, 2);
1339+
13341340
// Assert 3 total mailables were sent...
13351341
Mail::assertSentCount(3);
13361342
}

original-en/migrations.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -686,6 +686,14 @@ The `enum` method creates a `ENUM` equivalent column with the given valid values
686686
$table->enum('difficulty', ['easy', 'hard']);
687687
```
688688

689+
Of course, you may use the `Enum::cases()` method instead of manually defining an array of allowed values:
690+
691+
```php
692+
use App\Enums\Difficulty;
693+
694+
$table->enum('difficulty', Difficulty::cases());
695+
```
696+
689697
<a name="column-method-float"></a>
690698
#### `float()` {.collection-method}
691699

original-en/notifications.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1668,6 +1668,9 @@ test('orders can be shipped', function () {
16681668
[$user], AnotherNotification::class
16691669
);
16701670

1671+
// Assert a notification was sent twice...
1672+
Notification::assertSentTimes(WeeklyReminder::class, 2);
1673+
16711674
// Assert that a given number of notifications were sent...
16721675
Notification::assertCount(3);
16731676
});
@@ -1703,6 +1706,9 @@ class ExampleTest extends TestCase
17031706
[$user], AnotherNotification::class
17041707
);
17051708

1709+
// Assert a notification was sent twice...
1710+
Notification::assertSentTimes(WeeklyReminder::class, 2);
1711+
17061712
// Assert that a given number of notifications were sent...
17071713
Notification::assertCount(3);
17081714
}

original-en/octane.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
- [Watching for File Changes](#watching-for-file-changes)
1313
- [Specifying the Worker Count](#specifying-the-worker-count)
1414
- [Specifying the Max Request Count](#specifying-the-max-request-count)
15+
- [Specifying the Max Execution Time](#specifying-the-max-execution-time)
1516
- [Reloading the Workers](#reloading-the-workers)
1617
- [Stopping the Server](#stopping-the-server)
1718
- [Dependency Injection and Octane](#dependency-injection-and-octane)
@@ -136,6 +137,17 @@ If the `--log-level` option is explicitly passed to the `php artisan octane:star
136137

137138
You may consult [the official FrankenPHP documentation](https://frankenphp.dev/docs/docker/) for more information on running FrankenPHP with Docker.
138139

140+
<a name="frankenphp-caddyfile"></a>
141+
#### Custom Caddyfile Configuration
142+
143+
When using FrankenPHP, you may specify a custom Caddyfile using the `--caddyfile` option when starting Octane:
144+
145+
```shell
146+
php artisan octane:start --server=frankenphp --caddyfile=/path/to/your/Caddyfile
147+
```
148+
149+
This allows you to customize FrankenPHP's configuration beyond the default settings, such as adding custom middleware, configuring advanced routing, or setting up custom directives. You may consult the [official Caddy documentation](https://caddyserver.com/docs/caddyfile) for more information on Caddyfile syntax and configuration options.
150+
139151
<a name="roadrunner"></a>
140152
### RoadRunner
141153

@@ -360,6 +372,20 @@ To help prevent stray memory leaks, Octane gracefully restarts any worker once i
360372
php artisan octane:start --max-requests=250
361373
```
362374

375+
<a name="specifying-the-max-execution-time"></a>
376+
### Specifying the Max Execution Time
377+
378+
By default, Laravel Octane sets a maximum execution time of 30 seconds for incoming requests via the `max_execution_time` option in your application's `config/octane.php` configuration file:
379+
380+
```php
381+
'max_execution_time' => 30,
382+
```
383+
384+
This setting defines the maximum number of seconds that an incoming request is allowed to execute before being terminated. Setting this value to `0` will disable the execution time limit entirely. This configuration option is particularly useful for applications that handle long-running requests, such as file uploads, data processing, or API calls to external services.
385+
386+
> [!WARNING]
387+
> When you modify the `max_execution_time` configuration, you must restart the Octane server for the changes to take effect.
388+
363389
<a name="reloading-the-workers"></a>
364390
### Reloading the Workers
365391

0 commit comments

Comments
 (0)