PHPackages                             grazulex/laravel-chronotrace - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. grazulex/laravel-chronotrace

ActiveLibrary[Testing &amp; Quality](/categories/testing)

grazulex/laravel-chronotrace
============================

Record and replay Laravel requests deterministically and generate tests from production traces.

v0.1.0(2mo ago)1323671MITPHPPHP ^8.3CI passing

Since Jul 31Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/Grazulex/laravel-chronotrace)[ Packagist](https://packagist.org/packages/grazulex/laravel-chronotrace)[ Docs](https://github.com/grazulex/laravel-chronotrace)[ Fund](https://www.buymeacoffee.com/Grazulex)[ Fund](https://paypal.me/strauven)[ RSS](/packages/grazulex-laravel-chronotrace/feed)WikiDiscussions main Synced 3d ago

READMEChangelog (5)Dependencies (20)Versions (8)Used By (0)

Laravel ChronoTrace
===================

[](#laravel-chronotrace)

 [![Laravel ChronoTrace](new_logo.png)](new_logo.png)**⏱️ Record and replay Laravel requests deterministically — capture all database queries, cache operations, HTTP calls, and queue jobs for debugging and analysis.**

[![Latest Version](https://camo.githubusercontent.com/f50a2fd21b29bd6a6b925fc15ef6b941eebc0454db772a130cb30d5870a3db26/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6772617a756c65782f6c61726176656c2d6368726f6e6f74726163652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/grazulex/laravel-chronotrace)[![Total Downloads](https://camo.githubusercontent.com/074d1fa100ffda29229d33c171f1acdda3e53827bd971b3f44fcf8de43142d48/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6772617a756c65782f6c61726176656c2d6368726f6e6f74726163652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/grazulex/laravel-chronotrace)[![License](https://camo.githubusercontent.com/0b0635278b14080a0e0768102143e4d39fbca67848b7966baf77a4d6d8176037/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6772617a756c65782f6c61726176656c2d6368726f6e6f74726163652e7376673f7374796c653d666c61742d737175617265)](https://github.com/Grazulex/laravel-chronotrace/blob/main/LICENSE.md)[![PHP Version](https://camo.githubusercontent.com/65d6649c8329d23e709950ae4b1511468bb1f2d4143f9d07ed04b3f88b242e22/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d382e332532422d3737376262343f7374796c653d666c61742d737175617265266c6f676f3d706870)](https://php.net/)[![Laravel Version](https://camo.githubusercontent.com/abc403b1f8383943a73fc90c396e458fd82e1fbbe8c6a37d1980a9b9f0375b85/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c61726176656c2d31322e7825323025374325323031332e782d6666326432303f7374796c653d666c61742d737175617265266c6f676f3d6c61726176656c)](https://laravel.com/)[![Tests](https://camo.githubusercontent.com/b01c7470541efffad5c1e09b7ccbfd1a0309041a78b5084db47e99c1be570549/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6772617a756c65782f6c61726176656c2d6368726f6e6f74726163652f74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/Grazulex/laravel-chronotrace/actions)[![Code Style](https://camo.githubusercontent.com/161d70e6871f808e0439b3e7a86540993ae98775540b5a2e78226000e3c419c7/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f636f64652532307374796c652d70696e742d3030303030303f7374796c653d666c61742d737175617265266c6f676f3d6c61726176656c)](https://github.com/laravel/pint)

---

📖 Overview
----------

[](#-overview)

**Laravel ChronoTrace** is a powerful debugging and monitoring tool for Laravel applications that allows you to:

- **🎯 Capture** HTTP requests and their complete execution context (DB queries, cache operations, external HTTP calls, queue jobs)
- **🔄 Replay** traces to analyze what happened during specific requests
- **🔍 Debug** production issues with comprehensive event logs
- **📊 Monitor** application performance and identify bottlenecks

Perfect for debugging hard-to-reproduce issues, performance analysis, and understanding complex application flows.

---

✨ Features
----------

[](#-features)

- **⏺️ Smart Recording** – Multiple recording modes: always, sample rate, error-only, or targeted routes
- **📊 Comprehensive Event Capture** – Database queries, cache operations, HTTP requests, queue jobs, and custom events
- **🔄 Detailed Replay** – View complete execution flow with timestamps and performance metrics
- **🎯 Flexible Filtering** – Focus on specific event types (DB, cache, HTTP, jobs) during analysis
- **💾 Multiple Storage Options** – Local storage, S3, or custom storage adapters
- **🔐 PII Scrubbing** – Automatically mask sensitive data (passwords, tokens, emails, etc.)
- **⚡ Async Storage** – Queue-based storage for minimal performance impact
- **🗂️ Automatic Cleanup** – Configurable retention policies and automatic purging

---

📦 Installation
--------------

[](#-installation)

```
composer require --dev grazulex/laravel-chronotrace
```

**Requirements:**

- PHP 8.3+
- Laravel 12.x / 13.x

---

🚀 Quick Start
-------------

[](#-quick-start)

### 1️⃣ Install and Configure

[](#1️⃣-install-and-configure)

```
composer require --dev grazulex/laravel-chronotrace
php artisan chronotrace:install
```

### 2️⃣ Configure Recording Mode

[](#2️⃣-configure-recording-mode)

Edit `config/chronotrace.php` or set environment variables:

```
CHRONOTRACE_ENABLED=true
CHRONOTRACE_MODE=record_on_error  # always | sample | record_on_error | targeted
CHRONOTRACE_STORAGE=local         # local | s3
```

### 3️⃣ Record Traces

[](#3️⃣-record-traces)

**For debugging real application issues:**

```
# Record a specific endpoint
php artisan chronotrace:record /api/users

# Record with POST data
php artisan chronotrace:record /api/users \
  --method=POST \
  --data='{"name":"John","email":"john@example.com"}'

# Record with custom headers
php artisan chronotrace:record /api/protected \
  --method=GET \
  --headers='{"Authorization":"Bearer token123"}'
```

**For testing ChronoTrace configuration:**

```
# Test that ChronoTrace captures internal operations
php artisan chronotrace:test-internal

# Test specific operation types
php artisan chronotrace:test-internal --with-db --with-cache
```

> **💡 Key Difference**: `chronotrace:record` captures real HTTP requests for debugging actual issues, while `chronotrace:test-internal` validates that ChronoTrace is properly configured and working.

### 4️⃣ View Your Traces

[](#4️⃣-view-your-traces)

```
# List all traces
php artisan chronotrace:list

# List with full trace IDs
php artisan chronotrace:list --full-id

# Replay a specific trace (use ID from list command)
php artisan chronotrace:replay abc12345-def6-7890-abcd-ef1234567890
```

### 5️⃣ Filter Events and Generate Tests

[](#5️⃣-filter-events-and-generate-tests)

```
# View only database queries
php artisan chronotrace:replay {trace-id} --db

# View only cache operations
php artisan chronotrace:replay {trace-id} --cache

# View only HTTP requests
php artisan chronotrace:replay {trace-id} --http

# View only queue jobs
php artisan chronotrace:replay {trace-id} --jobs

# View detailed information with context, headers, and content
php artisan chronotrace:replay {trace-id} --detailed

# Show SQL query bindings for debugging
php artisan chronotrace:replay {trace-id} --db --bindings

# Generate Pest tests from traces
php artisan chronotrace:replay {trace-id} --generate-test

# Generate tests in custom directory
php artisan chronotrace:replay {trace-id} --generate-test --test-path=tests/Integration

# Output as JSON for programmatic processing
php artisan chronotrace:replay {trace-id} --format=json
```

---

🔧 Storage &amp; Configuration
-----------------------------

[](#-storage--configuration)

- **Local Storage**: `storage/chronotrace/{date}/{trace-id}/`
- **S3/Minio**: Support for distributed setups with configurable buckets
- **Automatic Cleanup**: TTL-based purge policies (default: 15 days)
- **Compression**: Configurable compression for large traces
- **PII Scrubbing**: Automatic masking of sensitive fields

---

📊 What Gets Captured
--------------------

[](#-what-gets-captured)

Each trace includes comprehensive information:

```
=== TRACE INFORMATION ===
🆔 Trace ID: abc12345-def6-7890-abcd-ef1234567890
🕒 Timestamp: 2024-01-15 14:30:22
🌍 Environment: production
🔗 Request URL: https://app.example.com/api/users
📊 Response Status: 200
⏱️  Duration: 245ms
💾 Memory Usage: 18.45 KB

=== CAPTURED EVENTS ===
📊 DATABASE EVENTS
  🔍 Query: SELECT * FROM users WHERE active = ? (15ms)
  🔍 Query: SELECT * FROM roles WHERE user_id IN (?, ?) (8ms)

🗄️  CACHE EVENTS
  ❌ Cache MISS: users:list (store: redis)
  💾 Cache WRITE: users:list (store: redis)

🌐 HTTP EVENTS
  📤 HTTP Request: GET https://api.external.com/validation
  📥 HTTP Response: 200 (1,234 bytes)

⚙️  JOB EVENTS
  🔄 Job STARTED: ProcessUserRegistration
  ✅ Job COMPLETED: ProcessUserRegistration

```

---

🔧 Available Commands
--------------------

[](#-available-commands)

### Recording &amp; Analysis Commands

[](#recording--analysis-commands)

- **`chronotrace:record`** – Record real HTTP requests for debugging actual application issues
- **`chronotrace:list`** – List stored traces with metadata and filtering options
- **`chronotrace:replay`** – Replay and analyze captured traces with advanced filtering and output formats
- **`chronotrace:purge`** – Remove old traces based on retention policy

### Setup &amp; Testing Commands

[](#setup--testing-commands)

- **`chronotrace:install`** – Install and configure ChronoTrace middleware
- **`chronotrace:test-internal`** – Test ChronoTrace configuration with internal Laravel operations
- **`chronotrace:test-middleware`** – Test middleware installation and activation
- **`chronotrace:diagnose`** – Diagnose configuration and potential issues with comprehensive checks

### Command Examples

[](#command-examples)

```
# Installation and setup
chronotrace:install --force

# Validate ChronoTrace is working
chronotrace:test-internal --with-db --with-cache

# Record real application traces
chronotrace:record /api/users --method=GET
chronotrace:record /checkout --method=POST --data='{"cart_id": 123}'
chronotrace:record /api/protected --headers='{"Authorization":"Bearer token"}'

# Advanced recording with timeout
chronotrace:record /api/slow-endpoint --timeout=60

# List and analyze traces
chronotrace:list --limit=10 --full-id
chronotrace:replay {trace-id} --db --cache --bindings
chronotrace:replay {trace-id} --detailed --context --headers
chronotrace:replay {trace-id} --generate-test --test-path=tests/Integration

# Output in different formats
chronotrace:replay {trace-id} --format=json
chronotrace:replay {trace-id} --format=raw

# Diagnostics and testing
chronotrace:diagnose
chronotrace:test-middleware

# Test internal operations when chronotrace:record doesn't capture internal events
chronotrace:test-internal --with-db --with-cache --with-events
chronotrace:test-internal --with-db  # Test only database operations

# Maintenance and cleanup
chronotrace:purge --days=7 --confirm
```

---

📊 Use Cases
-----------

[](#-use-cases)

- **Bug Reproduction** – No more “can’t reproduce locally” issues
- **Test Generation** – Build realistic tests from production data
- **Performance Audits** – Find slow queries, N+1s and cache misses
- **Configuration Validation** – Diagnose setup issues with built-in tools
- **Onboarding** – Help new devs understand complex flows via execution graphs

---

🔐 Security &amp; Privacy
------------------------

[](#-security--privacy)

- PII scrubbing by default (configurable fields)
- Trace encryption at rest
- Trace TTL &amp; purge policies
- Audit log of trace access

---

🤝 Contributing
--------------

[](#-contributing)

We welcome contributions! See [CONTRIBUTING.md](CONTRIBUTING.md) for details.

---

📚 Documentation
---------------

[](#-documentation)

Pour une documentation complète et détaillée, consultez notre **[Wiki officiel](https://github.com/Grazulex/laravel-chronotrace/wiki)** :

- **[Installation Guide](https://github.com/Grazulex/laravel-chronotrace/wiki/Installation)** - Guide complet d'installation et de configuration
- **[Configuration](https://github.com/Grazulex/laravel-chronotrace/wiki/Configuration)** - Toutes les options de configuration disponibles
- **[Recording Modes](https://github.com/Grazulex/laravel-chronotrace/wiki/Recording-Modes)** - Modes d'enregistrement et cas d'usage
- **[Commands Reference](https://github.com/Grazulex/laravel-chronotrace/wiki/Commands-Reference)** - Documentation complète de toutes les commandes
- **[Storage Options](https://github.com/Grazulex/laravel-chronotrace/wiki/Storage-Options)** - Configuration du stockage local et S3
- **[Advanced Usage](https://github.com/Grazulex/laravel-chronotrace/wiki/Advanced-Usage)** - Techniques avancées et cas d'usage complexes
- **[Troubleshooting](https://github.com/Grazulex/laravel-chronotrace/wiki/Troubleshooting)** - Solutions aux problèmes courants
- **[API Reference](https://github.com/Grazulex/laravel-chronotrace/wiki/API-Reference)** - Documentation de l'API interne

---

**Laravel ChronoTrace** is open-sourced software licensed under the [MIT license](LICENSE.md).

Made with ❤️ for the Laravel community

###  Health Score

45

—

FairBetter than 91% of packages

Maintenance86

Actively maintained with recent releases

Popularity27

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 82.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~68 days

Total

5

Last Release

68d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/4521546?v=4)[Jean-Marc Strauven](/maintainers/Grazulex)[@Grazulex](https://github.com/Grazulex)

---

Top Contributors

[![Grazulex](https://avatars.githubusercontent.com/u/4521546?v=4)](https://github.com/Grazulex "Grazulex (47 commits)")[![Copilot](https://avatars.githubusercontent.com/in/1143301?v=4)](https://github.com/Copilot "Copilot (10 commits)")

---

Tags

debuglaravelpackagetestingpestlaravelclean codetime trackingproductivityactivity-trackinglaravel12php85php8.3Time Managementphp84chronotracelaravel13

###  Code Quality

TestsPest

Static AnalysisPHPStan, Rector

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/grazulex-laravel-chronotrace/health.svg)

```
[![Health](https://phpackages.com/badges/grazulex-laravel-chronotrace/health.svg)](https://phpackages.com/packages/grazulex-laravel-chronotrace)
```

###  Alternatives

[laravel/horizon

Dashboard and code-driven configuration for Laravel queues.

4.2k95.4M307](/packages/laravel-horizon)[larastan/larastan

Larastan - Discover bugs in your code without running it. A phpstan/phpstan extension for Laravel

6.5k55.4M8.5k](/packages/larastan-larastan)[laravel/cashier

Laravel Cashier provides an expressive, fluent interface to Stripe's subscription billing services.

2.6k29.9M148](/packages/laravel-cashier)[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k15.1M132](/packages/laravel-pulse)[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[laravel/ai

The official AI SDK for Laravel.

1.0k3.2M201](/packages/laravel-ai)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
