Zum Inhalt springen

Laravel Framework Updates & Release Notes

Einträge
234
Quellen
1
Zuletzt aktualisiert

Folge Laravel Framework, um die Release Notes in deinen Feed zu holen.

Laravel Framework von Laravel

Option --json für schedule:list

Der Befehl schedule:list akzeptiert jetzt das Flag --json, um Daten geplanter Tasks maschinenlesbar für Monitoring und Integrationen auszugeben.

Pull request by @dxnter

[
    {
        "expression": "0 0 15 * *",
        "repeat_seconds": null,
        "command": "php artisan backup:run",
        "description": "Run daily backup process",
        "next_due_date": "2025-09-15 00:00:00 +00:00",
        "next_due_date_human": "5 days from now",
        "timezone": "UTC",
        "has_mutex": false
    }
]

The schedule:list command now accepts a --json flag to allow programmatic consumption of scheduled task data for monitoring and integration purposes.

Originalquelle(öffnet in neuem Tab)Problem melden

Laravel Framework von Laravel

Neues Argument prependCount für Str::plural()

Str::plural akzeptiert nun das Argument prependCount, das die Anzahl automatisch dem Wort voranstellt.

Pull request by @caseydwyer

{{-- Instead of: --}}
We had {{ number_format($attendees->count()) . ' ' . Str::plural('attendee', $attendees->count()) }} at Laracon 2025.

{{-- Now we can: --}}
We had {{ Str::plural('attendee', $attendees->count(), prependCount: true) }} at Laracon 2025.

The Str::plural helper now accepts a new argument, prependCount, that will prepend the count to the string automatically.

Originalquelle(öffnet in neuem Tab)Problem melden

Laravel Framework von Laravel

Überarbeitete lokale Fehlerseite und Trusted Publishing für NPM

Die lokale Exception-Seite wurde überarbeitet, um Fehler klarer und handlungsorientierter darzustellen, und alle NPM-Pakete werden nun per Trusted Publishing veröffentlicht, sodass die Herkunft des Releases prüfbar ist.

Pull request by @avosalmon

New local exception page

The exception page was given a refresh, making local errors clearer and more actionable.

This month, we switched all of our NPM packages over to Trusted Publishing. Now you'll know where the latest release originated and you can verify that it came from us.

NPM provenance statement

Originalquelle(öffnet in neuem Tab)Problem melden

Laravel Framework von Laravel

Rate Limiting: neuer after-Hook

Der neue Hook RateLimiter::after ermöglicht Rate Limiting, das zusätzlich zur Anfrage auch die Antwort berücksichtigt.

Pull request by @timacdonald

use Illuminate\Http\Request;
use Illuminate\Support\Facades\RateLimiter;
use Symfony\Component\HttpFoundation\Response;

/*
 * Ensure a user can only hit ten 404 responses in a minute before they are
 * rate limited to ensure user's cannot enumerate resource IDs.
 */
RateLimiter::for('resource-not-found', function (Request $request) {
    return Limit::perMinute(10)
        ->by("user:{$request->user()->id}")

        // The new `after` hook...
        ->after(function (Response $response) {
            return $response->getStatusCode() === 404;
        });
});

The new RateLimiter::after hook lets you apply rate limiting based on the response as well as the request.

Originalquelle(öffnet in neuem Tab)Problem melden

Laravel Framework von Laravel

Neue Methode Http::batch für parallele HTTP-Anfragen

Mit Http::batch lassen sich bei parallelen HTTP-Anfragen Callbacks wie before, progress, catch, then und finally in den Ablauf jeder Anfrage einhängen.

Pull request by @WendellAdriel

$responses = Http::batch(fn (Batch $batch) => [
    $batch->get('http://localhost/first'),
    $batch->get('http://localhost/second'),
    $batch->get('http://localhost/third'),
])->before(function (Batch $batch) {
    // This runs before the first HTTP request is executed.
})->progress(function (Batch $batch, int|string $key, Response $response) {
    // This runs after each successful HTTP request from the Batch.
})->catch(function (Batch $batch, int|string $key, Response|RequestException $response) {
    // This runs after each failed HTTP request from the Batch.
})->then(function (Batch $batch, array $results) {
    // This runs ONLY IF all the HTTP requests from the Batch are successful and the batch is not cancelled.
})->finally(function (Batch $batch, array $results) {
    // This runs after all the HTTP requests from the Batch finish and the batch is not cancelled.
})->send();

