Laravel 13: What Changed Compared to Laravel 12
Laravel 13 lands with a first-party AI SDK, native PHP attributes, and JSON:API support. Here is what actually matters if you are upgrading from Laravel 12.
Laravel 13 shipped on March 17, 2026, and it raises the minimum PHP version to 8.3. Beyond the version bump, this release leans hard into two directions: making the framework's configuration more expressive with native PHP attributes, and giving every Laravel app a first-party way to talk to LLMs.
A first-party AI SDK
The biggest headline is the Laravel AI SDK,a unified API for text generation, tool-calling agents, embeddings, audio, and images across providers. Instead of wiring the OpenAI or Anthropic SDKs yourself and building your own abstraction layer, you get one Laravel-native interface that stays consistent whichever provider you swap in.
use Laravel\Ai\Facades\Ai;
$response = Ai::text()
->using('anthropic:claude-sonnet-5')
->prompt('Summarize this changelog in one sentence.')
->generate();
echo $response->text;PHP attributes instead of class properties
Laravel 13 introduces attribute syntax as an optional alternative to property-based configuration in more than 15 places: models, controllers, jobs, commands, listeners, mailables, notifications. The goal is not to replace conventions, it is to make cross-cutting configuration (queue name, retries, scopes, observers) readable at a glance without hunting through the class body.
// Laravel 12: configuration scattered across properties
class SendInvoice implements ShouldQueue
{
public $queue = 'invoices';
public $tries = 3;
public $backoff = 30;
}
// Laravel 13: configuration declared where the class is declared
#[Queueable(queue: 'invoices', tries: 3, backoff: 30)]
class SendInvoice implements ShouldQueue
{
}JSON:API resources, natively
If you have ever hand-rolled the JSON:API spec,resource objects, relationships, sparse fieldsets, links,you know how much boilerplate it takes. Laravel 13 ships first-party JSON:API resources that handle all of it, including the correct response headers.
class UserResource extends JsonApiResource
{
public function toArray(Request $request): array
{
return [
'type' => 'users',
'id' => (string) $this->id,
'attributes' => [
'name' => $this->name,
'email' => $this->email,
],
];
}
}Hardened CSRF with PreventRequestForgery
The request forgery protection middleware has been reworked and formalized as PreventRequestForgery. It adds origin-aware verification on top of the existing token-based CSRF protection,useful now that more Laravel apps expose APIs consumed by first-party SPAs and mobile clients side by side.
Centralized queue routing
Instead of scattering ->onQueue() and ->onConnection() calls across your codebase, the new Queue::route() method lets you declare which connection and queue each job class uses from a single service provider.
// AppServiceProvider::boot()
Queue::route(SendInvoice::class, connection: 'redis', queue: 'invoices');
Queue::route(GenerateReport::class, connection: 'sqs', queue: 'reports');Laravel 12 keeps receiving bug fixes until August 13, 2026 and security fixes until February 24, 2027,there is no rush. Upgrade when the AI SDK or JSON:API support actually solves a problem you have, not just because a new major version exists.
Should you upgrade now?
If you are not building AI features or a public JSON:API, the practical day-to-day difference between Laravel 12 and 13 is small. The attribute syntax is the change most teams will notice first,it is optional, so you can adopt it file by file during routine maintenance instead of a big-bang migration.
Need help with this topic? Full Stack Development
Discover this service →Related articles
PHP 8.5: The New Features That Actually Matter for Backend Work
BackendDesigning a Robust and Scalable REST API with Laravel
ArchitectureMigrating a Laravel Monolith to Microservices
BackendLaravel JWT: Stateless Authentication for Your APIs
BackendLaravel vs Node.js: Which Backend Should You Choose?
