Laravel 13 the most important Feature to care About
Here are the biggest additions in Laravel 13 that make writing modern laravel php code feel better than ever.
1- First-Class PHP Attributes:
In old laravel version, Eloquent models and queued jobs have been defined by a wall of class properties declared at the top of file but now in LAravel 13, native PHP #[Attribute] syntax is available across more than 15 locations in the framework.
BEFORE:
class ProcessPayment implements ShouldQueue
{
public $connection = 'redis';
public $queue = 'payments';
public $tries = 3;
public $timeout = 60;
// ...
}In Laravel 13:
use Illuminate\Queue\Attributes\WithQueue;
#[WithQueue(connection: 'redis', queue: 'payments', tries: 3, timeout: 60)]
class ProcessPayment implements ShouldQueue
{
// Clean, readable, and compact
}You can do the exact same thing on Eloquent models to declare fillables, hidden attributes, or custom table names:
#[Table('users', key: 'user_id')]
#[Fillable(['name', 'email'])]
#[Hidden(['password'])]
class User extends Model {}2- Cache::touch() — Extend Expiry Without the Overhead:
How ofter have you needed to extend a cache key’s TTL (like a user session, an active rate limit, or a hot dashboard metric)?
Previously, extending expiry required fetchinh the cached value, modifying it, and re-storing it. That is two network operations and wasted memory serialization just to update a timestamp.
Get Talhaoui mouad’s stories in your inbox
Join Medium for free to get updates from this writer.
In Laravel we have Cache::touch():
// Extend TTL by 3600 seconds without fetching or re-storing data
Cache::touch('user_session:123', 3600);
// Or extend it with a DateTime
Cache::touch('analytics_data', now()->addHours(6));Under the hood, Redis receives a single EXPIRE commmand, Memcached executes a native TOUCH, and the database driver runs a basic UPDATE? No payload transfers, no uszeless overhead.
3- Native Semantic & Vector Search:
Building AI driven features like semantic search, RAG, recommendation engines usually meant pulling in third-party packages or setting up custom abstractions.
With the official LARAVEL AI SDK going stable alongside Laravel 13, vector query support is now baked directly into the framework. If you are using PostgreSQL with pgvector, you c run similarity queries right from the fluent query builder:
$documents = DB::table('documents')
->whereVectorSimilarTo('embedding', 'Best cafes with fast Wi-Fi in London')
->limit(5)
->get();Generating embeddings from raw strings, querying vectors, and connecting to models (OpenAI, Anthropic, Ollama) is now part of the core ecosystem.
4- Native Passkey Support:
Passwordless authentication is no longer a luxury feature that takes three days to configure properly.
Laravel 13 brings native Passkey (WebAuthn) authentication to official starter kits and Fortify. Out of the box, new applications support biometric login (Touch ID, Face ID, Windows Hello) and physical security keys.
The private keys never leave the user’s device, rendering phishing and credential-stuffing attacks useless against your auth endpoints.
5- Centralized Queue Routing:
If your application dispatches dozens of different queued jobs, configuring their target connections and queues inside individual job classes (or repeating arguments at every dispatch() site) can quickly turn into a maintainability mess.
Laravel 13 lets you route queue jobs centrally inside a Service Provider:
use App\Jobs\ProcessPodcast;
use App\Jobs\GeneratePdfReport;
use Illuminate\Support\Facades\Queue;
public function boot(): void
{
Queue::route(ProcessPodcast::class, connection: 'redis', queue: 'media');
Queue::route(GeneratePdfReport::class, connection: 'sqs', queue: 'exports');
}Now your business logic just calls ProcessPodcast::dispatch($podcast), and the infrastructure topology stays isolated where it belongs.










