Laravel 13.18: Worker Metrics &amp; More | Mohamed Said        [  ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MH.png)   Mohamed Said Laravel Backend Engineer  ](https://msaied.com) [ Home ](https://msaied.com) [ Projects ](https://msaied.com/projects) [ Articles  ](https://msaied.com/articles) [ Certificates ](https://msaied.com/certificates) [ Contact ](https://msaied.com#contact-section) 

       [  ](https://github.com/EG-Mohamed)       

 [ Home ](https://msaied.com) [ Projects ](https://msaied.com/projects) [ Articles ](https://msaied.com/articles) [ Certificates ](https://msaied.com/certificates) [ Contact ](https://msaied.com#contact-section) 

  [ home ](https://msaied.com)    [ articles ](https://msaied.com/articles)    Worker Metrics on the WorkerStopping Event in Laravel 13.18        On this page       1. [  What's New in Laravel 13.18 ](#whats-new-in-laravel-1318)
2. [  Worker Metrics on the WorkerStopping Event ](#worker-metrics-on-the-codeworkerstoppingcode-event)
3. [  Graceful Shutdown for schedule:work ](#graceful-shutdown-for-codescheduleworkcode)
4. [  Priority-Based Dev Command Registration ](#priority-based-dev-command-registration)
5. [  Number Helpers Hardened Against INF and NAN ](#number-helpers-hardened-against-inf-and-nan)
6. [  Other Fixes and Improvements ](#other-fixes-and-improvements)
7. [  Key Takeaways ](#key-takeaways)

  ![Worker Metrics on the WorkerStopping Event in Laravel 13.18](https://cdn.msaied.com/338/11a987dabe96024609cdd3bdb669c33c.png)

 [  Laravel ](https://msaied.com/articles?category=laravel)  #Laravel   #Queue   #Scheduler   #Artisan   #Laravel 13  

 Worker Metrics on the WorkerStopping Event in Laravel 13.18 
=============================================================

     1 Jul 2026      3 min read    ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MJ.jpg)  Mohamed Said  

       Table of contents

1. [  01   What's New in Laravel 13.18  ](#whats-new-in-laravel-1318)
2. [  02   Worker Metrics on the WorkerStopping Event  ](#worker-metrics-on-the-codeworkerstoppingcode-event)
3. [  03   Graceful Shutdown for schedule:work  ](#graceful-shutdown-for-codescheduleworkcode)
4. [  04   Priority-Based Dev Command Registration  ](#priority-based-dev-command-registration)
5. [  05   Number Helpers Hardened Against INF and NAN  ](#number-helpers-hardened-against-inf-and-nan)
6. [  06   Other Fixes and Improvements  ](#other-fixes-and-improvements)
7. [  07   Key Takeaways  ](#key-takeaways)

 What's New in Laravel 13.18
---------------------------

Laravel 13.18.0 ships a focused set of improvements across the queue worker, scheduler, Artisan dev commands, and Number helpers, alongside a batch of targeted bug fixes.

### Worker Metrics on the `WorkerStopping` Event

The `WorkerStopping` event now exposes two new properties that describe what a worker did before it shut down:

- **`jobsProcessed`** (`int|null`) — the total number of jobs the worker handled during its lifetime.
- **`lastJobProcessedAt`** (`int|float|null`) — a microtime timestamp of the last job processed, or `null` if the worker stopped before processing anything.

```php
use Illuminate\Queue\Events\WorkerStopping;

Event::listen(function (WorkerStopping $event) {
    $event->jobsProcessed;      // int|null
    $event->lastJobProcessedAt; // int|float|null (microtime)
});

```

Both values are populated whether the worker exits normally or is killed. This gives you a clean hook to record per-worker throughput or emit metrics to an observability platform when a daemon exits, without instrumenting the job loop yourself.

> PRs: [\#60592](https://github.com/laravel/framework/pull/60592) and [\#60608](https://github.com/laravel/framework/pull/60608)

### Graceful Shutdown for `schedule:work`

`schedule:work` now catches `SIGINT`, `SIGTERM`, and `SIGQUIT`. On receiving one of these signals it stops scheduling new runs and waits for any in-progress `schedule:run` to finish before exiting — mirroring the existing behavior of `queue:work`.

This is particularly relevant in container environments like Kubernetes, where pods receive `SIGTERM` on shutdown. Previously, that signal could interrupt a task mid-execution.

> PR: [\#60616](https://github.com/laravel/framework/pull/60616)

### Priority-Based Dev Command Registration

Dev commands registered for `artisan dev` now carry a source priority: userland application commands win over vendor package commands, which win over framework defaults — regardless of service provider boot order.

```php
use Illuminate\Foundation\Console\DevCommands;

DevCommands::artisan('reverb:start --host="0.0.0.0"', 'reverb');

```

This replaces the previous vendor auto-registration blocker approach with explicit priority, so your overrides always take effect. Additionally, `artisan dev` now runs with `--kill-others-on-fail`, meaning if one process in the group fails, the rest are stopped rather than left running.

> PRs: [\#60580](https://github.com/laravel/framework/pull/60580) and [\#60606](https://github.com/laravel/framework/pull/60606)

### Number Helpers Hardened Against INF and NAN

`Number::forHumans()`, `Number::abbreviate()`, and `Number::fileSize()` previously threw exceptions when passed `INF` or `NAN`. All three are now fixed to handle these edge-case inputs without crashing.

> PRs: [\#60617](https://github.com/laravel/framework/pull/60617) and [\#60625](https://github.com/laravel/framework/pull/60625)

### Other Fixes and Improvements

- Reduced unnecessary cache hits when using debounced jobs ([\#60575](https://github.com/laravel/framework/pull/60575))
- Fixed cache headers not being set on HEAD requests ([\#60589](https://github.com/laravel/framework/pull/60589))
- Prevented the `restored` event from firing when a soft-delete restore fails ([\#60605](https://github.com/laravel/framework/pull/60605))
- Fixed `RateLimited` middleware not serializing `releaseAfter` in `__sleep()` ([\#60609](https://github.com/laravel/framework/pull/60609))
- Fixed `flexible()` lock and defer label collisions in `TaggedCache` ([\#60626](https://github.com/laravel/framework/pull/60626))
- Fixed JSON parsing for top-level zero bodies ([\#60614](https://github.com/laravel/framework/pull/60614))
- Added conditional return types and synced getter return types with property generics

Key Takeaways
-------------

- Listen to `WorkerStopping` to capture per-worker job counts and last-processed timestamps without custom instrumentation.
- `schedule:work` now handles `SIGTERM` gracefully — important for Kubernetes and other container runtimes.
- Userland `artisan dev` command registrations always win over vendor and framework defaults via explicit priority.
- `Number::forHumans()`, `Number::abbreviate()`, and `Number::fileSize()` no longer crash on `INF` or `NAN` inputs.
- Several cache, scheduler, and middleware edge-case bugs are resolved in this release.

---

*Source: [Laravel News — Laravel 13.18.0](https://laravel-news.com/laravel-13-18-0)*

 Found this useful?

          [  ](https://twitter.com/intent/tweet?url=https%3A%2F%2Fmsaied.com%2Farticles%2Fworker-metrics-on-the-workerstopping-event-in-laravel-1318&text=Worker+Metrics+on+the+WorkerStopping+Event+in+Laravel+13.18) [  ](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fmsaied.com%2Farticles%2Fworker-metrics-on-the-workerstopping-event-in-laravel-1318) 

 Frequently Asked Questions 
----------------------------

  3 questions  

     Q01  What new data does the WorkerStopping event expose in Laravel 13.18?        The WorkerStopping event now includes two properties: `jobsProcessed` (the number of jobs handled during the worker's lifetime) and `lastJobProcessedAt` (a microtime timestamp of the final job processed, or null if no jobs were processed). 

      Q02  Why does graceful shutdown for schedule:work matter in Kubernetes?        Kubernetes sends SIGTERM to pods during shutdown. Before Laravel 13.18, schedule:work did not catch this signal, so an in-progress scheduled task could be interrupted mid-execution. Now it waits for the current run to finish before exiting. 

      Q03  How does priority-based dev command registration work in artisan dev?        Commands registered for artisan dev are assigned a priority based on their source: application-level registrations take precedence over vendor package registrations, which take precedence over framework defaults. This ensures your overrides always win regardless of service provider boot order. 

  Continue reading

 More Articles 
---------------

 [ View all    ](https://msaied.com/articles) 

 [ ![Laravel 13: New Features, Helpers, and Practical Upgrade Notes](https://cdn.msaied.com/339/58c4fa6fe9b6d25a2dac17c621b6f4c6.png) laravel laravel-13 upgrade 

### Laravel 13: New Features, Helpers, and Practical Upgrade Notes

Laravel 13 ships with async-first defaults, a leaner bootstrapping layer, and several quality-of-life helpers....

  ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MJ.jpg)  Mohamed Said 

 1 Jul 2026     3 min read  

  Read    

 ](https://msaied.com/articles/laravel-13-new-features-helpers-and-practical-upgrade-notes) [ ![Laravel 12: Structured Route Files, Slim Skeletons, and the New Application Bootstrapping](https://cdn.msaied.com/337/05b39d16d0f88a5fb94d0cf74049b88b.png) laravel laravel-12 upgrade 

### Laravel 12: Structured Route Files, Slim Skeletons, and the New Application Bootstrapping

Laravel 12 ships with a leaner skeleton, first-class route file organisation, and a revised application bootst...

  ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MJ.jpg)  Mohamed Said 

 1 Jul 2026     3 min read  

  Read    

 ](https://msaied.com/articles/laravel-12-structured-route-files-slim-skeletons-and-the-new-application-bootstrapping) [ ![Laravel API Resources: Sparse Fieldsets, Conditional Relationships, and Versioning](https://cdn.msaied.com/336/89d518450335e8fcdaa5be882cf4dd3e.png) laravel api resources 

### Laravel API Resources: Sparse Fieldsets, Conditional Relationships, and Versioning

Go beyond basic API resources. Learn how to implement sparse fieldsets, conditionally load relationships, and...

  ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MJ.jpg)  Mohamed Said 

 1 Jul 2026     3 min read  

  Read    

 ](https://msaied.com/articles/laravel-api-resources-sparse-fieldsets-conditional-relationships-and-versioning) 

   [  ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MH.png)   Mohamed Said Laravel Backend Engineer  ](https://msaied.com)Senior Backend Engineer specializing in Laravel, scalable SaaS platforms, APIs, and cloud infrastructure. I build secure, high-performance web applications that help businesses grow.

Explore

- [Home](https://msaied.com)
- [Projects](https://msaied.com/projects)
- [Articles](https://msaied.com/articles)
- [Certificates](https://msaied.com/certificates)
- [Contact](https://msaied.com#contact-section)

Connect

- [   hello@msaied.com ](mailto:hello@msaied.com)
- [   +20 109 461 9204 ](tel:+201094619204)

© 2026 Mohamed Said. All rights reserved.

 [  ](https://github.com/EG-Mohamed) [  ](https://www.linkedin.com/in/msaiedm/) [  ](https://wa.me/201094619204) [  ](mailto:hello@msaied.com) [  ](https://drive.google.com/file/u/0/d/1MF20IPRJyzfy32mhEutjL5EpSls0w2Q8/view)
