Design & Development14 min read

What's New in Laravel 13: AI SDK, Vector Search & Beautiful UI

Ritesh PatelBy Ritesh Patel|March 26, 2026
What's New in Laravel 13

Laravel 13 dropped on March 17, 2026 — and this is not an incremental update. Taylor Otwell announced it at Laracon EU with a tagline that says it all: "The clean stack for Artisans and agents."

The headline is the first-party AI SDK going stable, but there's a lot more here. Native vector search in the query builder. First-party JSON:API resources. 36 new PHP attributes that let you configure models, jobs, and commands declaratively. Redesigned starter kits with shadcn. And a CSRF overhaul that most developers won't even notice (in a good way).

We've been running Laravel in production for over 11 years at Treesha Infotech — it powers the majority of our backend systems and projects. Here's everything that matters, what we think about each feature, and what it means for your projects.

In This Article

  • Laravel AI SDK — Agents, Embeddings & Multi-Agent Workflows
  • Native Vector Search in the Query Builder
  • Beautiful Starter Kits with shadcn
  • First-Party JSON:API Resources
  • 36 New PHP Attributes
  • Modern CSRF Protection (PreventRequestForgery)
  • Other Notable Features
  • Upgrade Guide
  • Our Take — What This Means for Laravel Projects

Laravel AI SDK — The Headline Feature

Laravel 13 AI SDK Architecture — Text, Image, Audio, Embeddings, Agents & Vector Search

The AI SDK (laravel/ai) was in beta during Laravel 12, but it shipped as stable and production-ready with Laravel 13. This is the biggest addition to the framework in years.

It's a unified, provider-agnostic API for everything AI: text generation, image generation, audio synthesis and transcription, embeddings, vector stores, and reranking. One interface, swap providers by changing a config value.

Supported Providers

CapabilityProviders
Text GenerationOpenAI, Anthropic, Gemini, Azure, Groq, xAI, DeepSeek, Mistral, Ollama
Image GenerationOpenAI, Gemini, xAI
Text-to-SpeechOpenAI, ElevenLabs
Speech-to-TextOpenAI, ElevenLabs, Mistral
EmbeddingsOpenAI, Gemini, Azure, Cohere, Mistral, Jina, VoyageAI
RerankingCohere, Jina

Agents

This is the core concept. An Agent is a dedicated PHP class that encapsulates instructions, tools, and output schema. Think of it as a specialized assistant that lives in your codebase.

PHP
1php artisan make:agent SalesCoach
PHP
1use Laravel\Ai\Agent;
2
3class SalesCoach extends Agent
4{
5    protected string $model = 'claude-sonnet-4-5-20250514';
6
7    protected string $instructions = 'You are an expert sales coach...';
8
9    public function tools(): array
10    {
11        return [new FetchCRMData, new AnalyzeCallRecording];
12    }
13}
14
15// Usage
16$response = SalesCoach::make()->prompt('Analyze this sales call transcript...');

Agents can return structured output (typed arrays), remember conversations across requests, stream responses in real-time, and even broadcast to WebSocket channels.

One-Line AI Calls

For quick tasks, you don't need a full Agent class:

PHP
1// Text
2$response = Ai::prompt('Summarize this article', system: 'Be concise.');
3
4// Image
5$image = Ai::image()->prompt('A minimalist logo for a tech company')->generate();
6
7// Audio
8$audio = Ai::audio()->text('Welcome to our platform.')->generate();
9
10// Embeddings
11$embeddings = Str::of('Laravel is a PHP framework.')->toEmbeddings();

Multi-Agent Workflows

Laravel 13 ships with five multi-agent patterns straight from Anthropic's research: Prompt Chaining, Routing, Parallelization, Orchestrator-Workers, and Evaluator-Optimizer. All work natively with Laravel's Concurrency::run() and Pipeline::send().

PHP
1// Parallel agents
2[$analysis, $sentiment, $summary] = Concurrency::run([
3    fn () => AnalysisAgent::make()->prompt($text),
4    fn () => SentimentAgent::make()->prompt($text),
5    fn () => SummaryAgent::make()->prompt($text),
6]);

Testing

Full testing support with FakeAi::shouldFake() — no real API calls during tests:

PHP
1FakeAi::shouldFake();
2
3// Run your code...
4
5FakeAi::assertAgentPrompted(SalesCoach::class);
6FakeAi::assertImageGenerated();
Tip
Our take: This changes the build-vs-buy equation for AI features. Before, you'd reach for a Python microservice or a third-party SDK. Now you can build chatbots, content generators, RAG pipelines, and AI agents entirely within Laravel. We're already integrating the AI SDK into active projects — the unified provider API is exactly what Laravel was missing.

