joshcirre / laravel-doctor
Artisan-first Laravel codebase health scanner with diagnostics and scoring
Installs: 22
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/joshcirre/laravel-doctor
Requires
- php: ^8.2
- illuminate/console: ^11.0|^12.0
- illuminate/support: ^11.0|^12.0
Requires (Dev)
- phpunit/phpunit: ^11.0
README
Artisan-first Laravel codebase health scanner inspired by React Doctor.
laravel-doctor reports actionable diagnostics across security, correctness, performance, architecture, and maintainability, then computes a local deterministic 0-100 score.
Install
composer require --dev joshcirre/laravel-doctor
Publish config:
php artisan vendor:publish --tag=laravel-doctor-config
Usage
Run a full scan:
php artisan doctor
Common options:
php artisan doctor -v php artisan doctor --score php artisan doctor --format=json php artisan doctor --diff php artisan doctor --diff=main php artisan doctor --min-score=75
Trace scanned files:
php artisan doctor -v # first 60 scanned files php artisan doctor -vv # all scanned files
Progress and banner output use Laravel's console UI components by default. Disable progress indicators with:
php artisan doctor --no-progress
Auto-Fix
Apply safe built-in automated fixes:
php artisan doctor:fix
Preview changes only:
php artisan doctor:fix --dry-run
Apply only for changed files:
php artisan doctor:fix --diff
Run an optional Rector pass after built-in fixers (when vendor/bin/rector exists):
php artisan doctor:fix --with-rector
When diagnostics cannot be fixed programmatically, Laravel Doctor generates .laravel-doctor/manual-fix-plan.md with:
- A ready-to-paste prompt for your coding agent
- A rule-by-rule checklist with file and line references
Current Rule Set (MVP)
laravel/no-debug-statementslaravel/no-env-outside-configlaravel/no-mass-assignment-bypasslaravel/controller-missing-validationlaravel/no-broad-catchlaravel/likely-n-plus-onelaravel/fat-controllerlaravel/deep-nesting
Scoring
- Starts at
100 - Applies weighted penalties by severity and category
- Caps per-rule penalty to avoid one repeated issue collapsing score
- Labels:
80+: Great55-79: Needs work0-54: Critical
CI Example
php artisan doctor --format=json --min-score=75
The command exits non-zero when score is below --min-score.
Skill
This repository includes an Agent Skill at skills/laravel-doctor/SKILL.md for AI agents to run Laravel Doctor and remediate findings in priority order.