Search by

grazulex / laravel-devtoolbox

Grazulex

Swiss-army artisan CLI for Laravel โ€” Scan, inspect, debug, and explore every aspect of your Laravel application from the command line.

v1.7.0 2026-09-17 19:20 UTC

This package is auto-updated.

Last update: 2026-09-18 16:13:34 UTC


README

Laravel Devtoolbox

Tip

What Laravel Devtoolbox does for you โ€” One artisan toolbox to scan, inspect and debug your Laravel app: unused routes, model relationships, container bindings, env drift, SQL traces โ€” plus an MCP server so your AI coding agent can use the same tools.

This package is free and maintained on my own time. If it saves you hours, a small contribution helps me keep it going: ๐Ÿ’– GitHub Sponsors ยท โ˜• Buy Me a Coffee ยท PayPal

Swiss-army artisan CLI for Laravel โ€” Scan, inspect, debug, and explore every aspect of your Laravel application from the command line.

Latest Version Total Downloads License PHP Version Laravel Version Tests Code Style

โœจ Features

Laravel Devtoolbox provides comprehensive analysis tools for Laravel applications:

  • ๐Ÿ”Ž Deep Application Scanning - Complete analysis of models, routes, services, and more
  • ๐Ÿง  Model Introspection - Analyze Eloquent models, relationships, and usage patterns
  • ๐Ÿ›ฃ๏ธ Route Analysis - Inspect routes, detect unused ones, and analyze middleware
  • ๐Ÿ“ฆ Service Container Analysis - Examine bindings, singletons, and providers
  • โš™๏ธ Environment Auditing - Compare configuration files and detect inconsistencies
  • ๐Ÿ”„ SQL Query Tracing - Monitor and analyze database queries for specific routes
  • ๐Ÿ“Š Multiple Export Formats - JSON, Markdown, Mermaid diagrams, and more
  • ๐Ÿ›  Developer Experience - Rich console output with actionable insights
  • ๐Ÿค– MCP Server - Expose every scanner as a tool for AI coding agents (optional, via laravel/mcp)

๐Ÿ“ฆ Installation

Install via Composer as a development dependency:

composer require --dev grazulex/laravel-devtoolbox

Requirements:

  • PHP 8.3+
  • Laravel 12.0+ | 13.0+

๐Ÿš€ Quick Start

# See all available commands
php artisan list dev:

# Enhanced application overview (new!)
php artisan dev:about+ --extended --performance

# Quick health check of your application
php artisan dev:scan --all

# Find where a model is used
php artisan dev:model:where-used App\Models\User

# Detect unused routes
php artisan dev:routes:unused

# Find routes by controller (reverse lookup - new!)
php artisan dev:routes:where UserController

# Generate model relationship diagram
php artisan dev:model:graph --format=mermaid --output=models.mmd

# Trace SQL queries for a route
php artisan dev:sql:trace --route=dashboard

# Analyze SQL queries for N+1 problems (new!)
php artisan dev:sql:duplicates --route=users.index --threshold=3

# Monitor logs in real-time (new!)
php artisan dev:log:tail --follow --level=error

# Compare environment files
php artisan dev:env:diff --against=.env.example

# Analyze database column usage
php artisan dev:db:column-usage --unused-only

# Security scan for unprotected routes
php artisan dev:security:unprotected-routes --critical-only

# Analyze container bindings (new!)
php artisan dev:container:bindings --show-resolved

# Service provider performance analysis (new!)
php artisan dev:providers:timeline --slow-threshold=100

# Performance monitoring (new!)
php artisan dev:performance:memory --route=dashboard
php artisan dev:performance:slow-queries --threshold=1000
php artisan dev:cache:analysis --drivers=redis,file
php artisan dev:queue:analysis --failed-jobs --slow-jobs

๐Ÿ” Available Commands

General Scanning & Analysis

  • dev:scan - Comprehensive application analysis with multiple scanner types
  • dev:about+ - Enhanced version of Laravel's about command with extended information

Model Analysis

  • dev:models - List and analyze all Eloquent models
  • dev:model:where-used - Find where specific models are used
  • dev:model:graph - Generate model relationship diagrams

Route Analysis

  • dev:routes - Inspect application routes
  • dev:routes:unused - Detect potentially unused routes
  • dev:routes:where - Find routes by controller/method (reverse lookup)

Database Analysis

  • dev:db:column-usage - Analyze database column usage across the Laravel application codebase
  • dev:sql:trace - Trace SQL queries for specific routes
  • dev:sql:duplicates - Analyze SQL queries for N+1 problems, duplicates, and performance issues

Security Analysis

  • dev:security:unprotected-routes - Scan for routes that are not protected by authentication middleware