Native Vector Search in the Query Builder

This is the feature that makes Laravel a legitimate choice for AI-powered applications. Native vector queries, right in the query builder, using PostgreSQL with pgvector.

Schema Setup

PHP
1Schema::ensureVectorExtensionExists();
2
3Schema::create('documents', function (Blueprint $table) {
4    $table->id();
5    $table->string('title');
6    $table->text('content');
7    $table->vector('embedding', dimensions: 1536)->index();
8    $table->timestamps();
9});

Querying with Plain Text

The magic: you pass a string, and Laravel generates the embedding automatically before comparing:

PHP
1$results = Document::query()
2    ->whereVectorSimilarTo('embedding', 'best practices for Moodle multi-tenancy')
3    ->limit(10)
4    ->get();

Hybrid Search

Combine traditional full-text search with AI reranking for the best results:

PHP
1$articles = Article::query()
2    ->whereFullText('body', $request->input('query'))
3    ->limit(50)
4    ->get()
5    ->rerank('body', $request->input('query'), limit: 10);

This retrieves 50 candidates using PostgreSQL full-text search, then uses an AI reranker (Cohere or Jina) to return the 10 most relevant results.

Note
Why this matters: Building semantic search previously required Pinecone, Weaviate, or a separate Python service. Now it's a migration and a query method. If you're on Laravel Cloud, Serverless Postgres includes pgvector by default.

Beautiful Starter Kits with shadcn

Laravel 13's starter kits are a complete redesign. Four options, all production-quality:

KitFrontendUI Library
ReactReact 19 + TypeScript + Inertia 2 + Tailwind 4shadcn/ui
VueVue 3 Composition API + TypeScript + Inertia 2 + Tailwind 4shadcn-vue
SvelteSvelte 5 + TypeScript + Inertia 2 + Tailwind 4shadcn-svelte
LivewireLivewire 4 + Tailwind 4Flux UI

Every kit includes:

  • Dark/light/system modes out of the box
  • Sidebar and header layout variants
  • Two-factor authentication built in
  • GitHub Actions CI/CD workflows
  • WorkOS AuthKit integration option — passkeys, social login, enterprise SSO, free up to 1M MAU
  • Team multi-tenancy — users can operate different team contexts in separate browser tabs (URL-based, not session-based)

The old Jetstream-era starter kits were functional but basic. These look like production SaaS dashboards from day one. If you're building a SaaS MVP, the scaffolding you get out of the box saves weeks of frontend work.

Laravel 13 Starter Kits — React, Vue, Svelte & Livewire with shadcn

First-Party JSON:API Resources

