Laravel 13 dropped with zero breaking changes and a heavy focus on AI tooling. The upgrade from 12 is smooth, but the new features are worth paying attention to, especially if you're building anything that touches AI, APIs, or search.
The AI SDK
This is the headline feature. Laravel now ships a first-party AI SDK with a single API for text generation, image creation, audio synthesis, and embeddings. It's provider-agnostic, so you can swap between OpenAI, Anthropic, or others without rewriting your code.
If you've used third-party AI packages in Laravel before, you know the pain of mismatched APIs and wrapper libraries that go stale. The official SDK fixes that.
A basic agent takes two lines:
use App\Ai\Agents\SalesCoach;
$response = SalesCoach::make()->prompt('Analyze this sales transcript...');
return (string) $response;
Image generation follows the same pattern:
use Laravel\Ai\Image;
$image = Image::of('A donut sitting on the kitchen counter')->generate();
The part that caught my eye is how embeddings work. Instead of calling a separate service, you generate them from a Stringable:
use Illuminate\Support\Str;
$embeddings = Str::of('Napa Valley has great wine.')->toEmbeddings();
That toEmbeddings() on Stringable feels like Laravel. Not a bolted-on wrapper, just a method where you'd expect it.
Vector Search in the Query Builder
So you have embeddings. Now what? Laravel 13 adds whereVectorSimilarTo to the query builder. If you're on PostgreSQL with pgvector, semantic search is one method call:
$documents = DB::table('documents')
->whereVectorSimilarTo('embedding', 'Best wineries in Napa Valley')
->limit(10)
->get();
You pass a column and a plain-text query. Laravel generates the embedding and runs the similarity search in one step. No manual embedding calls, no raw SQL.
Why does this matter? Until now, adding semantic search to a Laravel app meant pulling in a vector database, writing custom query logic, and managing embedding pipelines yourself. Now it's a query builder method.
JSON:API Resources
If you've ever built a JSON:API-compliant API in Laravel, you know the pain. Resource serialization, relationship inclusion, sparse fieldsets, proper headers. It's a lot of boilerplate.
Laravel 13 adds first-party JSON:API resources that handle all of this. Serialization, relationships, fieldsets, links, and proper response headers come built in. One less package to manage.
PHP Attributes Everywhere
Laravel 12 started the shift toward PHP 8 attributes. Version 13 goes further with about 15 new attribute options across the framework.
Controller middleware and authorization checks can now live on the class:
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)
{
// ...
}
}
Queue jobs get the same treatment with #[Tries], #[Backoff], #[Timeout], and #[FailOnTimeout]. The old property-based approach still works. But attributes colocate configuration with the thing being configured, which makes classes easier to scan.
Queue Routing
A small but useful addition. You can now define default queue and connection routing for specific jobs in one place:
Queue::route(ProcessPodcast::class, connection: 'redis', queue: 'podcasts');
Before this, you'd set the connection and queue on the job class itself. That works until the same job needs to run on different queues in different environments. Queue routing moves that decision to your service provider, where environment-specific config belongs.
Cache::touch()
Another small win. Cache::touch($key) extends the TTL of a cached item without retrieving its value. Before, you had to get the value and re-store it with a new expiration.
This is useful for session-like patterns where you want to keep a cache key alive as long as it's being accessed, without the overhead of reading and writing the full value.
The Upgrade
Laravel 13 requires PHP 8.3, dropping 8.2 support. Bug fixes run through Q3 2027, security fixes through Q1 2028.
The upgrade itself should be painless. The team made a conscious effort to keep breaking changes to a minimum, focusing on additive features. Most apps can upgrade by bumping the version constraint and running composer update.
The real story of this release isn't any single feature. It's that Laravel is treating AI as a first-class concern, not a community package afterthought. The AI SDK, vector search, and embedding primitives turn it into a serious platform for building AI-powered applications without leaving the framework.
Thanks for reading, and see you in the next one.