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

Laravel 13.x: Password-Regel als passwordrules-String ausgeben

Die neue Methode toPasswordRulesString() an der Password-Regel wandelt Validierungsvorgaben in das HTML-Attribut passwordrules um, damit Passwortmanager passende Passwörter erzeugen können.

Pull request by @imliam

Password managers like 1Password and Safari can read the passwordrules HTML attribute to generate passwords that satisfy your app's policy - no more rejected passwords and frustrated users at registration. The new toPasswordRulesString() method on the Password rule converts your validation constraints into the right format automatically.

<input
    type="password"
    autocomplete="new-password"
    passwordrules="{{ Password::defaults()->toPasswordRulesString() }}"
/>

The method maps directly from your existing validation rules:

Password::min(12)->max(64)->mixedCase()->numbers()->symbols()->toPasswordRulesString()
// 'minlength: 12; maxlength: 64; required: lower; required: upper; required: digit; required: special;'

Originalquelle(öffnet in neuem Tab)Problem melden

Laravel Framework von Laravel

Laravel 13.x: Jobs können auf Worker-Signale reagieren

Das neue Interface Interruptible erlaubt laufenden Jobs, bei einem SIGTERM des Queue-Workers etwa Schleifen zu stoppen, Locks freizugeben oder den Zustand zu sichern.

Pull request by @jackbayliss

When a queue worker receives a SIGTERM during a deployment, any running job normally has no idea it's about to be cut off. The new Interruptible interface lets jobs react - stop loops, release locks, save state - before the worker shuts down.

use Illuminate\Contracts\Queue\Interruptible;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Queue\Queueable;

class SignalJob implements ShouldQueue, Interruptible
{
    use Queueable;

    protected bool $stop = false;

    public function handle(): void
    {
        while (!$this->stop) {
            sleep(1);
            // Do work...
        }
    }

    public function interrupted(int $signal): void
    {
        $this->stop = true;
    }
}

Originalquelle(öffnet in neuem Tab)Problem melden

Laravel Framework von Laravel

Laravel 13.x: Umgebungsfilter für schedule:list

Das neue Flag --environment bei schedule:list zeigt nur die Tasks an, die in der angegebenen Umgebung tatsächlich laufen.

Pull request by @m-fi

Running schedule:list on production used to show every registered task - including those that only run locally. A new --environment flag filters the output to just the tasks that actually run in the specified environment.

php artisan schedule:list --environment=production

Originalquelle(öffnet in neuem Tab)Problem melden

Laravel Framework von Laravel

Laravel 13.x: Option --stop-when-empty-for für den Queue-Worker

Die neue Option --stop-when-empty-for bei queue:work beendet den Worker, nachdem er eine festgelegte Anzahl Sekunden untätig war.

Pull request by @taylorotwell

A new --stop-when-empty-for option on queue:work stops the worker after it has been idle for a configurable number of seconds. Useful for auto-scaling setups where workers should wind down rather than sit idle indefinitely.

php artisan queue:work --stop-when-empty-for=60

Originalquelle(öffnet in neuem Tab)Problem melden

Laravel Framework von Laravel

Laravel 13.x: Schema-Helper foreignUuidFor

Der neue Migrations-Helper foreignUuidFor leitet Spaltenname, Zieltabelle und Primärschlüssel aus dem Model ab, wie foreignIdFor, jedoch für UUID-basierte Beziehungen.

Pull request by @Tresor-Kasenda

A new foreignUuidFor migration helper joins foreignIdFor in the schema builder. It infers the column name, related table, and referenced primary key from the model - the same convenience as foreignIdFor, but explicitly for UUID-backed relationships.

$table->foreignUuidFor(User::class)->constrained();

Originalquelle(öffnet in neuem Tab)Problem melden

Laravel Framework von Laravel

Laravel 13.x: cache:clear kann per prohibit() gesperrt werden

ClearCommand (cache:clear) unterstützt nun prohibit(), denselben Schutzmechanismus wie bei db:fresh und migrate:fresh, etwa für gehostete Umgebungen.

Pull request by @jackbayliss

cache:clear now supports prohibit(), the same opt-in protection mechanism available on db:fresh, migrate:fresh, and other commands you'd want to block in hosted environments.

ClearCommand::prohibit($inHostedEnvironments);

Originalquelle(öffnet in neuem Tab)Problem melden

Laravel Framework von Laravel

Laravel 13.x: Parameter normalize für Str::studly() und Str::pascal()

Mit dem optionalen Parameter normalize: true werden komplett großgeschriebene Wortsegmente vor der Umwandlung in Kleinbuchstaben gesetzt, sodass etwa aus CBOR das Ergebnis Cbor wird; der Standardwert false erhält das bisherige Verhalten.

Pull request by @hotmeteor

All-caps strings like CBOR or ALL_CAPS used to pass through Str::studly() unchanged - ucfirst has nothing to do when every letter is already uppercase. An optional normalize: true parameter lowercases all-uppercase word segments before conversion, giving you the expected output.