If you build APIs (and who doesn't), this is a welcome addition. Laravel now has built-in support for the JSON:API specification.

Terminal
1php artisan make:resource UserResource --jsonapi
PHP
1class UserResource extends JsonApiResource
2{
3    public function type(): string
4    {
5        return 'users';
6    }
7
8    public function attributes(Request $request): array
9    {
10        return [
11            'name' => $this->name,
12            'email' => $this->email,
13            'created_at' => $this->created_at,
14        ];
15    }
16
17    public function relationships(Request $request): array
18    {
19        return [
20            'posts' => PostResource::collection($this->posts),
21        ];
22    }
23}

Handles relationship inclusion (?include=posts,comments), sparse fieldsets (?fields[users]=name,email), links, meta, and sets the correct Content-Type: application/vnd.api+json header automatically.

No more pulling in spatie/laravel-json-api or cloudcreativity/laravel-json-api for standard API responses.

36 New PHP Attributes

PHP Attributes in Laravel 13: Before vs After — Properties to Declarative Attributes

Laravel 13 adds 36 new PHP attributes (50+ total). These let you configure models, jobs, commands, and more using native PHP 8 attributes instead of properties.

Eloquent Models

Before:

PHP
1class User extends Model
2{
3    protected $table = 'users';
4    protected $fillable = ['name', 'email'];
5    protected $hidden = ['password'];
6    protected $appends = ['full_name'];
7}

After:

PHP
1#[Table('users')]
2#[Fillable(['name', 'email'])]
3#[Hidden(['password'])]
4#[Appends(['full_name'])]
5class User extends Model
6{
7    // Clean model body — only relationships and methods
8}

Queue Jobs

PHP
1#[Tries(5)]
2#[Timeout(120)]
3#[Backoff([10, 30, 60])]
4#[Queue('podcasts')]
5#[Connection('redis')]
6class ProcessPodcast implements ShouldQueue
7{
8    public function handle(): void
9    {
10        // Job logic only — no configuration clutter
11    }
12}

Controllers

PHP
1#[Middleware('auth')]
2class PostController extends Controller
3{
4    #[Authorize('create', [Post::class])]
5    public function store(Request $request)
6    {
7        // ...
8    }
9}

Console Commands

PHP
1#[Signature('users:prune {--days=30}')]
2#[Description('Remove inactive user accounts')]
3class PruneUsers extends Command
4{
5    public function handle(): void
6    {
7        // ...
8    }
9}

All attributes are completely optional. Existing property-based configuration still works. You can mix and match — use attributes where they feel cleaner, keep properties where they don't.

Tip
Our take: We're adopting attributes for new code, especially on models and jobs. It moves configuration to the class declaration where it belongs and keeps the class body focused on behavior. But we're not mass-refactoring existing code — that's unnecessary churn.

Modern CSRF Protection

The VerifyCsrfToken middleware is now PreventRequestForgery, and it's smarter. It uses a two-layer approach:

1. Layer 1 (Origin check): Modern browsers send a Sec-Fetch-Site header. If the request is same-origin, it passes immediately — no token verification needed. 2. Layer 2 (Token fallback): For older browsers or non-HTTPS environments, traditional CSRF token validation kicks in.

PHP
1// bootstrap/app.php
2$middleware->preventRequestForgery(
3    originOnly: true,        // Disable token fallback entirely
4    allowSameSite: true,     // Allow subdomain requests
5    except: ['stripe/*'],    // Exclude webhook endpoints
6);

For most developers, this is invisible — forms still work, AJAX still works. But it's faster (no database/session lookup for the token) and more secure (origin verification is harder to bypass than token validation).

Other Notable Features

Queue Routing

Centralize job routing in a service provider instead of scattering it across individual job classes:

PHP
1Queue::route(ProcessPodcast::class, connection: 'redis', queue: 'podcasts');
2Queue::route(SendNotification::class, connection: 'sqs', queue: 'notifications');

Cache::touch()

Extend a cached item's TTL without reading or rewriting the value:

PHP
1Cache::touch('user_session:123', 3600);
2Cache::touch('analytics_data', now()->addHours(6));

Uses native store commands (Redis EXPIRE, Memcached TOUCH) — no deserialization overhead.

Reverb Database Driver

Laravel Reverb (WebSockets) now works with your existing MySQL or PostgreSQL database for horizontal scaling. Previously, this required a dedicated Redis instance. Great for small-to-medium apps that want real-time features without extra infrastructure.

Passkey Authentication

WebAuthn passkey auth is integrated into starter kits and Fortify. Users authenticate with Face ID, fingerprint, Windows Hello, or hardware security keys. The private key never leaves the device — zero phishing risk.

Laravel Boost (MCP Server)

A first-party MCP server for AI-assisted development. It provides 15 specialized tools for codebase inspection, 17,000+ pieces of Laravel-specific knowledge, and an /upgrade-laravel-v13 command that automates the upgrade process. Works with Claude Code, Cursor, VS Code, and other MCP-compatible editors.

Upgrade Guide

The upgrade from Laravel 12 to 13 is straightforward — about 10 minutes for most applications.

High Impact

Update composer.json:

JSON
1{
2    "laravel/framework": "^13.0",
3    "laravel/boost": "^2.0",
4    "laravel/tinker": "^3.0",
5    "phpunit/phpunit": "^12.0",
6    "pestphp/pest": "^4.0"
7}

PHP 8.3 minimum — if you're still on 8.2, upgrade PHP first.

Medium Impact

  • Cache serializable_classes — new security config. Explicitly list PHP classes you cache as objects. If you only cache strings and arrays, you're fine.

Low Impact

22 minor changes covering cache prefix naming, session cookie naming, MySQL DELETE query behavior, and various contract method additions. Most apps won't be affected.

Automated Upgrade

Two options:

  • Laravel Shift — automated upgrade service
  • Laravel Boost — run /upgrade-laravel-v13 in your IDE with MCP support
Warning
Before upgrading: Make sure your CI pipeline passes on PHP 8.3+. The PHP version bump is the most common blocker we've seen in client projects.

Our Take — What This Means for Laravel Projects

Laravel 13 is the most AI-forward release of any backend framework. The AI SDK isn't a proof of concept or a wrapper — it's a complete toolkit for building AI-powered applications in PHP.

Here's what we're doing at Treesha Infotech:

  • New projects start on Laravel 13 from day one. The starter kits alone save a week of scaffolding.
  • Existing Laravel 12 projects are being upgraded gradually. The migration is painless.
  • AI features that previously required separate Python microservices can now be built entirely within Laravel using the AI SDK. Fewer moving parts, one codebase, one deploy.
  • Vector search replaces external vector databases for projects that run on PostgreSQL. One less dependency.
  • PHP attributes are our default for new models and jobs. Cleaner code, less boilerplate.

If you're evaluating Laravel for a new project — or deciding whether to upgrade — Laravel 13 makes the decision easy. The framework has never been more capable.

Need help building with Laravel 13 or upgrading an existing application? Get a free quote or schedule a call with our team.

Frequently Asked Questions

When was Laravel 13 released?
Laravel 13 was released on March 17, 2026, announced by Taylor Otwell at Laracon EU 2026. It requires PHP 8.3 or higher and supports PHP up to 8.5. Bug fixes will continue until Q3 2027, and security fixes until March 17, 2028.
What is the Laravel AI SDK?
The Laravel AI SDK is a first-party package (laravel/ai) that provides a unified, provider-agnostic API for text generation, image generation, audio synthesis, transcription, embeddings, and vector search. It supports 10+ providers including OpenAI, Anthropic, Gemini, and Ollama — and lets you build AI agents, multi-agent workflows, and RAG pipelines entirely within Laravel.
Does Laravel 13 support vector search natively?
Yes. Laravel 13 adds native vector query methods to the query builder using PostgreSQL with pgvector. You can call whereVectorSimilarTo() on any Eloquent model with a vector column, and Laravel will automatically generate embeddings from plain text queries. It also supports hybrid search combining full-text retrieval with AI-powered reranking.
What are the minimum requirements for Laravel 13?
Laravel 13 requires PHP 8.3 minimum (drops PHP 8.2 support). It supports PHP 8.3 through 8.5. It also requires Symfony 7.4 or 8.0 components, PHPUnit 12+, and Pest 4+ for testing.
How long does it take to upgrade from Laravel 12 to 13?
For most applications, the upgrade takes about 10 minutes. Laravel 13 has minimal breaking changes — the high-impact changes are updating composer.json dependencies and the renamed CSRF middleware. The Laravel Boost MCP server includes an /upgrade-laravel-v13 command that can automate most of the process.
What are the new PHP attributes in Laravel 13?
Laravel 13 introduces 36 new PHP attributes (50+ total), covering Eloquent models (#[Table], #[Fillable], #[Hidden]), queue jobs (#[Tries], #[Timeout], #[Backoff]), console commands (#[Signature], #[Description]), controllers (#[Middleware], #[Authorize]), form requests (#[ErrorBag]), and testing (#[Seed], #[SetUp]). All attributes are optional — existing property-based configuration continues to work.
What is JSON:API support in Laravel 13?
Laravel 13 adds first-party JSON:API resource classes that handle resource serialization, relationship inclusion (?include=posts), sparse fieldsets (?fields[users]=name,email), links, meta, and the correct Content-Type header. Generate them with php artisan make:resource UserResource --jsonapi.
What starter kits are available in Laravel 13?
Laravel 13 offers four starter kits: React (with shadcn/ui), Vue (with shadcn-vue), Svelte (with shadcn-svelte), and Livewire (with Flux UI). All use TypeScript, Tailwind CSS 4, and Inertia 2. They include dark/light/system modes, sidebar and header layouts, two-factor authentication, and optional WorkOS AuthKit integration for passkeys and social login.
What is Laravel Boost?
Laravel Boost is a first-party MCP (Model Context Protocol) server for AI-assisted Laravel development. It provides 15 specialized tools for codebase inspection, composable AI guidelines, and 17,000+ pieces of Laravel-specific knowledge. It works with Claude Code, Cursor, VS Code, and other MCP-compatible editors.

Ready to start your project?

Tell us about your requirements and we'll get back with a clear plan within 24 hours. No sales pitch — just an honest conversation.

Ritesh Patel
About the Author
Ritesh Patel
Co-Founder & CTO, Treesha Infotech

Co-founded Treesha Infotech and leads all technology decisions across the company. Full-stack architect with deep expertise in Laravel, Next.js, AI integrations, cloud infrastructure, and SaaS platform development. Ritesh drives engineering standards, code quality, and product innovation across every project the team delivers.

Let's Work Together

Ready to build something
remarkable?

Tell us about your project — we'll get back with a clear plan and honest quote.

Free Consultation
No Commitment
Reply in 24 Hours
WhatsApp Us