Laravel 开源生态更新日志(2026年1月)
Laravel 开源生态的最新更新和改进。
Laravel Framework 12.x
[12.x] Add @includeIsolated Directive for Isolated Blade Includes
Pull request by @KennedyTedesco
When you need to reuse a partial without accidentally leaking variables in (or out), @includeIsolated gives you a clean, predictable boundary - great for shared UI components and emails where "mystery data" can be costly to debug.
{{-- Only receives what you pass explicitly --}}
@includeIsolated("partials.alert", ["type" => "success", "message" => $message])[12.x] Add Cache::withoutOverlapping() to Wrap Cache::lock()->block()
Pull request by @mathiasgrimm
This adds a tidy, expressive wrapper around cache locks, so you can prevent overlapping work with less boilerplate. Perfect for cron jobs, report generation, and any "only one at a time" tasks.
Cache::withoutOverlapping('reports:daily')
->block(10, function () {
// This work will not run concurrently.
GenerateDailyReport::run();
});Support for Vector Embeddings in the Database
Pull request by @taylorotwell
This work moves Laravel's "vector" capabilities forward, helping set the stage for richer integrations and smoother workflows when dealing with embeddings and similarity search. If you're exploring AI-powered features, this one's for you.
[12.x] Add Collection::containsManyItems() Method
Pull request by @stevebauman
A new containsManyItems method was added to complement the existing containsOneItem, enabling you to do a quick check to see if a collection contains two or more items.
match (true) {
$collection->isEmpty() => '...',
$collection->containsOneItem() => '...',
$collection->containsManyItems() => '...',
};[12.x] JSON:API Resource
Pull request by @crynobone
This introduces JSON:API resource support, making it easier to ship standards-compliant APIs with consistent structure across teams and services. If you're standardizing responses (or integrating with clients that expect JSON:API), this helps reduce custom formatting and makes your API surface more predictable.
[12.x] Add BackedEnum Support for Session Keys
Pull request by @ahinkle
You can now use backed enums as session keys, which keeps key names centralized and typo-proof, especially helpful in larger apps where session keys tend to spread over time.
enum CheckoutSession: string
{
case Cart = 'checkout.cart';
case ShippingAddress = 'checkout.shipping_address';
case PaymentMethod = 'checkout.payment_method';
}
session()->put(CheckoutSession::Cart, $items);
session()->get(CheckoutSession::Cart);[12.x] Allow BackedEnum for Cache Keys
Pull request by @jackbayliss
Same productivity boost, now for cache: backed enums can be used as cache keys, helping you standardize key naming and avoid subtle collisions. Great fit for teams that want a single source of truth for cache identifiers.
enum CacheKey: string
{
case Settings = 'settings.global';
}
Cache::put(CacheKey::Settings, $settings, now()->addHour());
$settings = Cache::get(CacheKey::Settings);[12.x] Add --readable Flag to env:encrypt for Visible Key Names
Pull request by @mathiasgrimm
A practical quality-of-life improvement: --readable makes encrypted env output easier to audit by keeping key names visible, which helps during reviews and incident response while still protecting secret values. If you're hardening deployments, this pairs nicely with Laravel's environment encryption workflow.
php artisan env:encrypt --readableInertia
Add async and sync Options to cancelAll Method
Pull request by @pascalbaljet
Replacing the deprecated router.cancel(), you can now get the same functionality with router.cancelAll({ async: false }). Giving you more control over request cancellation means smoother UX under heavy navigation or rapid input.
[2.x] Add Form Context Support
Pull request by @laserhybiz
The new useFormContext hook allows child components to know about parent component forms without having to do a bunch of unnecessary prop drilling.
<!-- Parent.vue -->
<template>
<Form action="/users" method="post">
<Input name="name" />
</Form>
</template>
<!-- Input.vue -->
<script setup>
import { useFormContext } from "@inertiajs/vue3";
defineProps({
name: {
type: String,
required: true,
},
});
const form = useFormContext();
</script>
<template>
<input type="text" :name="name" />
<div v-if="form.errors[name]">
{{ form.errors[name] }}
</div>
</template>Add dontRemember() Method to Form Helper
Pull request by @pascalbaljet
This gives you a straightforward way to opt out of Inertia's form remembering behavior when it's not desired. This is handy for sensitive forms or one-time flows where you don't want old values sticking around (e.g., password resets, invite flows).
Starter Kits
We made a slew of updates to all of our Starter Kits this month! Amongst the various tune-ups:
Add Safer Defaults to AppServiceProvider
Pull request by @WendellAdriel
Safer defaults in the AppServiceProvider reduce the "oops" factor on new projects, helping you start with a more secure, production-friendly baseline while keeping the kit lightweight and easy to customize.
- Enforcing immutable dates with CarbonImmutable
- Not allowing destructive commands in production
- Requiring safer passwords by default in production
Livewire 4 Support
Pull request by @calebporzio
The Livewire starter kits are now ready for Livewire 4, so you can begin new builds on the latest Livewire foundation without spending time on upgrade plumbing. If you're planning a fresh app, this keeps your starting line modern.
Add Pint Config File and Util Composer Scripts for Linting
Pull request by @WendellAdriel
Out-of-the-box linting makes teams faster: consistent formatting, fewer style nits in code review, and easier onboarding. The included Pint config plus utility scripts make "format everything" a one-command habit.
Boost
Boost 2.0
We shipped Skills in Laravel Boost 2.0, a major upgrade to how AI agents understand and work with your Laravel applications.
This update transitions many package guidelines into agent skills, enabling significantly better context management. By loading package-specific knowledge only when it is relevant, agents produce more accurate, higher-quality Laravel code with far less context noise. This is a must-have upgrade for getting the best results from AI agents when building Laravel applications.
As a result, existing guidelines are now roughly ~ 40 percent leaner, making agent responses more focused and much higher quality.
Add Laravel Code Simplifier Prompt
Pull request by @pushpak1300
A dedicated "code simplifier" prompt helps you quickly turn verbose or repetitive Laravel code into clean, idiomatic patterns, great for polishing PRs and accelerating refactors when you're moving fast.
Add Livewire 4 Upgrade Prompt
Pull request by @pushpak1300
Upgrading is easier when you have a focused guide. This prompt helps you identify the key changes for Livewire 4 and work through them systematically, reducing upgrade risk and cutting down on "why did this break?" time.
Echo
Resolve Performance Issues and Stale Closure Bugs in useEcho
Pull request by @pataar
This improves hook reliability and performance by addressing stale closure issues, meaning fewer head-scratching realtime UI bugs and smoother rendering under heavy event traffic. If you're building reactive dashboards or chat experiences, this makes your client-side behavior more dependable.
Add a Connection Status Hook
Pull request by @nexxai
A connection status hook is a big UX unlock: you can clearly reflect "connected / reconnecting / offline" states and handle them gracefully in your UI. Great for realtime-heavy apps where user trust depends on knowing whether updates are truly live.
Events Overloading
Pull request by @joetannenbaum
Event overloading expands how you can map and handle events, making advanced realtime patterns easier to express without workaround code. Useful when you're consolidating many event types into a cleaner, more maintainable client-side layer.
Horizon
Add horizon:listen Command
Pull request by @mathiasgrimm
Introducing a new horizon:listen command that watches for file changes and automatically restarts Horizon during development. This new command mirrors Laravel's built-in queue:listen command behavior.
Pint
Adds an agent Format
Pull request by @nunomaduro
A new --format agent flag was added that gets automatically used when Pint is executed within OpenCode or Claude Code.
The default Pint output is designed for humans: colorful, with progress dots and formatted summaries. AI agents need something different: structured JSON they can reliably parse, unambiguous status values like "status":"pass" instead of inferring from formatted text, minimal output that saves context window and reduces token cost, and deterministic results without ANSI colors or formatting noise.
Prompts
Add Grid Component
Pull request by @pushpak1300
The new grid component in Prompts allows developers to easily create responsive grid-based layouts and present data clearly.
Pulse
Add Livewire 4 Support
Pull request by @joshhanley
Pulse is ready for Livewire 4, keeping your application observability UI compatible as you move forward. That means fewer blockers when modernizing your stack.
VS Code Extension
Livewire 4 Support
Pull request by @TitasGailius
First-class Livewire 4 support in the extension helps you stay in flow with better editor understanding as you build components: less context switching, more shipping.
Docker Support
Pull request by @TitasGailius
Improved Docker support makes Laravel development inside containers feel more natural in VS Code, helping teams standardize environments and reduce "works on my machine" friction.
Add Markdown Hover Links for Scopes to the Implementation
Pull request by @N1ebieski
Hover links turn query scopes into a navigable experience, jumping from usage to implementation faster, which is especially valuable in large codebases with lots of shared scopes.
Support for Laravel Attributes
Pull request by @N1ebieski
Better attribute support helps the editor understand modern Laravel patterns, improving navigation and reducing false positives. If your project leans on PHP attributes, this makes day-to-day editing noticeably smoother.
Integration Artisan Make Commands with VS Code Explorer
Pull request by @N1ebieski
Generate files where you're already working: integrating artisan make:* into the explorer and context menu cuts down on terminal hopping and keeps scaffolding close to your project structure.
Support for Autocompletion Rules in FormRequest
Pull request by @N1ebieski
Smarter autocomplete for FormRequest validation rules means fewer typos and faster validation authoring, which is particularly helpful when you're juggling complex rule sets.
Add Scope Parameters to the Repository and Docblock Generator
Pull request by @N1ebieski
Docblocks and repository hints that include scope parameters improve autocomplete accuracy and make "discoverability" better for teammates, so using existing scopes becomes as easy as reading the method signature.