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

Neuer Testing-Trait WithCachedRoutes

Der neue Testing-Trait WithCachedRoutes hält die Routen während des Test-Setups als statische Eigenschaft vor, sodass nachfolgende Tests sie nicht erneut von der Festplatte lesen müssen.

Pull request by @cosmastech

A new testing trait called WithCachedRoutes was introduced. This testing trait stores the routes as a static property within a Testing\CachedState object during test setup, ensuring subsequent tests do not need to read from disk.

Originalquelle(öffnet in neuem Tab)Problem melden

Laravel Framework von Laravel

Neue Methode Factory@insert() für Eloquent Factories

Eloquent Factories erhalten die Methode insert() für Masseneinfügungen von Models, was Tests mit vielen Datenbankeinträgen beschleunigt.

Pull request by @cosmastech

The insert() method was added to Eloquent Factories, allowing you to perform a mass insert of models. This increases performance during testing with numerous of database records.

Originalquelle(öffnet in neuem Tab)Problem melden

Laravel Framework von Laravel

Stringable::ucwords hinzugefügt und PHP-8.5-Kompatibilität

Stringable und Str erhalten eine Methode ucwords, die im Unterschied zu title den Rest des Strings unverändert lässt, und mehrere Pakete wurden für die Kompatibilität mit PHP 8.5 aktualisiert.

Pull request by @braxey

A ucwords method was added to Stringable, allowing fluent uppercasing of the first letter of a string. Note that this differs from title in that the rest of the string remains untouched.

// Taylor Otwell, Creator Of Laravel
$name = $this->string('taylor otwell, creator of laravel')->ucwords();

A number of packages were updated to ensure they maintained compatibility with the newly released PHP 8.5, including:

Originalquelle(öffnet in neuem Tab)Problem melden

Laravel Framework von Laravel

HTTP-Batch-Ergebnisse in angeforderter Reihenfolge

Ergebnisse von Http::batch werden jetzt in der Reihenfolge der definierten Requests statt in der Antwortreihenfolge zurückgegeben und berücksichtigen per as benannte Requests.

Pull request by @jessarcher

Previously, Http::batch results were sorted in the order that the responses came back, rather than the order that the requests were defined:

dump(Http::batch(fn (Batch $batch) => [
    $batch->get('https://httpbin.org/delay/3'),
    $batch->get('https://httpbin.org/delay/2'),
    $batch->get('https://httpbin.org/delay/1'),
])->send());

