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

Strict Mode für Form Requests im Laravel-Framework

Mit FormRequest::failOnUnknownFields() schlägt die Validierung fehl, wenn eingehende Felder nicht in rules() deklariert sind, und einzelne Requests können sich per Eigenschaft $failOnUnknownFields = false ausnehmen.

Pull request by @NurullahDemirel

Strict mode lands in form requests, mirroring the spirit of Model::shouldBeStrict(). Flip it on in your AppServiceProvider and any incoming field that isn't declared in rules() will fail validation instead of silently slipping through:

use Illuminate\Foundation\Http\FormRequest;

public function boot(): void
{
    FormRequest::failOnUnknownFields(! app()->isProduction());
}

Need to opt a single request out (say, a public webhook with unpredictable payloads)? Set the property on the class:

class PublicWebhookRequest extends FormRequest
{
    protected ?bool $failOnUnknownFields = false;

    public function rules(): array { /* ... */ }
}

It's fully backward compatible, off by default, and a great safety net during development. Learn more in the validation documentation.

Originalquelle(öffnet in neuem Tab)Problem melden

Laravel Framework von Laravel

Laravel Framework 13.x: JsonFormatter eingeführt

Der neue Illuminate\Log\Formatters\JsonFormatter nimmt context()-Daten von Exceptions, auch aus verketteten vorherigen Exceptions, in strukturierte Logs auf.

Pull request by @cosmastech

Exception context is one of those things you only realize you needed after staring at production logs for hours. The new Illuminate\Log\Formatters\JsonFormatter ensures context() data on your custom exceptions actually shows up in structured logs, including context from previous exceptions in a chain. Wire it up in config/logging.php:

'formatter' => Illuminate\Log\Formatters\JsonFormatter::class,

Now an exception like this carries its enriched context all the way through to the log entry:

class MyException extends \RuntimeException
{
    public function context(): array
    {
        return [
            'luke' => 'cosmastech',
            'taylor' => 'taylorotwell',
        ];
    }
}

Whether the exception is sent through report() or written via Log::error() with an exception key, the structured payload now includes everything you put on the exception itself.

Originalquelle(öffnet in neuem Tab)Problem melden

Laravel Framework von Laravel

Laravel Framework 13.x: prefersJsonResponses() im Application Builder

Mit dem optionalen prefersJsonResponses() im Application Builder werden breite Accept-Header als JSON behandelt, während explizite text/html-Anfragen unverändert bleiben und der ursprüngliche Wert in X-Original-Accept erhalten bleibt.

Pull request by @WendellAdriel

Building an API and tired of curl requests coming back as HTML? One line in bootstrap/app.php now treats broad Accept headers as JSON, so auth redirects, validation errors, and exception pages all serialize properly for clients that didn't ask for HTML:

return Application::configure(basePath: dirname(__DIR__))
    ->withRouting(
        web: __DIR__.'/../routes/web.php',
        commands: __DIR__.'/../routes/console.php',
    )
    ->prefersJsonResponses()
    ->create();

Clients that explicitly request text/html are left alone, and the original Accept value is preserved on X-Original-Accept if you need it for logging. Default behavior is unchanged unless you opt in.

Originalquelle(öffnet in neuem Tab)Problem melden

Laravel Framework von Laravel

Laravel 13: Laravel AI SDK

Laravel 13 führt das erstklassige Laravel AI SDK ein, das eine einheitliche API für Textgenerierung, Tool-Calling-Agents, Embeddings, Audio, Bilder und Vector-Store-Integrationen bietet.

Laravel 13 introduces the first-party Laravel AI SDK, providing a unified API for text generation, tool-calling agents, embeddings, audio, images, and vector-store integrations.

With the AI SDK, you can build provider-agnostic AI features while keeping a consistent, Laravel-native developer experience.

For example, a basic agent can be prompted with a single call:

use App\Ai\Agents\SalesCoach;

$response = SalesCoach::make()->prompt('Analyze this sales transcript...');

return (string) $response;

The Laravel AI SDK can also generate images, audio, and embeddings:

For visual generation use cases, the SDK offers a clean API for creating images from plain-language prompts:

use Laravel\Ai\Image;

$image = Image::of('A donut sitting on the kitchen counter')->generate();

$rawContent = (string) $image;

For voice experiences, you can synthesize natural-sounding audio from text for assistants, narrations, and accessibility features:

use Laravel\Ai\Audio;

$audio = Audio::of('I love coding with Laravel.')->generate();

$rawContent = (string) $audio;

And for semantic search and retrieval workflows, you can generate embeddings directly from strings:

use Illuminate\Support\Str;

$embeddings = Str::of('Napa Valley has great wine.')->toEmbeddings();

Originalquelle(öffnet in neuem Tab)Problem melden

Laravel Framework von Laravel

Laravel 13: JSON:API Resources

Laravel enthält jetzt eigene JSON:API Resources, die Ressourcen-Serialisierung, Relationship-Inclusion, Sparse Fieldsets, Links und JSON:API-konforme Response-Header übernehmen.

Laravel now includes first-party JSON:API resources, making it straightforward to return responses compliant with the JSON:API specification.

JSON:API resources handle resource object serialization, relationship inclusion, sparse fieldsets, links, and JSON:API-compliant response headers.

Originalquelle(öffnet in neuem Tab)Problem melden

Laravel Framework von Laravel

Laravel 13: Request Forgery Protection

Die CSRF-Schutz-Middleware wurde als PreventRequestForgery formalisiert und um eine herkunftsbezogene Request-Prüfung erweitert, bleibt aber mit tokenbasiertem CSRF-Schutz kompatibel.

For security, Laravel's request forgery protection middleware has been enhanced and formalized as PreventRequestForgery, adding origin-aware request verification while preserving compatibility with token-based CSRF protection.

Originalquelle(öffnet in neuem Tab)Problem melden

Laravel Framework von Laravel

Laravel 13: Queue Routing per Klasse

Mit Queue::route(...) lassen sich Standard-Routing-Regeln für Connection und Queue bestimmter Jobs zentral festlegen.

Laravel 13 adds queue routing by class via Queue::route(...), allowing you to define default queue / connection routing rules for specific jobs in a central place:

Queue::route(ProcessPodcast::class, connection: 'redis', queue: 'podcasts');

Originalquelle(öffnet in neuem Tab)Problem melden

Laravel Framework von Laravel

Laravel 13: Erweiterte PHP Attributes

Laravel 13 erweitert die PHP-Attribut-Unterstützung, unter anderem um #[Middleware], #[Authorize], #[Tries], #[Backoff], #[Timeout] und #[FailOnTimeout], sowie um weitere Attribute für Eloquent, Events, Notifications, Validation, Testing und Resource-Serialisierung.

Laravel 13 continues to expand first-party PHP attribute support across the framework, making common configuration and behavioral concerns more declarative and colocated with your classes and methods.

Notable additions include controller and authorization attributes like #[Middleware] and #[Authorize], as well as queue-oriented job controls like #[Tries], #[Backoff], #[Timeout], and #[FailOnTimeout].

For example, controller middleware and policy checks can now be declared directly on classes and methods:

<?php

namespace App\Http\Controllers;

use App\Models\Comment;
use App\Models\Post;
use Illuminate\Routing\Attributes\Controllers\Authorize;
use Illuminate\Routing\Attributes\Controllers\Middleware;

#[Middleware('auth')]
class CommentController
{
    #[Middleware('subscribed')]
    #[Authorize('create', [Comment::class, 'post'])]
    public function store(Post $post)
    {
        // ...
    }
}

Additional attributes have also been introduced across Eloquent, events, notifications, validation, testing, and resource serialization APIs, giving you a consistent attribute-first option in more areas of the framework.

Originalquelle(öffnet in neuem Tab)Problem melden

Laravel Framework von Laravel

Laravel 13: Cache-TTL verlängern mit Cache::touch

Mit Cache::touch(...) lässt sich die TTL eines vorhandenen Cache-Eintrags verlängern, ohne den Wert abzurufen und neu zu speichern.