The new Http::batch method allows you to hook into the lifecycle of each HTTP call when making multiple requests in parallel.

Originalquelle(öffnet in neuem Tab)Problem melden

Laravel Framework von Laravel

Benchmark nutzt jetzt den Macroable-Trait

Illuminate\Support\Benchmark verwendet nun den Macroable-Trait und erlaubt dadurch die Registrierung eigener Macros.

Pull request by @1tim22

use Closure;
use Illuminate\Support\Benchmark;
use Illuminate\Support\Facades\Log;

Benchmark::macro('log', fn (Closure $callback) =>
    Log::debug(Benchmark::measure($callback))
);

Benchmark::log(fn () => sleep(1));

Benchmark is now updated with the Macroable trait to allow arbitrary macro registration.

Originalquelle(öffnet in neuem Tab)Problem melden

Laravel Framework von Laravel

schedule:work erhält Option --whisper

Die Option --whisper von schedule:work wird an schedule:run durchgereicht und blendet die Meldung "No scheduled commands are ready to run" aus, was die Ausgabe sauberer macht.

Pull request by @thojo0

You can now pass a --whisper option to the schedule:work command. The option is passed through to the schedule:run command, which hides the "No scheduled commands are ready to run" message from the output, producing cleaner logs and terminal output and reducing noise for monitoring tools.

Originalquelle(öffnet in neuem Tab)Problem melden

Laravel Framework von Laravel

schedule:list unterstützt Option --json

Der Befehl schedule:list akzeptiert jetzt das Flag --json, damit sich Daten geplanter Tasks programmatisch für Monitoring und Integrationen auswerten lassen.

Pull request by @dxnter

[
    {
        "expression": "0 0 15 * *",
        "repeat_seconds": null,
        "command": "php artisan backup:run",
        "description": "Run daily backup process",
        "next_due_date": "2025-09-15 00:00:00 +00:00",
        "next_due_date_human": "5 days from now",
        "timezone": "UTC",
        "has_mutex": false
    }
]

The schedule:list command now accepts a --json flag to allow programmatic consumption of scheduled task data for monitoring and integration purposes.

Originalquelle(öffnet in neuem Tab)Problem melden

Laravel Framework von Laravel

Str::plural mit neuem Argument prependCount

Str::plural akzeptiert nun das Argument prependCount, das die Anzahl automatisch dem Ergebnis voranstellt.

Pull request by @caseydwyer

{{-- Instead of: --}}
We had {{ number_format($attendees->count()) . ' ' . Str::plural('attendee', $attendees->count()) }} at Laracon 2025.

{{-- Now we can: --}}
We had {{ Str::plural('attendee', $attendees->count(), prependCount: true) }} at Laracon 2025.

The Str::plural helper now accepts a new argument, prependCount, that will prepend the count to the string automatically.

Originalquelle(öffnet in neuem Tab)Problem melden

Laravel Framework von Laravel

Laravel Framework 12.x: LazyCollection::withHeartbeat

Die neue Methode withHeartbeat führt während der lazy Enumeration einer Collection in regelmäßigen Zeitabständen einen Callback aus, was besonders bei lang laufenden Prozessen nützlich ist.

Pull request by @JosephSilber

$collection
    ->withHeartbeat(CarbonInterval::minutes(5), function () {
        // ...
    })
    ->each(function ($item) {
        // ...
    });

The new withHeartbeart method allows you to run a callback at regular time intervals while the collection is being lazily enumerated, particularly useful for long-running processes.

Originalquelle(öffnet in neuem Tab)Problem melden

Laravel Framework von Laravel

Laravel 12.x: allowedUrls für Http::preventStrayRequests

Http::allowStrayRequests akzeptiert nun ein Argument, mit dem sich URLs festlegen lassen, an die Tests bei aktivem Http::preventStrayRequests weiterhin Requests senden dürfen.

Pull request by @rabrowne85

Http::allowStrayRequests([
    'http://127.0.0.1:13714/*',
]);

The Http::allowStrayRequests method now accepts an argument that allows you to specify URLs that tests are allowed to send requests to when using Http::preventStrayRequests.

Originalquelle(öffnet in neuem Tab)Problem melden

