akira/laravel-debugger

Advanced debugging toolkit for Laravel 12+ built with PHP 8.4 features.

Fund package maintenance!
kidiatoliny

Installs: 462

Dependents: 9

Suggesters: 0

Security: 0

Stars: 1

Watchers: 1

Forks: 0

Open Issues: 0

pkg:composer/akira/laravel-debugger

v1.3.1 2025-11-27 17:50 UTC

This package is auto-updated.

Last update: 2025-11-27 17:52:39 UTC


README

img.png

Latest Version on Packagist Total Downloads

Advanced debugging toolkit for Laravel 12+ built with PHP 8.4 features.

Akira Debugger is a modern, strictly-typed debugging package designed specifically for Laravel 12+ applications. Built from the ground up with PHP 8.4's latest features including strict types, readonly properties, and modern attributes.

Requirements

Features

  • Laravel 12+ exclusive - Built for the latest framework features
  • PHP 8.4 strict typing - Full type safety throughout
  • Query debugging - Monitor SQL queries, detect N+1, slow queries
  • Mail debugging - Inspect sent emails and mailables
  • Event tracking - Watch Laravel events as they fire
  • Job monitoring - Track queued jobs and their execution
  • HTTP debugging - Log HTTP client requests and responses
  • Cache monitoring - Track cache hits, misses, and operations
  • View debugging - Inspect rendered views and their data
  • Exception tracking - Catch and log exceptions with full context

Installation

Install the package via Composer:

composer require akira/laravel-debugger --dev

The package will automatically register its service provider.

Publish Configuration (Optional)

php artisan vendor:publish --tag=debugger-config

This creates config/debugger.php where you can customize watchers and behavior.

Quick Start

Basic Debugging

The simplest way to debug with ad():

// Debug a variable
ad($user);

// Debug with label
ad('Current User', $user);

// Debug and stop execution
debugAndDie($user);

// Debug multiple values
ad($user, $orders, $settings);

Learn more in Basic Usage.

Usage

Query Debugging

Monitor database queries in real-time:

// Enable query logging
ad()->showQueries();

// Find slow queries (threshold in milliseconds)
ad()->slowQueries(100);

// Detect duplicate queries
ad()->showDuplicateQueries();

// Detect N+1 query problems
ad()->showConditionalQueries(function ($query) {
    return $query->toSql();
});

Learn more in Query Debugging.

Event Monitoring

Track Laravel events as they fire:

// Watch all events
ad()->showEvents();

// Get events info
ad()->events();

See Event Debugging for details.

Job Debugging

Monitor queued jobs and their execution:

// Monitor all job execution
ad()->showJobs();

// Get jobs info
ad()->jobs();

Read Job Debugging for advanced usage.

Mail Debugging

Inspect sent emails without sending:

// Log all sent emails
ad()->showMails();

// Debug a mailable
ad()->mailable(new OrderConfirmation($order));

Details in Mail Debugging.

HTTP Debugging

Monitor HTTP client requests and responses:

// Track all HTTP requests
ad()->showHttpClientRequests();

// HTTP requests are automatically logged
$response = Http::get('https://api.example.com/users');

Learn more in HTTP Debugging.

Cache Monitoring

Track cache operations:

// Monitor cache hits and misses
ad()->showCache();

See Cache Debugging.

View Debugging

Inspect rendered views and their data:

// Watch view rendering
ad()->showViews();

Read View Debugging.

Commands

# Clear debugger data
php artisan debugger:clean

Configuration

The config/debugger.php file allows you to:

  • Enable/disable specific watchers
  • Configure query thresholds
  • Set up filters
  • Customize output formats

Example configuration:

return [
    'enable' => env('DEBUGGER_ENABLED', env('APP_DEBUG', false)),
    
    'watchers' => [
        'queries' => true,
        'mails' => true,
        'events' => true,
        'jobs' => true,
        'cache' => true,
        'http' => true,
        'views' => true,
        'exceptions' => true,
    ],
    
    'query_threshold' => 100, // ms
    
    'ignored_events' => [
        // Events to ignore
    ],
];

Testing

Run the test suite:

composer test

Run tests with coverage:

composer test -- --coverage

Code Quality

Format Code (Pint)

composer format

Static Analysis (Larastan)

composer analyse

Refactor (Rector)

composer refactor

Development

This package follows strict coding standards:

  • PSR-12 via Laravel Pint
  • Level Max static analysis via Larastan
  • PHP 8.4+ features throughout
  • 100% type coverage with strict types
  • Pest for testing

Changelog

Please see CHANGELOG for more information on what has changed recently.

Credits

Built with inspiration from Spatie's Laravel Ray, reimagined for modern Laravel and PHP.

License

The MIT License (MIT). Please see License File for more information.