akira / laravel-debugger
Advanced debugging toolkit for Laravel 12+ built with PHP 8.4 features.
Fund package maintenance!
kidiatoliny
Installs: 467
Dependents: 9
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/akira/laravel-debugger
Requires
- php: ^8.4
- illuminate/collections: ^12.0
- illuminate/contracts: ^12.0
- illuminate/database: ^12.0
- illuminate/queue: ^12.0
- illuminate/support: ^12.0
- spatie/backtrace: ^1.8
- spatie/ray: ^1.41
- symfony/stopwatch: ^6.0|^7.0|^8.0
- symfony/var-dumper: ^6.0|^7.0|^8.0
- zbateson/mail-mime-parser: ^2.0|^3.0
Requires (Dev)
- guzzlehttp/guzzle: ^7.8
- laravel/framework: ^12.0
- laravel/pint: ^1.16
- orchestra/testbench: ^10.0
- pestphp/pest: ^4.0
- pestphp/pest-plugin-laravel: ^4.0
- phpstan/phpstan: ^1.10|^2.0
- rector/rector: ^0.19|^1.0|^2.0
README
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
- PHP: ^8.4
- Laravel: ^12.0
- Dependencies: See composer.json
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.