array:3 [
  2 => Illuminate\Http\Client\Response {#419}
  1 => Illuminate\Http\Client\Response {#374}
  0 => Illuminate\Http\Client\Response {#328}
]

The results are now sorted before they are returned, respecting any requests named with the as method. Learn more about request batching.

Originalquelle(öffnet in neuem Tab)Problem melden

Laravel Framework von Laravel

Weitere Editoren in ResolvesDumpSource unterstützt

Für app.editor gibt es neue Konfigurationswerte, damit Dumps auch für neovim, zed, kiro, fleet und windsurf korrekt verlinken.

Pull requests by @cseknowledge, @miguilimzero, @OmarFaruk-0x01, @Sajid-al-islam, and @Rakib01

Several PRs introduced new config values for app.editor, allowing dumps to link correctly for several new IDEs: neovim, zed, kiro, fleet, and windsurf.

Originalquelle(öffnet in neuem Tab)Problem melden

Laravel Framework von Laravel

Klickbare Dateireferenz auf der Exception-Seite

Die neue Exception-Seite zeigt nun eine Dateireferenz mit Zeilennummer an, die die Datei direkt in der gewählten IDE öffnet.

Pull request by @jasonmccreary

The recently introduced new exception page now includes a new file reference and line number that opens the file directly in your IDE of choice.

Originalquelle(öffnet in neuem Tab)Problem melden

Laravel Framework von Laravel

messageGroup()-Methode für SQS FIFO und Fair Queues

Statt onGroup() beim Dispatch lässt sich nun direkt in der Job-Klasse eine messageGroup()-Methode definieren, was die Inkonsistenz zu Event-Listenern beseitigt.

Pull request by @patrickcarlohickman

Instead of using the onGroup() method at the time of dispatch, you can now define a messageGroup() directly method on the job class, removing an inconsistency where event listeners supported the messageGroup() method on the class, but all the other job types required calling onGroup().

Originalquelle(öffnet in neuem Tab)Problem melden

Laravel Framework von Laravel

Deferred Queue für verzögerte synchrone Jobs

Über die deferred-Connection lassen sich Jobs im aktuellen Prozess erst nach dem Senden der HTTP-Antwort synchron verarbeiten.

Pull request by @taylorotwell

Using deferred synchronous dispatching, you can dispatch a job to be processed during the current process, but after the HTTP response has been sent to the user. This allows you to process "queued" jobs synchronously without slowing down your user's application experience. To defer the execution of a synchronous job, dispatch the job to the deferred connection:

RecordDelivery::dispatch($order)->onConnection('deferred');

Originalquelle(öffnet in neuem Tab)Problem melden

Laravel Framework von Laravel

Neuer Failover-Cache-Treiber

Der failover-Cache-Treiber wechselt automatisch zum nächsten konfigurierten Store, falls der primäre Cache-Store ausfällt.

Pull request by @taylorotwell

The failover cache driver provides automatic failover functionality when interacting with the cache. If the primary cache store fails for any reason, Laravel will automatically attempt to use the next configured store in the list. This is particularly useful for ensuring high availability in production environments where cache reliability is critical.

'failover' => [
    'driver' => 'failover',
    'stores' => [
        'database',
        'array',
    ],
],

Originalquelle(öffnet in neuem Tab)Problem melden

Laravel Framework von Laravel

PostgreSQL 18: Virtual Columns im Laravel Framework 12.x

Der Spaltenmodifikator virtualAs unterstützt jetzt abwärtskompatibel die in PostgreSQL 18 eingeführten virtuell generierten Spalten.

Pull request by @tpetry

PostgreSQL 18 was recently released, along with it support for virtual generated columns. The virtualAs column modifier now has backwards compatible support this new PostgreSQL feature.

Originalquelle(öffnet in neuem Tab)Problem melden

Laravel Framework von Laravel

Failover-Queue-Treiber im Laravel Framework 12.x

Der neue failover-Queue-Treiber versucht beim Pushen eines Jobs automatisch die nächste konfigurierte Verbindung, wenn die primäre Queue-Verbindung ausfällt.

Pull request by @taylorotwell

The failover queue driver provides automatic failover functionality when pushing jobs to the queue. If the primary queue connection fails for any reason, Laravel will automatically attempt to push the job to the next configured connection in the list. This is particularly useful for ensuring high availability in production environments where queue reliability is critical.

'failover' => [
    'driver' => 'failover',
    'connections' => [
        'redis',
        'database',
        'sync',
    ],
],

Originalquelle(öffnet in neuem Tab)Problem melden

Laravel Framework von Laravel

Methode defer für HTTP Batch in Laravel 12.x

Mit der neuen Methode defer auf Http::batch wird der Batch von Requests erst ausgeführt, nachdem die HTTP-Antwort an den Nutzer gesendet wurde.

Pull request by @WendellAdriel

When the new defer method is invoked on Http::batch, the batch of requests is not executed immediately. Instead, Laravel will execute the batch after the current application request's HTTP response has been sent to the user, keeping your application feeling fast and responsive:

use Illuminate\Http\Client\Batch;
use Illuminate\Support\Facades\Http;

$responses = Http::batch(fn (Batch $batch) => [
    $batch->get('http://localhost/first'),
    $batch->get('http://localhost/second'),
    $batch->get('http://localhost/third'),
])->then(function (Batch $batch, array $results) {
    // All requests completed successfully...
})->defer();

Originalquelle(öffnet in neuem Tab)Problem melden

Laravel Framework von Laravel

Weitere Editoren in ResolvesDumpSource unterstützt

Neue Werte für app.editor ermöglichen korrekte Dump-Links für die Editoren neovim, zed, kiro, fleet und windsurf.

Pull requests by @cseknowledge, @miguilimzero, @OmarFaruk-0x01, @Sajid-al-islam, and @Rakib01

Several PRs introduced new config values for app.editor, allowing dumps to link correctly for several new IDEs: neovim, zed, kiro, fleet, and windsurf.

Originalquelle(öffnet in neuem Tab)Problem melden

Laravel Framework von Laravel

SQS FIFO und Fair Queue: messageGroup()-Methode auf Job-Klassen

Statt onGroup() beim Dispatch aufzurufen, kann nun direkt in der Job-Klasse eine messageGroup()-Methode definiert werden, was eine Inkonsistenz zu Event-Listenern beseitigt.

Pull request by @patrickcarlohickman

Instead of using the onGroup() method at the time of dispatch, you can now define a messageGroup() directly method on the job class, removing an inconsistency where event listeners supported the messageGroup() method on the class, but all the other job types required calling onGroup().

Originalquelle(öffnet in neuem Tab)Problem melden

Laravel Framework von Laravel

Rate Limiting mit after-Hook im Laravel Framework 12.x

Der neue Hook RateLimiter::after ermöglicht Rate Limiting nicht nur anhand der Anfrage, sondern auch anhand der Antwort, etwa bei 404-Statuscodes.

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 im Laravel Framework 12.x

Mit Http::batch lassen sich bei parallelen HTTP-Requests Callbacks wie before, progress, catch, then und finally in den Ablauf jedes Aufrufs 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 unterstützt jetzt Macros

Illuminate\Support\Benchmark nutzt nun den Macroable-Trait, sodass sich beliebige Macros registrieren lassen.

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

Option --whisper für schedule:work

Die Option --whisper von schedule:work wird an schedule:run weitergereicht und blendet die Meldung „No scheduled commands are ready to run“ aus, was Logs und Terminalausgaben übersichtlicher 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

Session-Cache im Laravel Framework 12.x

Der neue Session-Cache speichert Daten pro Nutzersitzung getrennt vom globalen Anwendungs-Cache und räumt sie auf, wenn die Session abläuft oder zerstört wird.

Pull request by @joaopalopes24

$discount = $request->session()->cache()->get('discount');

$request->session()->cache()->put(
    'discount', 10, now()->addMinutes(5)
);

The new session cache provides a convenient way to cache data that is scoped to an individual user session. Unlike the global application cache, session cache data is automatically isolated per session and is cleaned up when the session expires or is destroyed.

Originalquelle(öffnet in neuem Tab)Problem melden

Laravel Framework von Laravel

Attribute #[UseResource] und #[UseResourceCollection] für Models

Resource-Klassen lassen sich nun per PHP-Attribut #[UseResource(...)] und #[UseResourceCollection(...)] direkt an Eloquent-Models definieren.

Pull request by @Lukasss93

use App\Http\Resources\MyCustomNameResource;
use App\Http\Resources\MyCustomNameCollectionResource;

#[UseResource(MyCustomNameResource::class)]
#[UseResourceCollection(MyCustomNameCollectionResource::class)]
class MyModel extends Model {
    //
}

// Now you can call:
$model->toResource();
$collection->toResourceCollection();

You can now define resources classes directly on your Eloquent models using PHP attributes.

Originalquelle(öffnet in neuem Tab)Problem melden