Laravel now includes Cache::touch(...), which lets you extend an existing cache item's TTL without retrieving and re-storing its value.

Originalquelle(öffnet in neuem Tab)Problem melden

Laravel Framework von Laravel

Laravel 13: Semantic / Vector Search, Inertia v3 Einführung

Laravel 13 bietet native Vector-Query-Unterstützung und Embedding-Workflows für semantische Suche mit PostgreSQL und pgvector, etwa über whereVectorSimilarTo, und der Eintrag kündigt zudem Inertia v3 mit integriertem XHR-Client, automatischem SSR in der Entwicklung, Vite-Plugin, Optimistic Updates, Instant Visits und useHttp an.

Laravel 13 deepens its semantic search story with native vector query support, embedding workflows, and related APIs documented across search, queries, and the AI SDK.

These features make it straightforward to build AI-powered search experiences using PostgreSQL + pgvector, including similarity search against embeddings generated directly from strings.

For example, you may run semantic similarity searches directly from the query builder:

$documents = DB::table('documents')
    ->whereVectorSimilarTo('embedding', 'Best wineries in Napa Valley')
    ->limit(10)
    ->get();

Inertia v3 is here — a ground-up rethink of the developer experience with a focus on zero-config setup, smaller bundles, and powerful new primitives for building modern apps. Axios and qs have been replaced with a built-in XHR client, SSR works automatically during development without a separate Node process, and a new Vite plugin eliminates nearly all boilerplate. On top of that, v3 introduces optimistic updates, instant visits, standalone HTTP requests via useHttp, layout props, and fine-grained exception handling — all designed to make Inertia apps feel faster to build and faster to use. Here's what's new:

Originalquelle(öffnet in neuem Tab)Problem melden

Laravel Framework von Laravel

Laravel 12.x: temporaryUploadUrl für das local-Filesystem

Temporäre Upload-URLs über temporaryUploadUrl lassen sich jetzt auch mit dem local-Driver erzeugen, was konsistente Upload-Abläufe in lokalen, Staging- und Produktionsumgebungen erleichtert.

Pull request by @mnapoli

You can now generate temporary upload URLs even when you're using the local driver, making it much easier to build consistent upload flows across local, staging, and production environments.

use Illuminate\Support\Facades\Storage;

$url = Storage::disk('local')->temporaryUploadUrl(
    'uploads/incoming/video.mp4',
    now()->addMinutes(10),
    ['Content-Type' => 'video/mp4']
);

Originalquelle(öffnet in neuem Tab)Problem melden

Laravel Framework von Laravel

Laravel 12.x: makeMany-Methode für Factories

Die neue Methode makeMany() erzeugt mehrere Modellinstanzen im Speicher, ohne sie zu persistieren.

Pull request by @jackbayliss

makeMany() gives you a clean, expressive way to generate multiple in-memory model instances without persisting anything. It's ideal for tests, previews, and shaping data before a write.

$users = User::factory()->makeMany(3);

$payload = $users->map->only(['name', 'email']);

Originalquelle(öffnet in neuem Tab)Problem melden

Laravel Framework von Laravel

Laravel 12.x: Closures für Werte in firstOrCreate und createOrFirst

Bei firstOrCreate und createOrFirst können Attributwerte nun als Closure übergeben werden und werden nur berechnet, wenn der Datensatz tatsächlich erstellt wird.

Pull request by @gcavanunez

You can now lazily compute attribute values only when a record is actually being created. That means fewer unnecessary queries and less wasted work when the model already exists.

$location = Location::firstOrCreate(
    ['address' => $address],
    fn () => ['coordinates' => Geocoder::resolve($address)],
);

Originalquelle(öffnet in neuem Tab)Problem melden

Laravel Framework von Laravel

Laravel 12.x: afterSending-Methode für Notifications

Notifications unterstützen die Methode afterSending(), die nach dem Versand einer Benachrichtigung aufgerufen wird, etwa für Audit-Logging, Metriken oder Aufräumarbeiten.

Pull request by @gdebrauwer

