EspiritoEspirito Logo

What’s New in Laravel 13: First-Party AI SDK and Quality-of-Life Improvements

What's New in Laravel 13: AI SDK, PHP Attributes & QOL Fixes

Laravel 13 has arrived, with this year’s release focusing on “AI-native workflows, stronger defaults, and more expressive developer APIs”. While its release notes suggest it is a relatively small release, Laravel 13 does include some nice new features and quality-of-life improvements over Laravel 12.

Support & Minimum Versions

As with previous Laravel versions, the 13th edition will also receive 18 months of bug fixes and 3 years of security updates. And just like past releases, Laravel 13 bumps the minimum versions of some other packages. In this case, you’re looking at:

Headline Feature: AI SDK

The Laravel AI SDK was launched in Beta in February, but makes it’s official debut with Laravel 13 (Image: Laravel)

It wouldn’t be a new major version without new features, and this year’s core feature is the Laravel AI SDK. This package provides a simple and elegant way of writing Laravel code that interacts with different AI models.

This differs from other Laravel AI-focused packages like Laravel MCP or Boost in that it helps you write AI-powered functionality in your application for your users to interact with. Think chatbots, summarisation services, image generation, transcription or anything else that Generative AI can do.

Right now, the AI SDK supports popular AI providers such as OpenAI (ChatGPT), Gemini, Anthropic (Claude), consolidation services like Azure and Groq, and other well-known providers like DeepSeek and Ollama.

The SDK comes with all the nice-to-haves we’ve come to expect from Laravel. For example:

  • All functionality is provided through an expressive interface, letting you call methods with ease. No matter if you want to prompt agents, generate images or transcribe audio, it’s likely just one function call away.
  • AI providers are implemented through a combination of configs and drivers, letting you customise and expand which providers and models you use.
  • Writing tests for AI implementations is simple by using the static fake() method on various classes to ensure real calls to AI models aren’t performed, and letting you control the output.

Quality-of-Life Improvements

Expanded use of PHP Attributes

PHP 8.0 brought attributes to the language, allowing configuration options to be expressed in a distinct manner. Pre-attributes, Laravel’s method of configuring models, jobs, queues, etc. has been through setting specific class properties. This approach had some limitations however:

  • Mixing class configuration options and implementation values could make it unclear which were which, especially if you are unfamiliar with all configuration options of a class.
  • If a configuration property was instead provided by a trait, you could easily run into conflicts. PHP mandates that “if a trait defines a property then a class can not define a property with the same name unless it is compatible (same visibility and type, readonly modifier, and initial value) ...”

Laravel 13 works to start transitioning towards an attribute-centric configuration future. There are now:

  • Controllers: #[Middleware] and #[Authorize]
  • Queues: #[Tries], #[Backoff], #[Timeout], etc.
  • Models: #[Table], #[Fillable], #[Hidden], etc.
  • ... and many, many more.

There is still work to be done with some configuration options still only present as properties, but this is a significant step towards separating configuration and implementation. And don’t panic — your property configuration options still exist, and act as a fallback if the attributes aren’t set.

First-Party JSON:API Resources

Returning JSON data from an API you’re building can be done in an infinite number of ways. But starting with Laravel 13, you can easily create JSON:API compliant endpoint by extending the JsonApiResource class.

JSON:API has its advantages, with its largest being that it’s a standard. Data consumers who wish to integrate with your API know exactly what to expect, and don’t have to spend time understanding your custom structure or finding your implementation’s edge cases — they can get straight into using it.

Other Notable Changes

With many smaller changes, it’s hard to keep track of them all. Some final simple, but notable changes are:

  • A new Cache::touch(...) method to let you extend the time-to-live of a cache without having to read/write to it.
  • Queue connections and names can not be configured centrally using Queue::route(...).
  • CSRF token checking has been expanded into PreventRequestForgery (previously ValidateCsrfToken) with expanded capabilities.

Overall: A Solid Step Forward

Coming off Laravel 12 last year, which didn’t include any big, standout features, this year’s new Laravel release provides a solid step forward, albeit with few big-ticket items. It still gives you a solid few reasons to upgrade, besides that “it’s the newest version”.

A focus on stability and containing minimal breaking changes is always appreciated and low-friction upgrades are key to adoption of newer versions of the Laravel framework.

If your Laravel application needs some love, FONSEKA can help! We are Brisbane Laravel specialists who can develop and maintain your codebase — including keeping it up-to-date with Laravel’s latest versions. Get in touch at https://fonseka.com.au/contact

Post Details

Author: Lachlan Rehder

Categories:

Updated: 19 Mar 2026

Interested in one of our products?

Get in touch and let us know how we can help! 😇