Laravel Framework von Laravel

Laravel 12.x: „Copy as Markdown“-Button auf der Fehlerseite

Die Laravel-Exception-Seite hat jetzt einen „Copy as Markdown“-Button, der eine Markdown-Darstellung der Exception in die Zwischenablage kopiert, die sich für AI agents/LLMs nutzen lässt.

Pull request by @mpociot

There is now a "Copy as Markdown" button on the Laravel exception page. When clicking this button, a markdown representation of the exception is copied to the users clipboard, which can then be used for AI agents/LLMs.

Originalquelle(öffnet in neuem Tab)Problem melden

Laravel Framework von Laravel

Laravel 12.x: Neue Methoden mergeVisible, mergeHidden, mergeAppends

Eloquent-Models erhalten die zusätzlichen Helfer mergeVisible, mergeHidden und mergeAppends zum Zusammenführen sichtbarkeitsbezogener Arrays, analog zu mergeCasts, mergeFillable und mergeGuarded.

Pull request by @jonerickson

protected function initializeTwoFactorAuthentication(): void
{
    $this->mergeHidden([
        'app_authentication_secret',
        'app_authentication_recovery_codes',
    ]);

    $this->mergeCasts([
        'app_authentication_secret' => 'encrypted',
        'app_authentication_recovery_codes' => 'encrypted:array',
    ]);
}

Additional attribute helper methods added to Eloquent models for merging visibility-related arrays, bringing them in line with existing helpers like mergeCasts, mergeFillable, and mergeGuarded.

Originalquelle(öffnet in neuem Tab)Problem melden

Laravel Framework von Laravel

Laravel 12.x: withHeartbeat für LazyCollection

Die neue Methode withHeartbeat führt während der lazy Enumeration einer Collection in regelmäßigen Zeitabständen einen Callback aus, was besonders bei lang laufenden Prozessen nützlich ist.

Pull request by @JosephSilber

$collection
    ->withHeartbeat(CarbonInterval::minutes(5), function () {
        // ...
    })
    ->each(function ($item) {
        // ...
    });

The new withHeartbeart method allows you to run a callback at regular time intervals while the collection is being lazily enumerated, particularly useful for long-running processes.

Originalquelle(öffnet in neuem Tab)Problem melden

Laravel Framework von Laravel

Laravel 12.x: URLs für Http::allowStrayRequests erlaubt

Http::allowStrayRequests akzeptiert jetzt ein Argument, um URLs festzulegen, an die Tests bei aktivem Http::preventStrayRequests weiterhin Anfragen senden dürfen.

Pull request by @rabrowne85

Http::allowStrayRequests([
    'http://127.0.0.1:13714/*',
]);

The Http::allowStrayRequests method now accepts an argument that allows you to specify URLs that tests are allowed to send requests to when using Http::preventStrayRequests.

Originalquelle(öffnet in neuem Tab)Problem melden

Laravel Framework von Laravel

Laravel 12.x: mergeVisible, mergeHidden und mergeAppends

Eloquent-Modelle erhalten die neuen Hilfsmethoden mergeVisible, mergeHidden und mergeAppends, passend zu bestehenden Helfern wie mergeCasts, mergeFillable und mergeGuarded.

Pull request by @jonerickson

protected function initializeTwoFactorAuthentication(): void
{
    $this->mergeHidden([
        'app_authentication_secret',
        'app_authentication_recovery_codes',
    ]);

    $this->mergeCasts([
        'app_authentication_secret' => 'encrypted',
        'app_authentication_recovery_codes' => 'encrypted:array',
    ]);
}

Additional attribute helper methods added to Eloquent models for merging visibility-related arrays, bringing them in line with existing helpers like mergeCasts, mergeFillable, and mergeGuarded.

Originalquelle(öffnet in neuem Tab)Problem melden

Laravel Framework von Laravel

Neue Methode Arr::push()

Die neue Arr-Methode push() fügt einem Array einen Wert hinzu und legt das Array zuvor als leeres Array an, falls es nicht existiert.

Pull request by @inxilpro

if ($this->hasChanges($data)) {
    Arr::push($result, 'pending.changes', $data);
}

A new Arr method that allows you to push something to an array if the array exists, or initialize it to an empty array and then push to it if it doesn't.

Originalquelle(öffnet in neuem Tab)Problem melden