Laravel 13 Released: PHP 8.3, Attributes, Laravel AI, and a Smoother Upgrade Path
Laravel 13 has officially arrived, bringing a host of powerful new features while maintaining a strong commitment to minimizing breaking changes. This release focuses on developer experience, modern PHP practices, and native AI integration, all while ensuring a smooth transition for existing projects.
Key Requirements:
Minimum PHP Version: PHP 8.3 or higher.
Support Timeline: Bug fixes until Q3 2027 and security updates until Q1 2028.
---
What's New in Laravel 13
1. PHP 8.3 Is Now the Minimum Requirement
Laravel 13 drops support for PHP 8.2, requiring PHP 8.3 or higher. This ensures you can leverage the latest performance improvements and language features.
2. First-Class Support for PHP Attributes
One of the biggest developer-facing changes is the ability to configure framework behavior using native PHP Attributes instead of class properties. This is fully optional and backward compatible.
Example: Using Attributes on an Eloquent Model
use Illuminate\Database\Eloquent\Attributes\Table;
use Illuminate\Database\Eloquent\Attributes\Hidden;
use Illuminate\Database\Eloquent\Attributes\Fillable;
#[Table('users', key: 'user_id', keyType: 'string', incrementing: false)]
#[Hidden(['password'])]
#[Fillable(['name', 'email'])]
class User extends Model
{
// No need to define $table, $hidden, or $fillable as properties
}
This cleaner, more declarative syntax is now available in over 15 framework locations, including:
Models
Jobs
Console commands
Event listeners
And more.
3. Laravel AI SDK
Laravel 13 introduces a first-party Laravel AI SDK, providing a unified API for:
Text generation
Tool-calling agents
Embeddings
Audio and image processing
Vector-store integrations
This SDK simplifies building AI-powered features directly within your Laravel applications.
4. JSON:API Resources
First-party JSON:API resources are now included, making it straightforward to return responses compliant with the JSON:API specification. This handles:
Resource object serialization
Relationship inclusion
Sparse fieldsets
Links and headers
Example: Using a JSON:API Resource
use Illuminate\Http\Resources\Json\JsonApiResource;
class UserResource extends JsonApiResource
{
public function toAttributes($request): array
{
return [
'name' => $this->name,
'email' => $this->email,
];
}
public function toRelationships($request): array
{
return [
'posts' => PostResource::collection($this->whenLoaded('posts')),
];
}
}
5. Queue Routing
Laravel 13 adds queue routing by class via Queue::route(...). This allows you to define default queue and connection routing rules for specific jobs in a central location.
Example: Centralized Queue Routing
// In a service provider's boot method
Queue::route(ProcessPodcast::class, connection: 'redis', queue: 'podcasts');
Queue::route(SendEmail::class, connection: 'sqs', queue: 'emails');
This eliminates the need to define $connection and $queue properties on each job class.
6. Semantic / Vector Search
Native vector query support is now available, including embedding workflows and semantic search capabilities. This makes it easy to build AI-powered search experiences using PostgreSQL + pgvector.
Example: Running a Semantic Similarity Search
$documents = DB::table('documents')
->whereVectorSimilarTo('embedding', 'Best wineries in Napa Valley')
->limit(10)
->get();</code></pre><p>You can also generate embeddings directly from strings and perform similarity searches against them.</p><p><strong>7. Cache::touch()</strong></p><p>A new Cache::touch() method allows you to extend a cached item's TTL without fetching or re-storing the value. This is more efficient, especially for large payloads.</p><p>Example: Using Cache::touch()</p><pre><code>// Extend by seconds
Cache::touch('user_session:123', 3600);
// Extend with a DateTime
Cache::touch('analytics_data', now()->addHours(6));
// Extend indefinitely (null TTL)
Cache::touch('report_cache', null);
The method returns true on success and false if the key doesn't exist. It's implemented across all cache drivers, including Redis, Memcached, Database, and File.
---
Laravel 13 Support Timeline
Following Laravel's established support policy, here is the timeline for recent versions:
Version PHP (*) Release Bug Fixes Until Security Fixes Until
10 8.1 - 8.3 February 14, 2023 August 6, 2024 February 4, 2025
11 8.2 - 8.4 March 12, 2024 September 3, 2025 March 12, 2026
12 8.2 - 8.5 February 24, 2025 August 13, 2026 February 24, 2027
13 8.3 - 8.5 Q1 2026 Q3 2027 Q1 2028
Laravel 12 will continue receiving bug fixes until August 13, 2026, and security fixes until February 24, 2027.
---
Upgrading to Laravel 13
The Laravel team has focused on minimizing breaking changes to make upgrading as smooth as possible. For an automated upgrade experience, consider using Laravel Shift, which will open a pull request with atomic commits for you to review.
---
Summary of Key Features
Feature Benefit
PHP 8.3 Required Latest language features and performance
PHP Attributes Support Cleaner, more declarative framework configuration
Laravel AI SDK Unified API for AI tasks (text, embeddings, vector stores)
JSON:API Resources Standards-compliant API responses with less boilerplate
Queue Routing Centralized queue configuration for jobs
Vector Search Native semantic search using embeddings (PostgreSQL+pgvector)
Cache::touch() Efficient TTL extension without fetching data
Laravel 13 represents a significant step forward, embracing modern PHP and AI capabilities while prioritizing a stable, upgrade-friendly experience. For complete details, refer to the official Laravel 13 release notes.