Laravel Custom Debug Watchers Without Telescope | 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)    Laravel Telescope Alternatives: Building a Lightweight Debug Bar with Custom Watchers        On this page       1. [  Why Not Just Use Telescope? ](#why-not-just-use-telescope)
2. [  The Core Idea: Watchers as First-Class Citizens ](#the-core-idea-watchers-as-first-class-citizens)
3. [  Registering Watchers Conditionally ](#registering-watchers-conditionally)
4. [  A Minimal Filament Panel for Visibility ](#a-minimal-filament-panel-for-visibility)
5. [  Pruning Without Bloat ](#pruning-without-bloat)
6. [  Takeaways ](#takeaways)

  ![Laravel Telescope Alternatives: Building a Lightweight Debug Bar with Custom Watchers](https://cdn.msaied.com/500/64b07fa42cce4f91a10adfcbf0c227ae.png)

  #laravel   #debugging   #filament   #performance  

 Laravel Telescope Alternatives: Building a Lightweight Debug Bar with Custom Watchers 
=======================================================================================

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

       Table of contents

1. [  01   Why Not Just Use Telescope?  ](#why-not-just-use-telescope)
2. [  02   The Core Idea: Watchers as First-Class Citizens  ](#the-core-idea-watchers-as-first-class-citizens)
3. [  03   Registering Watchers Conditionally  ](#registering-watchers-conditionally)
4. [  04   A Minimal Filament Panel for Visibility  ](#a-minimal-filament-panel-for-visibility)
5. [  05   Pruning Without Bloat  ](#pruning-without-bloat)
6. [  06   Takeaways  ](#takeaways)

 Why Not Just Use Telescope?
---------------------------

Laravel Telescope is excellent for local development, but enabling it in staging or production introduces real costs: every request writes multiple database rows, storage grows unbounded without aggressive pruning, and the overhead of recording every query, mail, and notification adds latency you cannot always afford.

The alternative is not "log everything to a file." The alternative is a *targeted* debug layer — one you design around the signals you actually care about.

---

The Core Idea: Watchers as First-Class Citizens
-----------------------------------------------

Telescope's own architecture is instructive. Each concern (queries, requests, exceptions) is a discrete `Watcher` class that subscribes to framework events. We can steal that pattern without the storage overhead.

```php
// app/Debug/Contracts/Watcher.php
interface Watcher
{
    public function register(Dispatcher $events): void;
}

```

```php
// app/Debug/Watchers/SlowQueryWatcher.php
final class SlowQueryWatcher implements Watcher
{
    public function __construct(
        private readonly int $thresholdMs = 200
    ) {}

    public function register(Dispatcher $events): void
    {
        $events->listen(QueryExecuted::class, function (QueryExecuted $event): void {
            if ($event->time < $this->thresholdMs) {
                return;
            }

            DebugEntry::create([
                'type'    => 'slow_query',
                'payload' => [
                    'sql'  => $event->sql,
                    'time' => $event->time,
                    'connection' => $event->connectionName,
                ],
                'context' => request()->path(),
            ]);
        });
    }
}

```

The `DebugEntry` model writes to a separate `debug_entries` table with a short TTL enforced by a scheduled `prune` command — not a background queue worker.

---

Registering Watchers Conditionally
----------------------------------

Bind watchers through a dedicated service provider and gate them behind an environment check or a config flag:

```php
// app/Providers/DebugServiceProvider.php
public function boot(): void
{
    if (! config('debug_layer.enabled')) {
        return;
    }

    $watchers = [
        app(SlowQueryWatcher::class),
        app(UnhandledExceptionWatcher::class),
        app(ScheduledJobWatcher::class),
    ];

    foreach ($watchers as $watcher) {
        $watcher->register($this->app['events']);
    }
}

```

Set `debug_layer.enabled` to `true` in staging via an environment variable. In production, flip it on temporarily during an incident and off again — zero deployment required.

---

A Minimal Filament Panel for Visibility
---------------------------------------

Rather than a custom blade view, a dedicated Filament panel gives you sortable tables, filters, and bulk-delete for free.

```php
// app/Filament/Debug/Resources/DebugEntryResource.php
public static function table(Table $table): Table
{
    return $table
        ->columns([
            TextColumn::make('type')->badge(),
            TextColumn::make('context')->limit(40),
            TextColumn::make('payload.time')
                ->label('Duration (ms)')
                ->sortable(),
            TextColumn::make('created_at')->since(),
        ])
        ->filters([
            SelectFilter::make('type')
                ->options(DebugEntry::distinct('type')->pluck('type', 'type')),
        ])
        ->defaultSort('created_at', 'desc')
        ->poll('10s');
}

```

Mount this panel on a path guarded by an `auth` middleware that checks for a `debug` role. The 10-second poll gives you near-real-time visibility without WebSockets.

---

Pruning Without Bloat
---------------------

```php
// routes/console.php
Schedule::command('model:prune', ['--model' => DebugEntry::class])
    ->hourly();

```

Add `MassPrunable` to `DebugEntry` and define a `prunable` scope that deletes entries older than 24 hours. The table stays small; the signal stays fresh.

---

Takeaways
---------

- **Watcher interface** keeps each concern isolated and independently testable.
- **Config-gated registration** means zero overhead when the layer is off.
- **Threshold filtering** (e.g., only queries &gt; 200 ms) prevents noise and write amplification.
- **Filament panel** provides a production-grade UI without custom frontend work.
- **Scheduled pruning** with `MassPrunable` keeps storage bounded automatically.
- This pattern composes: add a `CacheHitRatioWatcher` or `HttpOutboundWatcher` without touching existing code.

 Found this useful?

          [  ](https://twitter.com/intent/tweet?url=https%3A%2F%2Fmsaied.com%2Farticles%2Flaravel-telescope-alternatives-building-a-lightweight-debug-bar-with-custom-watchers-1&text=Laravel+Telescope+Alternatives%3A+Building+a+Lightweight+Debug+Bar+with+Custom+Watchers) [  ](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fmsaied.com%2Farticles%2Flaravel-telescope-alternatives-building-a-lightweight-debug-bar-with-custom-watchers-1) 

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

  3 questions  

     Q01  Is this approach safe to enable in production?        Yes, with two guards in place: a config flag so you can toggle it without a deployment, and threshold filtering so only anomalous events (slow queries, exceptions) are recorded. Write volume stays low and the prune schedule keeps the table bounded. 

      Q02  How does this differ from simply logging to a file?        Structured database rows give you filterable, sortable, queryable entries. A log file gives you append-only text. The Filament panel turns those rows into an interactive UI with zero custom frontend code. 

      Q03  Can I add a watcher for outbound HTTP calls?        Yes. Laravel fires no built-in event for HTTP client calls, but you can register a global middleware on the HTTP client via Http::globalMiddleware() using a Guzzle handler that records slow or failed requests to DebugEntry. 

  Continue reading

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

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

 [ ![PhpStorm 2026.2 Released: Laravel Tool Window, PHP 8.5 Pipe Operator, and AI Agents](https://cdn.msaied.com/505/151a0bba66cc27064e090e69e55d7c92.png) PhpStorm JetBrains PHP 8.5 

### PhpStorm 2026.2 Released: Laravel Tool Window, PHP 8.5 Pipe Operator, and AI Agents

PhpStorm 2026.2 ships a dedicated Laravel tool window with Artisan, error logs, and Laravel Cloud tabs, plus P...

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

 3 Aug 2026     3 min read  

  Read    

 ](https://msaied.com/articles/phpstorm-20262-released-laravel-tool-window-php-85-pipe-operator-and-ai-agents) [ ![Laravel Doctor: Diagnose Your Laravel App With One Artisan Command](https://cdn.msaied.com/504/d72224689abc7b396bce187535008272.png) Laravel Artisan Health Checks 

### Laravel Doctor: Diagnose Your Laravel App With One Artisan Command

Laravel Doctor is a first-party package announced at Laracon US 2026 that adds an `artisan doctor` command to...

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

 3 Aug 2026     4 min read  

  Read    

 ](https://msaied.com/articles/laravel-doctor-diagnose-your-laravel-app-with-one-artisan-command) [ ![Livewire v4.3.5 Released: Fix for SFC Detection with PHP Attribute Array Arguments](https://cdn.msaied.com/503/9678ed8dbf5d7a6f4f19ca7694cf241b.png) Livewire Laravel PHP 

### Livewire v4.3.5 Released: Fix for SFC Detection with PHP Attribute Array Arguments

Livewire v4.3.5 ships a targeted bug fix for Single File Component (SFC) detection when PHP attributes contain...

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

 3 Aug 2026     2 min read  

  Read    

 ](https://msaied.com/articles/livewire-v435-released-fix-for-sfc-detection-with-php-attribute-array-arguments) 

   [  ![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)