afterSending() lets you hook into the lifecycle after a notification is dispatched, which is perfect for audit logging, metrics, or cleanup work without cluttering your notification channels.

class BookingNotification extends Notification
{
    public function __construct(
		public Booking $booking;
	) {
        //
	}

	public function via()
	{
		return ['mail'];
	}

	public function toMail()
	{
		// ...
	}

	public function afterSending($notifiable, $channel, $response)
	{
		$this->booking->update(['notified_at' => now()]);
	}
}

Originalquelle(öffnet in neuem Tab)Problem melden

Laravel Framework von Laravel

Laravel 12.x: whenFails und whenPasses im Validator

Der Validator erhält die Methoden whenFails und whenPasses, die vor allem bei Validierungen außerhalb des Request-Zyklus nützlich sind.

Pull request by @gdebrauwer

These helpers are particularly useful when you use the validator to validate data outside the request cycle where the error would not get picked up automatically by the HTTP handler.

Validator::make(
    ['file' => $file],
    ['file' => 'required|image|dimensions:min_width=100,min_height=200']
)->whenFails(function () {
    throw new InvalidArgumentException('Provided file is invalid');
});

Originalquelle(öffnet in neuem Tab)Problem melden

Laravel Framework von Laravel

Laravel 12.x: withoutHeader-Methode für Responses

Mit der neuen Methode withoutHeader() lassen sich Header wie Caching- oder Debug-Header aus einer Response entfernen.

Pull request by @miladev95

Removing headers is now straightforward with withoutHeader(), which is handy when you need to strip inherited headers (like caching or debug headers) before returning a response.

return response($content)->withoutHeader('X-Debug');

Originalquelle(öffnet in neuem Tab)Problem melden

Laravel Framework von Laravel

Laravel 12.x: Keine ASCII-Art-SVG auf Exception-Seite außerhalb des Browsers

Konsolen- und andere Nicht-Browser-Kontexte erhalten die dekorative ASCII-SVG der Exception-Seite nicht mehr, wodurch die Fehlerausgabe in Logs, CI, Agenten und API-Antworten sauberer wird.

Pull request by @serhiilabs

Console and non-browser contexts no longer receive the decorative ASCII SVG payload, keeping error output cleaner in logs, CI, agent, and API responses. Furthermore...

Originalquelle(öffnet in neuem Tab)Problem melden

Laravel Framework von Laravel

Laravel 12.x: ASCII-SVG-Logo der Exception-Seite per JavaScript

Die ASCII-SVG auf der Exception-Seite wird nun dynamisch mit JavaScript erzeugt, was die Ausgabe schlanker und für unterschiedliche Darstellungskontexte besser geeignet macht.

Pull request by @markjaquith

The exception page ASCII SVG is now generated on the fly with JavaScript, keeping output leaner and better suited to different rendering contexts.

Originalquelle(öffnet in neuem Tab)Problem melden

Laravel Framework von Laravel

Laravel 12.x: Typisierte Getter für den Cache

Der Cache bietet typisierte Getter wie Cache::integer() und Cache::boolean(), die wiederholtes Casting überflüssig machen.

Pull request by @ahinkle

Typed cache getters reduce repetitive casting and make intent obvious when reading cached values, helping you avoid subtle bugs from unexpected types.

$count = Cache::integer('downloads.count', 0);
$enabled = Cache::boolean('features.new_checkout', false);

Originalquelle(öffnet in neuem Tab)Problem melden

Laravel Framework von Laravel

Laravel Framework 12.x: temporaryUploadUrl für das lokale Filesystem

Temporäre Upload-URLs lassen sich nun auch mit dem local-Treiber über temporaryUploadUrl erzeugen.

Pull request by @mnapoli

You can now generate temporary upload URLs even when you're using the local driver, making it much easier to build consistent upload flows across local, staging, and production environments.

use Illuminate\Support\Facades\Storage;

$url = Storage::disk('local')->temporaryUploadUrl(
    'uploads/incoming/video.mp4',
    now()->addMinutes(10),
    ['Content-Type' => 'video/mp4']
);

Originalquelle(öffnet in neuem Tab)Problem melden