Core Diagnostics & Profilers Reference Manual β
Laravel Agent-Debugger v3.1.1 provides 13 interactive dashboard tabs and 29 premium server-driven diagnostic profilers designed to catch errors, identify optimization opportunities, and simplify local development β with zero external JS/CSS dependencies and fully offline capabilities.
π Interactive Dashboard Tabs β
The debugger interface provides 13 unified tabs to monitor application state changes dynamically:
1. π Execution Log β
- Description: Display of active request execution records, actor details, runtime timings, HTTP headers, request variables, and exception stack traces.
- Telemetry Captured: HTTP Method, URL, Referer, Client IP, Authenticated User details, Status Code, and Execution Duration.
- Usage: The default entry point when analyzing any HTTP request or API call.
2. ποΈ Database Queries β
- Description: Display of all executed SQL statements with caller traces (class/file line), N+1 loop flags, duplicate markers, index advisory tips, and one-click
π¬ Explainplan mapping. - Telemetry Captured: Raw SQL, bound parameters, execution duration in milliseconds, and the originating PHP file path and line number.
- Usage: Essential for diagnosing slow queries, N+1 query loops, or verifying transaction rollbacks.
3. β±οΈ Timeline Waterfall β
- Description: Proportional Gantt chart sequencing App Boot, database query segments, outgoing HTTP requests, and manual milestone timings (
debug_span()). - Telemetry Captured: Proportional segment offsets and durations relative to the overall request execution lifecycle.
- Usage: Instantly exposes what percentage of total request latency is spent on database operations vs. application logic.
4. π’ Events & Jobs β
- Description: Real-time logging of dispatched events, queued background job signatures, and serialized data payloads.
- Telemetry Captured: Event class name, listener classes, queued job class, target queue, and serialized parameters.
- Usage: Verifies background event dispatch chains and asynchronous job scheduling.
5. πΊοΈ Blade Views β
- Description: Dynamic view composition hierarchy flowchart mapping layout, component, and template renderings.
- Telemetry Captured: Rendered view paths, layouts, blade components, and compiled file paths.
- Usage: Simplifies UI debugging in deeply nested template layouts.
6. π¦ Inertia Properties β
- Description: Interactive JSON tree viewer showing the exact
propspayloads passed to Inertia.js views. - Telemetry Captured: Complete props collection variables, including model attributes and computed variables.
- Usage: Prevents print-debugging massive arrays in Vue or React components.
7. π Livewire Properties β
- Description: Complete telemetry list of Livewire component fingerprints, updates, serverMemo state, and execution parameters.
- Telemetry Captured: Livewire update payloads, state updates, validation errors, and method calls.
- Usage: Solves state syncing issues in Livewire components during form submissions.
8. ποΈ Cache Monitor β
- Description: Live breakdown of cache hits, misses, writes, and forgetting keys, along with data sizes and TTL details.
- Telemetry Captured: Cache operations (
get,set,forget), keys, byte sizes, and remaining expiration. - Usage: Audits application cache usage efficiency.
9. π Eloquent Events β
- Description: Active monitoring card listing observer calls (
creating,created,updating,updated,deleting,deleted) on models. - Telemetry Captured: Eloquent model name, primary key, and active database event name.
- Usage: Traces side-effects triggered by model observers or listeners.
10. π§ Outgoing Mail β
- Description: Renders exact HTML/Markdown preview blocks of outgoing Mailables sandbox.
- Telemetry Captured: Email sender, recipient, subject, headers, and full HTML/text body contents.
- Usage: Intercepts Mailables locally without requiring third-party mail sandboxes.
11. π Memory Allocations β
- Description: Stacked-bar flame-graph displaying dynamic PHP heap allocations (Boot, Eloquent, HTTP, GC).
- Telemetry Captured: Proportional peak memory consumed during application boot, DB execution, and output rendering.
- Usage: Identifies memory leaks and heavy model instances.
12. π Outgoing API Mocks β
- Description: Visual rule builder allowing developers to map endpoint stubs to Guzzle/HTTP Client mocks (
Http::fake()). - Telemetry Captured: URL patterns, JSON response templates, HTTP status codes, and mock validation status.
- Usage: Mocks external payment gateways or third-party APIs during local sandbox testing.
13. π§ͺ PHPUnit Runner β
- Description: Interactive dark terminal console showing execution progress and exit statuses of local PHPUnit suites.
- Telemetry Captured: Live stream of PHPUnit progress characters, assertion counts, failures, and final exit status.
- Usage: Run your project's test suite directly from the browser window.
Phase A: Core Diagnostics β
1. Zero-JS Floating Viewport Status Badge π΄ β
- Description: A server-side HTML/CSS injection that renders a glassmorphic floating status badge in the bottom-right corner of HTML responses. Shows real-time execution duration, memory usage, and active query count at a glance.
- Under the Hood:
ViewportBorderInjectormiddleware intercepts the final HTTP response. If the response header istext/htmland is not an AJAX/Inertia/Livewire request, it injects custom CSS styling and a small HTML container right before</body>. - Log Output Reference:html
<div id="agent-debug-badge" style="position: fixed; bottom: 16px; right: 16px; backdrop-filter: blur(8px)..."> Duration: 114ms | Memory: 14.2MB | Queries: 6 </div>
2. User Navigation Breadcrumbs π§ β
- Description: Tracks the user's session navigation history β last 10 visited URLs, HTTP methods, and status codes β to reconstruct what path led to an error.
- Under the Hood:
SessionBreadcrumbsreads and writes to a specific session array keyagent_debugger_breadcrumbs. On every incoming request, it appends the current request metadata and truncates the array if it exceeds the configuration limit. - Log Output Reference:text
- SESSION BREADCRUMB TRAIL: 1. [GET 200] /student/dashboard 2. [GET 200] /student/tests/4/instructions 3. [POST 500] /student/tests/4/submit (CRASHED)
3. Caught Exceptions Tracker πͺ β
- Description: Intercepts exceptions that are caught and silently handled (or redirected) inside
try-catchblocks, preventing silent bugs from vanishing. - Under the Hood: Subscribes to Laravel's global log listener channel. When an exception is logged via
Log::error()orreport(), it extracts the exception class, stack trace, and message, saving them to the current request container. - Log Output Reference:text
Class: Illuminate\Database\Eloquent\ModelNotFoundException Message: No query results for model [App\Models\Book] #42 File: BookController.php | Line: 74
4. Database Transaction Auditor π³ β
- Description: Logs
beginTransaction,commit, androllBackevents inline within the SQL query sequence, pointing to exact file/line triggers. - Under the Hood: Listens to database transaction events (
TransactionBeginning,TransactionCommitted,TransactionRolledBack) and logs the actions alongside the originating backtrace caller. - Log Output Reference:text
* [0.00ms] DB::beginTransaction() * [1.02ms] select * from `users` where `id` = 14 limit 1 * [0.00ms] DB::rollBack() (Triggered on BookController@save line 102)
5. N+1 Query Loop Detector β οΈ β
- Description: Parameterizes SQL queries into templates. If any template repeats more than 5 times in a single request, it logs an explicit warning block with eager-loading solutions.
- Under the Hood:
QueryProfilernormalizes SQL strings by replacing bound parameters with placeholders (?), counting the occurrences of each unique query signature. - Log Output Reference:text
β οΈ WARNING: N+1 Query Detected! The following query executed 12 times: * select * from `questions` where `id` = ? limit 1 π Solution: Eager load relationships (e.g. TestAttempt::with('questions')) in your controller.
6. Config & Env Drift Detector π β
- Description: Hashes monitored
.envkeys at the start of a request. If the hash mismatches the previous request's signature, it logs a config drift warning. - Under the Hood:
EnvironmentTrackercomputes a SHA-256 checksum of specified.envkeys (e.g.SESSION_DRIVER,DB_CONNECTION), caches it, and performs comparisons on subsequent requests. - Log Output Reference:text
β οΈ WARNING: LOCAL ENVIRONMENT CONFIGURATION DRIFT DETECTED! - SESSION_DRIVER changed from 'file' to 'redis' - QUEUE_CONNECTION changed from 'sync' to 'database'
7. Compiled Blade Exception Resolver ποΈ β
- Description: Resolves compiled Blade view exception paths (e.g.
/storage/framework/views/2fa8d7.php) back to their original.blade.phpfile path and template line number. - Under the Hood:
ExceptionProfilerinterceptsViewExceptionerrors, inspects the error callstack, and uses standard regular expressions to parse the compiled temporary files, matching them to original templates. - Log Output Reference:text
CRITICAL BLADE COMPILER ERROR: File: /resources/views/components/book-card.blade.php | Line: 12 Original Line: <p>{{ $book->author->getShortName() }}</p> Error: Call to a member function getShortName() on null (Authored in controller context)
8. Gate & Policy Authorization Profiler π‘οΈ β
- Description: Subscribes to evaluation hooks to capture every authorization check, its arguments, and the result.
- Under the Hood: Subscribes to the
Gate::after()callback container to capture the name of the gate, target model instance, and boolean response. - Log Output Reference:text
* [ALLOWED] view-test (Arguments: App\Models\Test #4) * [DENIED] update-test (Arguments: App\Models\Test #4)
9. Custom Session State Logger πΎ β
- Description: Reads all session variables, strips standard Laravel internal tokens, and exposes custom developer session states.
- Under the Hood:
SessionStateProfilerextractsSession::all(), filters keys matching framework defaults (such as_token,_previous,_flash), and appends the rest to the request footprint. - Log Output Reference:text
- ACTIVE SESSION STATE: * test_attempt_id => 82 * active_step => 5
10. Rich Actor Identification π€ β
- Description: Resolves the authenticated user ID and displays a configured profile field (like email or name) for instant user context.
- Under the Hood:
DebugActivityLoggerqueries the activeAuth::user()model and reads attributes specified in the configuration array'auth_identifiers'. - Log Output Reference:text
Auth: User #14 (student: john@example.com)
Phase B: Database & Query Intelligence β
11. Visual SQL EXPLAIN Query Analyzer π¬ β
- Description: Runs
EXPLAINon database queries and visualizes the database executor strategy directly inside the Queries tab. - Under the Hood: Fiers an AJAX request containing the select statement to the
/_agent_debug/explainendpoint, prependingEXPLAINto the query, running it, and formatting the plans. - Usage: Click the
π¬ Explainbutton next to any database query record inside the dashboard to view detailed table lookup and index usage plans.
12. Duplicate & Redundant Query Detector π₯ β
- Description: Identifies identical queries executed multiple times in the same request, recommending caching solutions.
- Under the Hood: Hashes SQL strings together with their parameter bindings. If a query hash repeats, it is flagged as a duplicate.
- Usage: Highlighted with a warning badge directly under the Database tab with direct remedies.
13. Interactive SQL Playground π β
- Description: A secure, browser-based SQL select playground inside the dashboard.
- Under the Hood: Fiers SQL statement inputs to
/_agent_debug/playground, parses database connections, and executes requests in a read-only transaction, rolling back automatically. - Usage: Type queries directly into the Database queries tab playground or click "Send to Playground" next to any logged query to run it manually.
14. SQL Database Index Advisor πΎ β
- Description: Heuristically scans
WHERE,JOIN, andORDER BYquery columns to suggest missing indexes. - Under the Hood:
QueryAnalyzerevaluates table schemas and columns used in lookups. If a column has no index, it generates copy-pasteable Artisan migrations. - Log Output Reference:text
π‘ DATABASE INDEX RECOMMENDATION: * Table: 'orders' | Column: 'user_id' π Solution: Schema::table('orders', fn($t) => $t->index('user_id'));
Phase C: Async & Side-Effect Telemetry β
15. Queue Job & Event Payload Serializer π§ β
- Description: Records dispatched events and queued job payloads to trace asynchronous actions.
- Under the Hood:
EventJobProfilerhooks into event dispatcher channels and queue payload workers, extracting class names and parameters. - Usage: Rendered inside the dedicated Events & Jobs dashboard tab.
16. Outgoing Mail Sandbox π§ β
- Description: Intercepts Mailables, saves copies as HTML to disk, and displays previews on the dashboard.
- Under the Hood:
MailProfilerintercepts theMessageSendingevent, extracts message contents, writes HTML files tostorage/logs/agent-debugger/emails, and indexes them. - Usage: View exact email outputs inside the Outgoing Mail dashboard tab.
17. Cache Hit/Miss Monitor ποΈ β
- Description: Logs cache actions (gets, writes, forgets) alongside key configurations, data sizes, and TTL.
- Under the Hood:
CacheProfilerlistens to framework cache event hooks (CacheHit,KeyWritten,KeyForgotten). - Usage: Appears under the Cache Monitor tab of request details.
18. Eloquent Model Lifecycle Tracker π β
- Description: Tracks observers firing database operations (
creating,created, etc.). - Under the Hood:
EloquentProfilerregisters observer hooks across Eloquent lifecycles, logging primary keys and class names. - Usage: Appears under the Eloquent Events tab.
Phase D: Visual Profiling & Timelines β
19. DevTools-Style Timeline Waterfall β±οΈ β
- Description: Proportional Gantt chart visualizing execution segments (Boot, SQL, Outgoing requests).
- Under the Hood: Collects microtime offsets of all tracked events and builds a timeline dataset.
- Usage: Displays at the top of the request review page.
20. Interactive Blade Template Composition Tree πΊοΈ β
- Description: Draws layouts, components, and views flowchart per request.
- Under the Hood:
ViewProfilerhooks into view composings, compiling nesting layouts and rendering orders. - Usage: Displays inside the Blade Views tab.
21. Live PHP Memory Allocation Flame-Graph π β
- Description: Segmented stacked memory visualizer updating live.
- Under the Hood: Samples memory changes at Boot, DB queries, and Response compilation steps.
- Usage: Renders a clean flame-graph inside the Memory Allocations tab.
22. Outgoing Latency Radar π β
- Description: Calculates ratios of database lookups vs. app core timings.
- Under the Hood: Sums execution milliseconds of all query items and compares it to overall request time.
- Usage: Displayed as progress indicators in request logs.
Phase E: Environment, Security & DevOps β
23. Livewire Hydration State Tracker π β
- Description: Captures Livewire request parameters and saves state JSON copies.
- Under the Hood: Intercepts Livewire endpoints and dumps payload state variables.
- Usage: Displayed under the Livewire Properties tab.
24. Dev Environment Configuration Shield π¨ β
- Description: TCP socket auditor warning when local dev services are offline.
- Under the Hood:
SystemAuditorchecks connection ports (e.g. 6379 for Redis, 1025 for Mailpit) on app startup. - Usage: Glowing alert header banners appear in the dashboard if services fail checks.
25. Cookie & CSRF Token Debugger πͺ β
- Description: Explains form submission failures resulting in 419 errors.
- Under the Hood: Matches CSRF headers against session tokens, logging failures.
- Usage: Compiles analysis reports inside form request error blocks.
26. Interactive .env vs .env.example Diff Audit βοΈ β
- Description: Color-coded side-by-side comparison of local environment configs.
- Under the Hood:
SystemAuditorparses files, maps keys, and highlights drifts. - Usage: Displayed under the Configuration drift section.
27. Category Tag Filtering π·οΈ β
- Description: Filters requests using appended
?_debug_tag=xquery parameters. - Under the Hood: Scopes session log files matching specified category hashes.
- Usage: Scope request records easily in the dashboard sidebar.
28. Composer Security Dependency Auditor π©Ή β
- Description: Scans vendor packages for security issues using advisory databases.
- Under the Hood: Parses
composer.lockand matches against CVE index records. - Usage: Warnings are shown in the configuration dashboard.
29. Git Branch Code Correlation Analyzer π β
- Description: Connects active request exceptions with local git uncommitted drift.
- Under the Hood: Identifies modified files and matches them to request callstacks.
- Usage: Git status labels appear in the header of execution records.
Dashboard Tools β
30. Real-time SSE Log Streaming πΏ β
- Description: Updates the dashboard feeds in real-time with zero polling overhead.
- Under the Hood: SSE streams logs via the
/_agent_debug/sseroute.
31. Outgoing API Mock Interceptor π β
- Description: Persists and intercepts HTTP Client requests.
- Under the Hood: Loads mock rules from
mocks.jsonand registers them viaHttp::fake().
32. Browser-Based PHPUnit Test Runner π§ͺ β
- Description: Streams test runner output directly to the browser.
- Under the Hood: Executes PHPUnit in a background process and streams output.
33. Artisan Quick-Console π οΈ β
- Description: Clear caches and clean log directories with header shortcuts.
- Under the Hood: Proxies actions to Laravel's Artisan console backend.