Str::studly('CBOR', normalize: true)      // 'Cbor'
Str::studly('ALL_CAPS', normalize: true)  // 'AllCaps'

Mixed-case strings are left untouched, and the default is false so existing behavior is preserved.

Originalquelle(öffnet in neuem Tab)Problem melden

Laravel Framework von Laravel

Neuer Cache-Store storage

Das Cache-System unterstützt jetzt einen dateisystembasierten storage-Treiber, mit dem sich ein vorhandener Disk wie S3 als Key/Value-Cache nutzen lässt.

Pull request by @taylorotwell

Laravel's cache system now supports a storage driver backed by the filesystem, making it straightforward to use an existing disk - like S3 - as a key/value cache without any additional infrastructure.

Originalquelle(öffnet in neuem Tab)Problem melden

Laravel Framework von Laravel

Password::toPasswordRulesString() für passwordrules-Attribut

Die neue Methode toPasswordRulesString() der Password-Regel wandelt Validierungsregeln in einen passwordrules-String um, damit Passwortmanager wie 1Password und Safari konforme Passwörter erzeugen können.

Pull request by @imliam

Password managers like 1Password and Safari can read the passwordrules HTML attribute to generate passwords that satisfy your app's policy - no more rejected passwords and frustrated users at registration. The new toPasswordRulesString() method on the Password rule converts your validation constraints into the right format automatically.

<input
    type="password"
    autocomplete="new-password"
    passwordrules="{{ Password::defaults()->toPasswordRulesString() }}"
/>

The method maps directly from your existing validation rules:

Password::min(12)->max(64)->mixedCase()->numbers()->symbols()->toPasswordRulesString()
// 'minlength: 12; maxlength: 64; required: lower; required: upper; required: digit; required: special;'

Originalquelle(öffnet in neuem Tab)Problem melden

Laravel Framework von Laravel

Environment-Filter für den Befehl schedule:list

Mit dem neuen Flag --environment zeigt schedule:list nur noch die Tasks an, die in der angegebenen Umgebung tatsächlich laufen.

Pull request by @m-fi

Running schedule:list on production used to show every registered task - including those that only run locally. A new --environment flag filters the output to just the tasks that actually run in the specified environment.

php artisan schedule:list --environment=production

Originalquelle(öffnet in neuem Tab)Problem melden

Laravel Framework von Laravel

Neuer Schema-Helper foreignUuidFor

Der neue Migrations-Helper foreignUuidFor leitet Spaltenname, verknüpfte Tabelle und Primärschlüssel aus dem Model ab und ist für UUID-basierte Beziehungen gedacht.

Pull request by @Tresor-Kasenda

A new foreignUuidFor migration helper joins foreignIdFor in the schema builder. It infers the column name, related table, and referenced primary key from the model - the same convenience as foreignIdFor, but explicitly for UUID-backed relationships.

$table->foreignUuidFor(User::class)->constrained();

Originalquelle(öffnet in neuem Tab)Problem melden

Laravel Framework von Laravel

cache:clear unterstützt jetzt prohibit()

Der Befehl cache:clear lässt sich nun wie db:fresh und migrate:fresh mit prohibit() sperren, etwa in gehosteten Umgebungen.

Pull request by @jackbayliss

cache:clear now supports prohibit(), the same opt-in protection mechanism available on db:fresh, migrate:fresh, and other commands you'd want to block in hosted environments.

ClearCommand::prohibit($inHostedEnvironments);

Originalquelle(öffnet in neuem Tab)Problem melden

Laravel Framework von Laravel

Parameter normalize für Str::studly() und Str::pascal()

Ein optionaler Parameter normalize: true wandelt komplett großgeschriebene Wortsegmente vor der Konvertierung in Kleinbuchstaben um, sodass etwa 'CBOR' zu 'Cbor' wird; der Standardwert false erhält das bisherige Verhalten.

Pull request by @hotmeteor

All-caps strings like CBOR or ALL_CAPS used to pass through Str::studly() unchanged - ucfirst has nothing to do when every letter is already uppercase. An optional normalize: true parameter lowercases all-uppercase word segments before conversion, giving you the expected output.

Str::studly('CBOR', normalize: true)      // 'Cbor'
Str::studly('ALL_CAPS', normalize: true)  // 'AllCaps'

Mixed-case strings are left untouched, and the default is false so existing behavior is preserved.

Originalquelle(öffnet in neuem Tab)Problem melden

Laravel Framework von Laravel

Laravel 13.x: Debounceable Queued Jobs

Queued Jobs lassen sich mit dem Attribut #[DebounceFor] oder direkt beim Dispatch so debouncen, dass innerhalb eines Zeitfensters nur der letzte Dispatch ausgeführt wird, und für ersetzte Jobs wird ein JobDebounced-Event ausgelöst.

Pull request by @matthewnessworthy

Bursty workloads finally have a clean answer. Debounceable jobs keep only the last dispatch in a window, so a user editing the same document ten times in thirty seconds triggers a single rebuild instead of ten. Apply the #[DebounceFor] attribute to any queued job, or debounce at the call site without touching the class:

