Laravel 开源生态更新日志(2025年9月)
Laravel 开源生态的最新更新和改进。
Laravel Framework 12.x
[12.x] Introduce after Rate Limiting
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.
[12.x] Add Http::batch
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.
[12.x] Adds Macroable Trait to Illuminate/Support/Benchmark
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.
[12.x] Add --whisper Option to schedule:work Command
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.
[12.x]: Cache Session Driver
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.
[12.x] Add Support for #[UseResource(...)] and #[UseResourceCollection(...)] Attributes on Models
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.
[12.x] Add --json Option to schedule:list
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.
[12.x] Add Prepend Option for Str::plural()
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.
[12.x] Add Support for SQS Fair Queue
Pull request by @crynobone
SQS fair queues are now supported.
[12.x] Update Local Exception Page
Pull request by @avosalmon

The exception page was given a refresh, making local errors clearer and more actionable.
NPM Trusted Publishing
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.

Inertia
Introduction of the <InfiniteScroll> Component
Pull request by @pascalbaljet
<template>
<InfiniteScroll data="users">
<div v-for="user in users.data" :key="user.id">{{ user.name }}</div>
</InfiniteScroll>
</template>A new <InfiniteScroll> component was introduced for React, Vue, and Svelte that allows you to easily create infinite scroll interfaces by wrapping your items in the new component.
Support for Merging Nested Prop Paths
Pull request by @pascalbaljet
A new middle ground was added between Inertia::merge() and Inertia::deepMerge() so you can have fine-grained control over what should be merged.
The front-end will replace the entire object, except the data array. The new items will be appended to the existing items:
Inertia::merge(User::paginate())->append('data');There's also prepend(), and you can also combine multiple calls:
Inertia::merge($complexObject)
->append('users', matchOn: 'username')
->prepend('messages.data');Then there's a new Inertia::scroll() function which you can pass paginated resources:
Inertia::scroll(User::paginate());Progress Indicator API
Pull request by @pascalbaljet
import { progress } from "@inertiajs/vue3";
progress.start(); // Begin progress animation
progress.set(0.25); // Set to 25% complete
progress.finish(); // Complete and fade out
progress.reset(); // Reset to start
progress.remove(); // Complete and remove from DOM
progress.hide(); // Hide progress bar
progress.reveal(); // Show progress bar
progress.isStarted(); // Returns boolean
progress.getStatus(); // Returns current percentage or nullThe internal methods used to drive the Progress indicator are now exposed publicly, giving developers control over the progress bar.
Boost
[1.x] Adds boost:update + Allows Package Authors to Publish Guidelines
Pull request by @nunomaduro
Boost can now self-update with the new boost:update command. In addition, third-party packages can now auto-register their own guidelines by including a resources/boost/guidelines/core.blade.php file in their package.
Allow Guideline Overriding
Pull request by @ashleyhindle
Users can now override guideline files, specifying that Boost should use their guidelines in specific instances instead of the default guidelines that come with Boost.
Echo
Add stopListeningForNotification
Pull request by @thoresuenert
const callback = (notification) => {
console.log(notification.type);
};
// Start listening...
Echo.private(`App.Models.User.${userId}`).notification(callback);
// Stop listening (callback must be the same)...
Echo.private(`App.Models.User.${userId}`).stopListeningForNotification(
callback
);A new stopListeningForNotification method was added to stop listening for notifications without leaving the channel.
Fortify
Regenerate Session on Register
Pull request by @valorin
The session and session and CSRF token are now regenerated on user registration.
Installer
Check for New Version of Installer on new
Pull request by @joetannenbaum
The installer now checks if there are updates available on Packagist to ensure you are using the latest version when running laravel new.
Support PNPM and Yarn Package Managers
Pull request by @adrum
The installer now detects lock files for the PNPM and Yarn package managers, falling back to NPM if neither are found.
Add the Ability to Use a Git Repo as Custom Kit
Pull request by @adrum
laravel new --using https://gitub.com/user/projectYou can specify a git repo as a custom starter kit when running laravel new.
MCP
First Official "Beta" Release of Laravel MCP Package
https://github.com/laravel/mcp
Laravel MCP allows you to rapidly build MCP servers for your Laravel applications. MCP servers allow AI clients to interact with your Laravel application through the Model Context Protocol.
Prompts
Improve Display of Progress Bars With High Step Counts
Pull request by @jessarcher

The display of the progress bar when using a large number of steps is improved by adding thousands separators and extra spacing.
Reverb
[1.x] Adds Optional Application Level Connection Limits
Pull request by @joedixon
You can specify connection limits for those users who wish to limit the number of active connections to a given application as supported by the Pusher protocol.
VS Code Extension
Add Commands That Refactor Class Attributes in Blade Files
Pull request by @N1ebieski

Commands are now available that refactor the selected or all class attributes to the @class directive.
Add a Command That Wraps Selected Text With a Helper
Pull request by @N1ebieski

Commands are now available that wrap the selected text with a helper, such as dd, collect, dump, and str.
Pint Commands + Run Pint on Save
Pull request by @joetannenbaum
Commands are now available to "Run Pint", "Run Pint on Dirty Files", and "Run Pint on Current File". There is also now an optiont to run Pint on save for the current file.