Laravel 13.40.0
Laravel 13.40.0 landed on November 3, 2026, exactly a week after 13.39.0. It is a maintenance release with no new configuration, but it is not a no-op: two new duration helpers change how you instrument queues and the scheduler, and a cluster of database fixes removes some long-standing sharp edges.
The Two Helpers Worth Adopting Today
Queue::whenJobRunsLongerThan() and Schedule::whenTaskRunsLongerThan() are the headline additions. Both give you a callback when a queued job or scheduled task crosses a duration threshold, which is the observability hook that was previously hand-rolled with middleware and a stopwatch. If you already have custom timing middleware, this is a candidate for deletion.
Middleware registration also got less awkward. $middleware->replace() now accepts an array of replacements instead of one pair at a time, and insertBefore() plus insertAfter() exist as first-class methods, so a bootstrap file with several replacements can collapse them into a single array call.
Database Fixes You Will Feel
- Reconnects inside transactions. A dropped connection during a transaction now reconnects instead of throwing immediately, and nested transactions roll back to a savepoint on concurrency errors rather than unwinding the outer transaction.
- BelongsToMany createOrFirst. The existence lookup now uses the write connection, closing the read-replica lag hole that made
createOrFirst()occasionally attempt a duplicate insert. - JSON columns on MySQL and MariaDB. Updating JSON paths with arrays and collections no longer produces broken SQL.
- SQL Server. Dropping a column drops its check constraints first,
orderByis respected on update and delete with a limit, andwithExists()andloadExists()generate valid queries. - PostgreSQL. Dropped and renamed indexes are schema-qualified, and the full text search language list gained the missing entries.
- SQLite.
forceIndex()no longer produces invalid SQL forPRIMARYor for multiple indexes.
Queue, Cache, and Schedule Behaviour
Flushing many tagged cache entries no longer blocks Redis for the whole operation, which removes a latency spike on shared instances. Cloud log sockets reconnect after a failed write instead of staying dead until the process restarts. Scheduled tasks that lose the race to another server now dispatch a ScheduledTaskSkipped event, so the "why did this not run" question finally has an answer in the logs. And queue:work output marks released jobs as released rather than leaving them looking like ordinary retries.
Smaller Corrections
Pagination contracts and Paginator::links() return types were corrected, ImageFile::default() no longer degrades into a plain File rule, Cookie::queue() accepts named arguments again, Str::substrCount() stops treating offset and length as bytes, Str::remove() accepts a Traversable subject, and broadcasting to multiple encrypted Pusher channels works. Failed batch jobs are recorded even when the related model is gone, and error_get_last() is preserved for suppressed errors. Lazy-loaded images are freed without waiting for garbage collection, which is a small but welcome memory win on long-running workers.
Upgrading
There is no new configuration and no migration in this release. Run composer update laravel/framework, clear compiled views and config if you cache them, and run your suite. The only behavioural change I would flag in a code review is the queue:work output text, in case a log parser keys off it. Worth the upgrade for the two duration hooks alone.