use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Queue\Attributes\DebounceFor;

#[DebounceFor(30)]
class RebuildSearchIndex implements ShouldQueue
{
    public function __construct(public int $documentId) {}

    public function debounceId(): string
    {
        return (string) $this->documentId;
    }

    public function handle(): void
    {
        SearchIndex::rebuild($this->documentId);
    }
}

Where ShouldBeUnique keeps the first dispatch and rejects the rest, debouncing flips that around so the most recent dispatch always wins. A JobDebounced event fires for any superseded job if you want to track it. Read more in the queue documentation.

Originalquelle(öffnet in neuem Tab)Problem melden

Laravel Framework von Laravel

Laravel 13.x: Health-Route liefert JSON

Die eingebaute Health-Route /up gibt nun JSON zurück, wenn die Anfrage dies verlangt, während Statuscodes und die Blade-Seite für Browser unverändert bleiben.

Pull request by @WendellAdriel

API-only apps can stop scraping HTML from /up. The built-in health route now returns JSON when the request asks for it, which makes load balancers, uptime monitors, and orchestrators a lot happier:

{ "status": "Application is up" }

Status codes stay the same, and browser requests still get the existing Blade page. No config required.

Originalquelle(öffnet in neuem Tab)Problem melden

Laravel Framework von Laravel

Laravel 13.x: Neuer JsonFormatter für Exception-Kontext

Der neue Illuminate\Log\Formatters\JsonFormatter übernimmt context()-Daten benutzerdefinierter Exceptions, auch aus verketteten Vorgänger-Exceptions, in strukturierte Logs.

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 13.x: prefersJsonResponses() im Application Builder

Mit prefersJsonResponses() in bootstrap/app.php werden breite Accept-Header als JSON behandelt, explizite text/html-Anfragen bleiben unberührt und der ursprüngliche Wert steht in X-Original-Accept.

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.x: Unterstützung für Cloudflare Email Service

Laravel unterstützt den Cloudflare Email Service nun als Mailer, konfigurierbar über account_id und token in config/services.php.

Pull request by @dwightwatson

Cloudflare's Email Service joins the list of first-class mailers in Laravel. Drop your credentials into config/services.php:

'cloudflare' => [
    'account_id' => env('CLOUDFLARE_ACCOUNT_ID'),
    'token' => env('CLOUDFLARE_TOKEN'),
],

Then point your mailer at it and send like usual. Same Symfony HTTP Client setup the existing transports use, so there's nothing new to learn.

Originalquelle(öffnet in neuem Tab)Problem melden

Laravel Framework von Laravel

Laravel 13.x: Redis-Cluster-Unterstützung für Queue und ConcurrencyLimiter

Laravels Redis-Queue und ConcurrencyLimiter versehen Queue-Namen bei Cluster-Verbindungen automatisch mit Hash-Tags, was CROSSSLOT-Fehler vermeidet, und der PhpRedis-Cluster-Connector unterstützt zudem ACL-Authentifizierung sowie Retry/Backoff.

Pull request by @timmylindh

If you've ever fought a CROSSSLOT error on AWS ElastiCache Serverless or any Redis Cluster setup, this one is for you. Laravel's Redis queue and ConcurrencyLimiter now wrap queue names in hash tags automatically when they detect a cluster connection, so all related keys land on the same slot:

queues:{default}            -> slot for "default"
queues:{default}:delayed    -> slot for "default"
queues:{default}:reserved   -> slot for "default"
queues:{default}:notify     -> slot for "default"

Different queues still distribute across the cluster, the same pattern Sidekiq and BullMQ use. The PhpRedis cluster connector also picks up ACL auth and retry/backoff parity with standalone connections, which matters during ElastiCache scaling events. Standalone users see zero change. The full breakdown is in the queue documentation.

Originalquelle(öffnet in neuem Tab)Problem melden

Laravel Framework von Laravel

Laravel 13.x: Queue-Methoden zum Inspizieren von Jobs

Die Queue-Facade bietet mit pendingJobs(), delayedJobs() und reservedJobs() neue Methoden, die InspectedJob-Collections mit uuid, Jobname, Versuchen und Erstellzeit liefern, und die mit Redis und Database funktionieren.

Pull request by @jackbayliss

Three new methods on the Queue facade let you peek at what is actually sitting on your queues without reaching for DB::table() and decoding payloads by hand:

Queue::pendingJobs();
Queue::delayedJobs();
Queue::reservedJobs();

Each returns a collection of InspectedJob instances exposing the uuid, job name, attempts, and creation time. That opens up some genuinely useful patterns:

Queue::reservedJobs('high-priority-queue')->first()->name;
// => 'App\Jobs\SendEmail'

Queue::pendingJobs()->countBy('name');
// => ['App\Jobs\SendEmail' => 1842, 'App\Jobs\ProcessOrder' => 43]

Perfect for deployment scripts that need to wait for specific jobs to finish, dashboards, and ad-hoc debugging. Works with the Redis and Database drivers; other drivers return an empty collection.

Originalquelle(öffnet in neuem Tab)Problem melden