Service & Container Analysis

  • dev:services - Examine service container bindings
  • dev:container:bindings - Analyze container bindings, singletons, and dependency injection mappings
  • dev:providers:timeline - Analyze service provider boot timeline and performance
  • dev:commands - List and analyze artisan commands

Middleware Analysis

  • dev:middleware - Analyze middleware classes and usage
  • dev:middlewares:where-used - Find where specific middleware is used

View Analysis

  • dev:views - Scan Blade templates and views

Environment & Logging

  • dev:env:diff - Compare environment configuration files
  • dev:log:tail - Monitor Laravel logs with real-time filtering and pattern matching

Performance Analysis (new!)

  • dev:performance:memory - Analyze memory usage patterns and performance
  • dev:performance:slow-queries - Detect and analyze slow database queries
  • dev:cache:analysis - Analyze cache performance and configuration
  • dev:queue:analysis - Analyze queue performance, failed jobs, and job patterns

๐Ÿค– MCP Server (AI agents)

Laravel Devtoolbox can run as a local MCP server, exposing every scanner listed above as a typed tool that AI coding agents (Claude Code, Cursor, etc.) can call directly, without shelling out to Artisan and parsing text output.

Installation

The server is built on laravel/mcp, an optional dependency โ€” the package works exactly as before if it isn't installed:

composer require laravel/mcp --dev

Installing laravel/mcp requires laravel/framework 12.41.1 or later (or 13.x); on an older 12.x release, update the framework first.

Registration

Register the server with Claude Code:

claude mcp add devtoolbox php artisan mcp:start devtoolbox

Or point any MCP-compatible client at it with a generic .mcp.json:

{
  "mcpServers": {
    "devtoolbox": { "command": "php", "args": ["artisan", "mcp:start", "devtoolbox"] }
  }
}

Available tools

Each scanner is exposed as devtoolbox-<name>. Most tools only read application metadata (routes, models, config, source); the three marked (active) actually execute code โ€” internal HTTP requests or real queries โ€” while scanning:

  • devtoolbox-models - Scan Laravel Eloquent models and their relationships
  • devtoolbox-routes - Scan Laravel routes and analyze their usage
  • devtoolbox-route-where-lookup - Find routes that use a specific controller or method
  • devtoolbox-container-bindings - Analyze container bindings, singletons, and dependency injection mappings
  • devtoolbox-middleware-usage - Analyze middleware usage across routes, controllers, and groups
  • devtoolbox-sql-analysis (active) - Analyze SQL queries for N+1 problems, duplicates, and performance issues
  • devtoolbox-provider-timeline - Analyze service provider boot timeline and performance
  • devtoolbox-commands - Scan Laravel Artisan commands
  • devtoolbox-services - Scan Laravel service container bindings
  • devtoolbox-middleware - Scan Laravel middleware and their usage
  • devtoolbox-views - Scan Laravel views and detect unused ones
  • devtoolbox-model-usage - Scan for usage of a specific model throughout the application
  • devtoolbox-sql-trace (active) - Trace SQL queries executed during route or URL execution
  • devtoolbox-security - Scan for security vulnerabilities and unprotected routes
  • devtoolbox-db-column-usage - Analyze database column usage across the application codebase
  • devtoolbox-performance (active) - Analyze memory usage, query performance, and cache efficiency

Environment guard

The server only registers itself in local and testing by default โ€” it is never exposed in staging or production. This is controlled by config/devtoolbox.php:

'mcp' => [
    'enabled' => env('DEVTOOLBOX_MCP_ENABLED', true),
    'environments' => ['local', 'testing'],
    'max_response_bytes' => 262_144,
],
  • devtoolbox.mcp.environments โ€” the list of app()->environment() values allowed to register the server.
  • DEVTOOLBOX_MCP_ENABLED โ€” a hard off switch, checked in addition to the environment list.

Response truncation

Large scan results are capped at devtoolbox.mcp.max_response_bytes (262 KB by default) so they stay usable in an agent's context window. When a result is truncated, the response includes a _truncated key with the original item count, how many were kept, and a hint on which options to pass to narrow the scan.

Laravel Boost

Devtoolbox ships Laravel Boost guidelines and a devtoolbox-analysis skill describing when to reach for each MCP tool (unprotected/unused routes, N+1 queries, model impact, slow providers, and more). Both are installed automatically by:

php artisan boost:install

๐Ÿ“Š Export Formats

All commands support multiple output formats:

Format Usage Best For
Array/Table --format=array (default) Interactive development
JSON --format=json Automation, CI/CD
Count --format=count Quick metrics
Mermaid --format=mermaid Documentation, diagrams

Save to Files

# Export to JSON
php artisan dev:models --format=json --output=models.json

# Generate Mermaid diagram
php artisan dev:model:graph --format=mermaid --output=relationships.mmd

# Save comprehensive scan
php artisan dev:scan --all --format=json --output=app-analysis.json

