Laravel Devtoolbox
Laravel Devtoolbox stats
- Downloads
- 120
- Stars
- 11
- Open Issues
- 0
- Forks
- 1
Swiss-army artisan CLI for Laravel — Scan, inspect, debug, and explore every aspect of your Laravel application from the command line.
Laravel Devtoolbox
Swiss-army artisan CLI for Laravel — Scan, inspect, debug, and explore every aspect of your Laravel application from the command line.
✨ 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
📦 Installation
Install via Composer as a development dependency:
composer require --dev grazulex/laravel-devtoolbox
Requirements:
- PHP 8.3+
- Laravel 11.0+ | 12.0+
🚀 Quick Start
# See all available commandsphp artisan list dev: # Enhanced application overview (new!)php artisan dev:about+ --extended --performance # Quick health check of your applicationphp artisan dev:scan --all # Find where a model is usedphp artisan dev:model:where-used App\Models\User # Detect unused routesphp artisan dev:routes:unused # Find routes by controller (reverse lookup - new!)php artisan dev:routes:where UserController # Generate model relationship diagramphp artisan dev:model:graph --format=mermaid --output=models.mmd # Trace SQL queries for a routephp 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 filesphp artisan dev:env:diff --against=.env.example # Analyze database column usagephp artisan dev:db:column-usage --unused-only # Security scan for unprotected routesphp 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
🔍 Available Commands
General Scanning & Analysis
dev:scan- Comprehensive application analysis with multiple scanner typesdev:about+- Enhanced version of Laravel's about command with extended information
Model Analysis
dev:models- List and analyze all Eloquent modelsdev:model:where-used- Find where specific models are useddev:model:graph- Generate model relationship diagrams
Route Analysis
dev:routes- Inspect application routesdev:routes:unused- Detect potentially unused routesdev:routes:where- Find routes by controller/method (reverse lookup)
Database Analysis
dev:db:column-usage- Analyze database column usage across the Laravel application codebasedev:sql:trace- Trace SQL queries for specific routesdev: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 bindingsdev:container:bindings- Analyze container bindings, singletons, and dependency injection mappingsdev:providers:timeline- Analyze service provider boot timeline and performancedev:commands- List and analyze artisan commands
Middleware Analysis
dev:middleware- Analyze middleware classes and usagedev: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 filesdev:log:tail- Monitor Laravel logs with real-time filtering and pattern matching
📊 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 JSONphp artisan dev:models --format=json --output=models.json # Generate Mermaid diagramphp artisan dev:model:graph --format=mermaid --output=relationships.mmd # Save comprehensive scanphp 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:
- Getting Started - Quick start guide
- Commands Reference - Detailed command documentation
- Configuration - Configuration options
- Examples & Use Cases - Practical usage examples
- CI/CD Integration - Automation workflows
- Output Formats - Export format examples
🔧 Examples & Automation
Daily Development Workflow
# Check application healthphp artisan dev:scan --all --format=count # Find cleanup opportunitiesphp artisan dev:routes:unusedphp artisan dev:env:diff
CI/CD Integration
# Quality gates in CIUNUSED_ROUTES=$(php artisan dev:routes:unused --format=count | jq '.count')if [ $UNUSED_ROUTES -gt 10 ]; then echo "Too many unused routes: $UNUSED_ROUTES" exit 1fi
Documentation Generation
# Generate project documentationphp artisan dev:models --format=json --output=docs/models.jsonphp artisan dev:model:graph --format=mermaid --output=docs/relationships.mmdphp 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.x | 8.3+ | 11.x | 12.x | ✅ Active |
Note: This package now fully supports both Laravel 11 and Laravel 12, ensuring compatibility across the latest LTS and current releases.
🤝 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