Skip to content

Commit

Permalink
Merge branch '11.x'
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Feb 18, 2025
2 parents a31393e + 100c20e commit 5496409
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
2 changes: 1 addition & 1 deletion billing.md
Original file line number Diff line number Diff line change
Expand Up @@ -1882,7 +1882,7 @@ You may pass an array of prices to the `previewInvoice` method in order to previ

Before generating invoice PDFs, you should use Composer to install the Dompdf library, which is the default invoice renderer for Cashier:

```php
```shell
composer require dompdf/dompdf
```

Expand Down
20 changes: 20 additions & 0 deletions helpers.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
- [Lottery](#lottery)
- [Pipeline](#pipeline)
- [Sleep](#sleep)
- [Timebox](#timebox)

<a name="introduction"></a>
## Introduction
Expand Down Expand Up @@ -2769,3 +2770,22 @@ $start->diffForHumans(); // 1 second ago
```

Laravel uses the `Sleep` class internally whenever it is pausing execution. For example, the [`retry`](#method-retry) helper uses the `Sleep` class when sleeping, allowing for improved testability when using that helper.

<a name="timebox"></a>
### Timebox

Laravel's `Timebox` class ensures that the given callback always takes a fixed amount of time to execute, even if its actual execution completes sooner. This is particularly useful for cryptographic operations and user authentication checks, where attackers might exploit variations in execution time to infer sensitive information.

If the execution exceeds the fixed duration, `Timebox` has no effect. It is up to the developer to choose a sufficiently long time as the fixed duration to account for worst-case scenarios.

The call method accepts a closure and a time limit in microseconds, and then executes the closure and waits until the time limit is reached:

```php
use Illuminate\Support\Timebox;

(new Timebox)->call(function ($timebox) {
// ...
}, microseconds: 10000);
```

If an exception is thrown within the closure, this class will respect the defined delay and re-throw the exception after the delay.
5 changes: 2 additions & 3 deletions http-tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ class ExampleTest extends TestCase
}
```

Alternatively, you may use the `dd`, `ddHeaders`, and `ddSession` methods to dump information about the response and then stop execution:
Alternatively, you may use the `dd`, `ddHeaders`, `ddSession`, and `ddJson` methods to dump information about the response and then stop execution:

```php tab=Pest
<?php
Expand All @@ -312,9 +312,8 @@ test('basic test', function () {
$response = $this->get('/');

$response->ddHeaders();

$response->ddSession();

$response->ddJson();
$response->dd();
});
```
Expand Down

0 comments on commit 5496409

Please sign in to comment.