๐Ÿ›  Configuration

Publish the configuration file to customize behavior:

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

This creates config/devtoolbox.php where you can customize:

  • Default output formats
  • Scanner-specific options
  • Performance settings
  • Export configurations

๐Ÿ“š Documentation

Comprehensive documentation and examples are available in our GitHub Wiki:

๐Ÿ”ง Examples & Automation

Daily Development Workflow

# Check application health
php artisan dev:scan --all --format=count

# Find cleanup opportunities
php artisan dev:routes:unused
php artisan dev:env:diff

CI/CD Integration

# Quality gates in CI
UNUSED_ROUTES=$(php artisan dev:routes:unused --format=count | jq '.count')
if [ $UNUSED_ROUTES -gt 10 ]; then
  echo "Too many unused routes: $UNUSED_ROUTES"
  exit 1
fi

Documentation Generation

# Generate project documentation
php artisan dev:models --format=json --output=docs/models.json
php artisan dev:model:graph --format=mermaid --output=docs/relationships.mmd
php artisan dev:routes --format=json --output=docs/routes.json

For complete automation scripts and CI/CD configurations, visit our Wiki Examples.

๐Ÿ” Use Cases

  • ๐Ÿ” Code Reviews - Generate comprehensive application overviews
  • ๐Ÿ“Š Performance Analysis - Identify slow queries and bottlenecks
  • ๐Ÿงน Technical Debt - Find unused routes, orphaned models, and inconsistencies
  • ๐Ÿ“– Documentation - Auto-generate up-to-date application structure docs
  • โšก CI/CD Quality Gates - Automated quality checks and thresholds
  • ๐ŸŽฏ Onboarding - Help new team members understand application structure

๐Ÿ†• Version Compatibility

Laravel Devtoolbox PHP Version Laravel Version Status
1.6+ 8.3+ 12.x | 13.x โœ… Active
1.0 - 1.5 8.3+ 11.x | 12.x โš ๏ธ Maintenance only

Note: Since v1.6.0 this package supports Laravel 12 and Laravel 13. Laravel 11 (end of life) is no longer supported; use v1.5.x if you are still on Laravel 11.

๐Ÿค Contributing

We welcome contributions! Please see our Contributing Guide for details.

๐Ÿ“„ License

Laravel Devtoolbox is open-sourced software licensed under the MIT license.

Made with โค๏ธ for the Laravel community

Report Issues โ€ข Discussions โ€ข Wiki

๐Ÿ’ผ Need Expert Laravel Help?

Laravel DevToolbox is maintained by Jean-Marc Strauven, creator of 17+ Laravel packages with 6,000+ downloads.

๐ŸŽฏ Available for:

๐Ÿ—๏ธ Custom Laravel Development Build your application from scratch or extend existing systems with clean, maintainable code.

๐Ÿ” Code Audits & Architecture Review Deep analysis of your Laravel projects with detailed recommendations and refactoring roadmap.

  • Complete codebase analysis
  • Architecture documentation
  • Performance bottleneck identification
  • Security audit
  • Duration: 2-3 days | Investment: โ‚ฌ2,500

โšก Performance Optimization Scale your Laravel application to handle millions of requests with confidence.

  • Database query optimization
  • Caching strategies
  • Queue optimization
  • Load testing and monitoring

๐Ÿ“ฆ Custom Package Development Build tailored Laravel packages for your specific business needs.

  • Internal tools and libraries
  • API integrations
  • Third-party service wrappers
  • Investment: โ‚ฌ5,000-โ‚ฌ10,000

๐Ÿ‘จโ€๐Ÿซ Team Training & Consulting Level up your team's Laravel skills with hands-on workshops and mentoring.

  • Laravel best practices
  • Clean architecture principles
  • Testing strategies
  • โ‚ฌ1,500/day for team workshops

๐Ÿ‘จโ€๐Ÿ’ป Experience:

  • 15+ years Laravel/PHP expertise
  • Ex-CTO at Delcampe (marketplace with millions of users)
  • Chapter Lead at BNP Paribas Fortis
  • Creator of popular packages: DevToolbox, Atlas, ShareLink, Draftable

๐Ÿ“ฌ Get in Touch:

๐Ÿ’ก Working on a complex Laravel project? Let's discuss how I can help you build better, faster, and more maintainable applications.

โญ Support This Package

If Laravel DevToolbox saved you time and improved your workflow:

  • โญ Star this repository โ€” Help others discover it
  • ๐Ÿฆ Share it with your team and network
  • ๐Ÿ’– Sponsor my work โ€” Support continued development

Every star and sponsor helps me dedicate more time to maintaining and improving these tools for the Laravel community!

Created with โค๏ธ in Belgium ๐Ÿ‡ง๐Ÿ‡ช by Jean-Marc Strauven