Laravel 开源生态更新日志(2026年3月)
Laravel 开源生态的最新更新和改进。
Laravel 13
Laravel 13 continues Laravel's annual release cadence with a focus on AI-native workflows, stronger defaults, and more expressive developer APIs. This release includes first-party AI primitives, JSON:API resources, semantic / vector search capabilities, and incremental improvements across queues, cache, and security.
Laravel AI SDK
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();JSON:API Resources
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.
Request Forgery Protection
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.
Queue Routing
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');Expanded PHP Attributes
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.
Cache TTL Extension
Laravel now includes Cache::touch(...), which lets you extend an existing cache item's TTL without retrieving and re-storing its value.
Semantic / Vector Search
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
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:
Vite Plugin
A new @inertiajs/vite plugin eliminates the boilerplate that traditionally lived in your app entry point — no more manual resolve, setup, or separate SSR entry files. Pages auto-resolve from ./Pages, code splitting and lazy-loading are handled automatically, and SSR is wired up with zero config. Your app entry point can be as simple as createInertiaApp() with no arguments. A new withApp callback also lets you modify the root app instance (register plugins, provide values) before rendering, on both client and server.
SSR in Development
SSR now works automatically during npm run dev — no separate Node.js process required. Pages are server-rendered out of the box in development, while the production workflow (vite build && vite build --ssr) remains unchanged. Error reporting has been overhauled: errors now log the component name, URL, and actionable hints, and a SsrRenderFailed event is dispatched for monitoring. You can also disable SSR on specific routes via middleware or the Inertia facade.
Axios Removed
Axios and qs have been removed as dependencies entirely. A lighter built-in XHR client handles all HTTP communication, reducing bundle size and the dependency footprint. If you rely on Axios interceptors or other Axios-specific features, an adapter is available to keep things working during your migration.
Standalone HTTP Requests
A new useHttp hook brings useForm-like ergonomics to plain HTTP requests outside of Inertia's page lifecycle. It provides reactive state management, error handling, file upload progress tracking, and request cancellation — ideal for API calls, external service requests, or any HTTP interaction that doesn't involve an Inertia page visit. It also supports optimistic updates and Precognition out of the box.
Optimistic Updates
UI updates now apply immediately before server confirmation via a chainable .optimistic() method. Your callback receives current props and returns the optimistic values, which are applied instantly. When the server responds, real data takes over seamlessly — and if the request fails, changes auto-revert. Multiple concurrent optimistic updates are tracked independently, and the feature works across router visits, <Form>, useForm, and useHttp.
Instant Visits
Navigate to a target page component immediately while the server request fires in the background. The page renders right away using shared props, giving the user an instant transition, and page-specific props merge in when the server responds. This is especially effective for pages where the layout and shell can render before data-heavy content arrives.
Layout Props
Layouts now receive props directly as regular component props via a tuple syntax: layout: [AppLayout, { title: 'Dashboard' }]. Pages can derive layout props dynamically from page data using a callback, and update them at any time via setLayoutProps(). This eliminates the need for event buses or provide/inject patterns. Named layouts and nested layouts are fully supported.
Exception Handling
Inertia::handleExceptionsUsing() gives full control over how exceptions like 404s and 500s are rendered — including exceptions that occur outside of Inertia's middleware. Use withSharedData() to explicitly include shared props in error pages, or return null to fall through to Laravel's default exception rendering.
Nested Prop Types
Inertia::optional(), Inertia::defer(), and Inertia::merge() now work inside nested arrays with dot-notation support for partial reloads, giving you more granular control over which parts of your response are loaded and when.
Form Component Generics
TypeScript generics on the <Form> component provide type-safe errors and slot props, improving the developer experience for TypeScript users.
Blade Components
New <x-inertia::app> and <x-inertia::head> Blade components serve as alternatives to the @inertia and @inertiaHead directives. <x-inertia::app> accepts an optional id attribute (defaults to "app"), and <x-inertia::head> supports a fallback slot for when SSR is unavailable.
Event System Changes
The event system has been renamed for clarity: invalid is now httpException and exception is now networkError, with corresponding per-visit callbacks onHttpException and onNetworkError.
Vite 8 Support
Supports Vite 7 and 8, with Vite 6 dropped. The internal utility library has also been migrated from lodash-es to es-toolkit, a modern tree-shakable alternative (raising the minimum JS target to ES2022).
Read the upgrade guide: https://inertiajs.com/docs/v3/getting-started/upgrade-guide
Starter Kits
Our first-party starter kits have all been upgraded to use Laravel 13 and Inertia v3 from day one. Spin up a fresh app with the latest stack today!
Teams
We also shipped the new Teams feature across all starter kit flavors, giving you out-of-the-box team management screens for creating teams, switching between teams, inviting members, and updating team details.
AI SDK
Add Failover Support for Insufficient Credits and Quota Errors
Pull request by @meirdick
When a provider runs out of credits or hits a quota limit, Laravel AI now automatically fails over to your next configured provider instead of throwing an exception. Billing errors from Anthropic, OpenAI, OpenRouter, and DeepSeek are all detected and routed through the standard failover mechanism - no code changes required.
Add Support for Configuring Provider Options on Agents
Pull request by @shafimsp
Agents can now pass provider-specific options - like OpenAI's reasoning.effort - by implementing the new HasProviderOptions interface. This is especially useful for reasoning models where the default effort level may burn unnecessary tokens for simple tasks:
use Laravel\Ai\Contracts\Agent;
use Laravel\Ai\Contracts\HasProviderOptions;
class MyAgent implements Agent, HasProviderOptions
{
use Promptable;
public function providerOptions(): array
{
return [
'reasoning' => ['effort' => 'low'],
];
}
}Boost
Add laravel-best-practices Skill
Pull request by @pushpak1300
A new built-in skill covering 125+ best practices across 21 categories, from database performance and security to caching, testing, and deployment. Your AI agent now has a comprehensive reference for writing idiomatic Laravel code.
Add Security Audit to add-skill Command
Pull request by @pushpak1300
When you install a third-party skill, Boost now runs a non-blocking security audit via partner services. Results appear as a color-coded table so you can make an informed decision before proceeding. Skip it anytime with --skip-audit:
php artisan boost:add-skill owner/repo --all
php artisan boost:add-skill owner/repo --all --skip-auditAdd Upgrade Laravel v13 MCP Prompt
Pull request by @pushpak1300
A new MCP prompt that walks your AI assistant through upgrading from Laravel 12.x to 13.0. It auto-registers for apps running Laravel 12 and disappears once the upgrade is complete.
Add UpgradeInertiaV3 Prompt for Inertia v2 to v3 Upgrades
Pull request by @pushpak1300
Similar to the Laravel 13 upgrade prompt, this one provides step-by-step guidance for moving from Inertia v2 to v3. It detects your frontend framework (React, Vue, or Svelte) and renders only the relevant migration steps.
Support JSON-Formatted Log Entries in Log Reading Tools
Pull request by @HeathNaylor
Boost's log reading tools now auto-detect JSON-formatted logs and parse them correctly. If you're using Monolog's JsonFormatter, LogstashFormatter, or LogglyFormatter, the LastError and ReadLogEntries tools handle them seamlessly alongside standard PSR-3 logs.
Add --discover Flag to boost:update
Pull request by @MrPunyapal
Running php artisan boost:update --discover now detects new guideline packages and skills that have been published since your last update, prompting you to select which ones to add.
Add Support for Ampcode
Pull request by @dringrayson
Amp is now a supported AI agent in Boost. Running boost:install will detect and configure the MCP server for Amp automatically, bringing it to parity with Claude Code, Cursor, Windsurf, and others.
Add Summary Mode to DatabaseSchema Tool
Pull request by @sulimanbenhalim
The DatabaseSchema tool now accepts a summary parameter that returns only table names and column types - roughly 83% fewer tokens. AI agents can call summary first for an overview, then drill down with filter on specific tables when they need the full picture.
Envoy
Allow Calling Stories From Other Stories
Pull request by @vpratfr
Stories can now reference other stories, making it easy to compose complex deployment workflows from reusable building blocks:
@story('deploy')
build
migrate
@endstory
@story('full-deploy')
deploy
clear-caches
notify-team
@endstoryLivewire Starter Kit
Add Blaze
Pull request by @joetannenbaum
The Livewire starter kit now ships with Caleb Porzio's Blaze compiler, resulting in up to 97% reduction in compilation overhead.
MCP
Add Image and Audio Content Types With Storage Integration
Pull request by @pushpak1300
MCP tools can now return images and audio natively. A new Response::fromStorage() method auto-detects content type from your Laravel filesystem and handles the base64 encoding for you:
// From raw binary data
Response::image($rawBytes, 'image/png');
Response::audio($rawBytes, 'audio/wav');
// From any Laravel disk with automatic MIME detection
Response::fromStorage('photos/avatar.jpg');
Response::fromStorage('recordings/clip.mp3', disk: 's3');Passport
Add Middleware Attribute
Pull request by @axlon
A new TokenCan attribute lets you declare required token scopes directly on controller methods:
class PhotoController
{
#[TokenCan('read')]
public function index() { /* ... */ }
#[TokenCan('write')]
public function store() { /* ... */ }
}Allow Custom Middleware to Be Registered
Pull request by @timacdonald
You can now add custom middleware to Passport's registered routes via config - great for enforcing rules like UUID validation on client_id before it ever hits the database.
Pint
Adds Pint/phpdoc_type_annotations_only Custom Rule
An opt-in rule that strips all PHPDoc comments except type annotations. Enable it in your pint.json:
{
"Pint/phpdoc_type_annotations_only": true
}Before:
/**
* Register any application services.
*/
public function register(): voidAfter:
public function register(): voidType annotations like @var list<string> are preserved. The config directory is excluded by default. Best suited for new projects - enable with care on existing codebases.
Improvement to fully_qualified_strict_types Rule
Now enabled by default in the Laravel preset, this improvement automatically converts fully qualified class names in PHPDoc annotations to regular imports:
+ use Database\Factories\UserFactory;
class User extends Authenticatable
{
- /** @use HasFactory<\Database\Factories\UserFactory> */
+ /** @use HasFactory<UserFactory> */
use HasFactory, Notifiable;This applies automatically when you update Pint.
Precognition
[2.x] Replace Axios With Built-in fetch Client
Pull request by @pascalbaljet
Precognition v2 ships with a built-in fetch-based HTTP client, dropping Axios as a hard dependency and reducing bundle size by up to 50%. The new client handles XSRF tokens, FormData conversion, and AbortController support out of the box. If you still need Axios for interceptors or other features, an adapter is provided:
import { client, axiosAdapter } from "laravel-precognition";
client.useHttpClient(axiosAdapter());Prompts
Datatable Prompt
Pull request by @joetannenbaum
A brand new prompt for browsing, searching, and selecting from tabular data. Navigate with arrow keys, press / to search across all columns, or pass a filter closure for custom logic:
$selected = datatable(
label: 'Select a team member',
headers: ['Name', 'Twitter', 'Role'],
rows: [
'taylor' => ['Taylor Otwell', '@taylorotwell', 'CEO'],
'jess' => ['Jess Archer', '@jessarchercodes', 'Developer'],
],
);Title Prompt
Pull request by @joetannenbaum
Set and update the terminal window title at any point during execution:
title('Deploying to Cloud...');
// ... work happens ...
title('Deployed!');Stream Prompt
Pull request by @joetannenbaum
Stream text to the terminal with automatic word wrapping and a pleasant fade-in effect - perfect for displaying AI responses in real time:
$stream = stream();
foreach ($events as $event) {
$stream->append($event->delta);
}
$stream->close();Task Prompt
Pull request by @joetannenbaum
Display output from a running task with a spinner, real-time label updates, and scrollable log lines. Handles ANSI escape sequences and supports partial-line output for streaming.
task('Installing dependencies', function (Logger $log) {
Process::run(
'composer install',
fn ($type, $output) => $log->line($output)
);
});Autocomplete Prompt
Pull request by @joetannenbaum
A new prompt that suggests matching values as the user types while still allowing free-form text input. Accepts a static list or a closure for dynamic suggestions.
$key = autocomplete(
label: 'New config key',
options: collect(Arr::dot(config()->all()))->keys()->all(),
placeholder: 'e.g. app.name, mail.from, database.default',
required: true,
);Allow for Dynamic Secondary Info on Select-Type Prompts
Pull request by @joetannenbaum
Select, multiselect, and search prompts now support a secondary info panel. Pass a string or closure to the new info parameter to show context about the currently highlighted item.
Notify Prompt
Pull request by @joetannenbaum
Send native desktop notifications straight from your CLI commands. Supports macOS (via osascript) and Linux (via notify-send):
notify('Build complete', 'Deployed to production');
// With macOS-specific options
notify(
title: 'Build complete',
body: 'Deployed to production',
sound: 'Glass',
);Reverb
[1.x] Adds Support for Rate Limiting
Pull request by @joedixon
Reverb now supports per-application rate limiting, using Laravel's built-in rate limiter under the hood. Configure limits per app to protect your WebSocket server from abuse.
Scout
[11.x] Add Support for where($field, $operator, $value) on Builder Class
Pull request by @gdebrauwer
Scout's query builder now accepts operators in where() clauses, making range queries straightforward without dropping into engine-specific callbacks:
User::search('taylor')
->where('created_at', '>', now()->subMonth()->timestamp)
->get();VS Code Extension
Link Livewire Page Routes to Components
Pull request by @TitasGailius
Routes registered with Route::livewire() now link directly to the Livewire component. Clicking a route name navigates to the component file, and hovering shows the full component hover card.
Support Intermediate (non-Leaf) Translation Keys
Pull request by @TitasGailius
Intermediate translation keys like __('validation.attributes') now produce clickable links and hover info without false diagnostics. Previously only the deepest leaf keys were recognized.