Laravel Time Machine: Request Lifecycle Profiler | Mohamed Said       [Skip to content](#main)  [ ![](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MH.png) Mohamed SaidLaravel Backend Engineer ](https://www.msaied.com/public) - [Home](https://www.msaied.com/public)
- [Projects](https://www.msaied.com/public/projects)
- [Articles](https://www.msaied.com/public/articles)
- [Certificates](https://www.msaied.com/public/certificates)
- [About](https://www.msaied.com/public#about)

           [  Contact](https://www.msaied.com/public#contact) Menu 

Menu
----

Close 

 - [HomeStart here](https://www.msaied.com/public)
- [ProjectsCase studies](https://www.msaied.com/public/projects)
- [ArticlesEngineering notes](https://www.msaied.com/public/articles)
- [CertificatesCredentials](https://www.msaied.com/public/certificates)
- [AboutHow I work](https://www.msaied.com/public#about)
- [ContactGet in touch](https://www.msaied.com/public#contact)

  [Start a conversation](https://www.msaied.com/public#contact) [WhatsApp](https://wa.me/201094619204) [Email](mailto:hello@msaied.com) 

 1. [Home](https://www.msaied.com/public)
2. /
3. [Articles](https://www.msaied.com/public/articles)
4. /
5. [Laravel](https://www.msaied.com/public/articles?category=laravel)
6. /
7. Laravel Time Machine: Profile Every Stage of a Request Lifecycle

   [Laravel](https://www.msaied.com/public/articles?category=laravel) [Composer Pacakge](https://www.msaied.com/public/articles?category=composer-pacakge) 

 Laravel Time Machine: Profile Every Stage of a Request Lifecycle
=================================================================

 Laravel Time Machine is a request lifecycle profiler that records millisecond timings for every phase — bootstrap, middleware, routing, controller, response, and termination — and presents them on a visual timeline dashboard.

 ![](https://cdn.msaied.com/01M22N44A70A5MC2S599JP0MPH.webp) [Mohamed Said](https://www.msaied.com/public#person) Published 20 Jul 2026 · Updated 21 Jul 2026 · 3 min read

ShareCopy linkCopied

 ![Laravel Time Machine: Profile Every Stage of a Request Lifecycle](https://cdn.msaied.com/453/308c1bf5c3ea88a09ccda212f98bc409.png) 

  On this page +1. [What Is Laravel Time Machine?](#what-is-laravel-time-machine)
2. [Key Features at a Glance](#key-features-at-a-glance)
3. [The Timeline Dashboard](#the-timeline-dashboard)
4. [Custom Instrumentation with the TimeMachine Facade](#custom-instrumentation-with-the-timemachine-facade)
5. [Storage Without a Database](#storage-without-a-database)
6. [How It Compares to Telescope and Debugbar](#how-it-compares-to-telescope-and-debugbar)
7. [Installation](#installation)
8. [Real Takeaways](#real-takeaways)

 What Is Laravel Time Machine?
-----------------------------

[Laravel Time Machine](https://github.com/JaydeepGadhiya/laravel-timemachine) is an open-source performance profiler by Jaydeep Gadhiya that answers one question: **where did the time go in this request?** It hooks into every stage of the Laravel request lifecycle — bootstrap, middleware, routing, controller, response, and termination — and records millisecond-accurate timings for each phase.

The package is enabled by `APP_DEBUG` by default, so it stays off in production unless you explicitly turn it on.

Key Features at a Glance
------------------------

- **Lifecycle timeline** — a Gantt-style breakdown from framework boot through the `terminate` step.
- **Query capture** — every SQL statement with bindings, connection name, and execution time (toggle via `collectors.queries`).
- **Slow highlighting** — requests over 500 ms and queries over 50 ms are flagged; both thresholds are configurable.
- **Flat-file storage** — profiles are plain JSON files in `storage/time-machine`; no migrations needed.
- **Ignore patterns** — asset requests and paths like the Telescope dashboard can be skipped via `ignore_paths`.
- **Debug-only by default** — follows `APP_DEBUG` so production stays clean.

The Timeline Dashboard
----------------------

Once installed, the package records every HTTP request automatically and serves a self-contained dashboard at `/time-machine`. Each entry shows a visual timeline of lifecycle phases alongside memory usage and query counts. Requests that cross the slow threshold are highlighted so bottlenecks stand out immediately.

Custom Instrumentation with the TimeMachine Facade
--------------------------------------------------

Beyond automatic lifecycle phases, you can instrument your own code using the `TimeMachine` facade:

```php
use Jaydeep\LaravelTimeMachine\Facades\TimeMachine;

// Drop a marker on the timeline
TimeMachine::mark('cache primed');

// Time a code block
$report = TimeMachine::measure('generate-report', function () {
    return Report::build();
});

// Manual span control
TimeMachine::startSpan('external-api');
$response = Http::get('https://api.example.com');
TimeMachine::endSpan('external-api');

```

Custom spans appear on the same timeline as framework phases, making it easy to see how a slow external API call or a heavy report fits into the overall request.

Storage Without a Database
--------------------------

Profiles are written as JSON files to `storage/time-machine`. There are no migrations to run and data never leaves your server. The package retains the 100 most recent profiles by default, pruning the oldest as new requests arrive. Adjust the limit with `storage.max_records` in the config file or the `TIME_MACHINE_MAX_RECORDS` environment variable.

How It Compares to Telescope and Debugbar
-----------------------------------------

| Tool | Storage | Scope | History | |---|---|---|---| | Laravel Telescope | Database | Requests, jobs, mail, cache, and more | Yes | | Laravel Debugbar | In-page toolbar | Timing and queries for current response | No | | Laravel Time Machine | Flat JSON files | Lifecycle timing and queries only | Yes (last 100) |

Time Machine sits between the two: it keeps a browsable history like Telescope but collects only lifecycle timing and query data, stored in flat files. If you need full application monitoring, Telescope remains the better fit. If you want to profile exactly where individual requests spend their time, Time Machine is purpose-built for that.

Installation
------------

The package supports Laravel 8 through 13. Install via Composer — auto-discovery handles the service provider and facade:

```bash
composer require jaydeep/laravel-time-machine

```

Publishing the config file is optional:

```bash
php artisan vendor:publish --tag=time-machine-config

```

Real Takeaways
--------------

- Pinpoint slow lifecycle phases (middleware, routing, controller) with millisecond precision.
- Capture and flag slow SQL queries without touching your database schema.
- Add custom spans around external API calls or heavy computations in seconds.
- Zero-migration setup keeps the profiler lightweight and portable.
- Debug-only default means no accidental performance overhead in production.

---

*Source: [Laravel Time Machine: A Request Lifecycle Profiler — Laravel News](https://laravel-news.com/laravel-time-machine-a-request-lifecycle-profiler)*

- [Laravel](https://www.msaied.com/public/articles?search=Laravel)
- [Performance Profiling](https://www.msaied.com/public/articles?search=Performance%20Profiling)
- [Developer Tools](https://www.msaied.com/public/articles?search=Developer%20Tools)
- [Composer Package](https://www.msaied.com/public/articles?search=Composer%20Package)
- [Debugging](https://www.msaied.com/public/articles?search=Debugging)

 Frequently asked questions 
---------------------------

  Does Laravel Time Machine require a database or migrations?No. Profiles are stored as plain JSON files in `storage/time-machine`. There are no database tables or migrations required, and data never leaves your server.

   How is Laravel Time Machine different from Laravel Telescope?Telescope monitors many application concerns (requests, jobs, mail, cache, and more) and stores data in a database. Time Machine focuses exclusively on request lifecycle timing and SQL queries, stores data in flat files, and presents results on a Gantt-style timeline — making it lighter and more focused for per-request performance profiling.

   Is Laravel Time Machine safe to leave installed in production?By default the profiler follows `APP\_DEBUG`, so it is inactive when `APP\_DEBUG=false`. You can explicitly enable or disable it regardless of the debug setting via the package configuration.

   ![Mohamed Said](https://cdn.msaied.com/01M22N44A70A5MC2S599JP0MPH.webp)About the author
----------------

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

[About](https://www.msaied.com/public#about) [GitHub ↗](https://github.com/EG-Mohamed) [LinkedIn ↗](https://www.linkedin.com/in/msaiedm/) [WhatsApp ↗](https://wa.me/201094619204) [Email Address ↗](mailto:hello@msaied.com) [My CV ↗](https://drive.google.com/file/u/0/d/1MF20IPRJyzfy32mhEutjL5EpSls0w2Q8/view)  

   [Previous articleLaravel + Python FastAPI: Image OCR Demo](https://www.msaied.com/public/articles/laravel-python-fastapi-image-ocr-demo) [Next articleDDD Value Objects and DTOs in Laravel Without the Bloat](https://www.msaied.com/public/articles/ddd-value-objects-and-dtos-in-laravel-without-the-bloat)  

   On this page
-------------

1. [What Is Laravel Time Machine?](#what-is-laravel-time-machine)
2. [Key Features at a Glance](#key-features-at-a-glance)
3. [The Timeline Dashboard](#the-timeline-dashboard)
4. [Custom Instrumentation with the TimeMachine Facade](#custom-instrumentation-with-the-timemachine-facade)
5. [Storage Without a Database](#storage-without-a-database)
6. [How It Compares to Telescope and Debugbar](#how-it-compares-to-telescope-and-debugbar)
7. [Installation](#installation)
8. [Real Takeaways](#real-takeaways)

 ###  Have a technical challenge?

 Tell me what you’re building. I reply within two working days.

[Start a conversation](https://www.msaied.com/public#contact) 

   Related articles
-----------------

 [ ![](https://cdn.msaied.com/740/cce86edc21eddcbdd2f2454fadaf9c70.png)  · 3 min read### The Pipeline Pattern in Laravel: Custom Pipelines Beyond Middleware

5 Oct 2026 ](https://www.msaied.com/public/articles/the-pipeline-pattern-in-laravel-custom-pipelines-beyond-middleware-1) [ ![](https://cdn.msaied.com/739/2d6897fdcdcf090613f96f72a64b8a78.png)  · 4 min read### MySQL Full-Text Search in Laravel: Indexes, Relevance Scoring, and Boolean Mode

4 Oct 2026 ](https://www.msaied.com/public/articles/mysql-full-text-search-in-laravel-indexes-relevance-scoring-and-boolean-mode) [ ![](https://cdn.msaied.com/738/073696a3fefe18bec825beec5ac658f5.png)  · 4 min read### Laravel Queue Rate-Limited Middleware: Throttling Jobs Without Losing Work

4 Oct 2026 ](https://www.msaied.com/public/articles/laravel-queue-rate-limited-middleware-throttling-jobs-without-losing-work) 

  Have a technical challenge?
----------------------------

Tell me what you’re building. I reply within two working days.

 [Discuss your project ↗](https://www.msaied.com/public#contact) 

  © 2026 Mohamed Said · Built with Laravel, meant to last.Senior Backend Engineer specializing in Laravel, scalable SaaS platforms, APIs, and cloud infrastructure. I build secure, high-performance web applications that help businesses grow.

 - [Home](https://www.msaied.com/public)
- [Articles](https://www.msaied.com/public/articles)
- [Certificates](https://www.msaied.com/public/certificates)
- [GitHub](https://github.com/EG-Mohamed)
- [LinkedIn](https://www.linkedin.com/in/msaiedm/)
- [WhatsApp](https://wa.me/201094619204)
- [Email Address](mailto:hello@msaied.com)
- [My CV](https://drive.google.com/file/u/0/d/1MF20IPRJyzfy32mhEutjL5EpSls0w2Q8/view)
- [Sitemap](https://www.msaied.com/public/sitemap.xml)
