lucasgio/laravel-analyzer
Zero-dependency PHP static analysis CLI and MCP server for Laravel projects — security, OWASP, complexity, coupling, debt, and test coverage
Platform-specific configuration:
{
"mcpServers": {
"laravel-analyzer": {
"command": "npx",
"args": [
"-y",
"laravel-analyzer"
]
}
}
}Add the config above to .claude/settings.json under the mcpServers key.
A command-line tool for analyzing the quality and security of Laravel projects. Zero external dependencies — pure PHP only.
---
git clone https://github.com/your-user/laravel-analyzer
cd laravel-analyzer
chmod +x bin/laravel-analyze
php bin/laravel-analyze /path/to/your-laravel-projectcomposer global require laravel-analyzer/cli
laravel-analyze /path/to/your-project---
# Analyze the current directory
laravel-analyze .
# Analyze a specific path
laravel-analyze /var/www/my-project
# Run only specific modules
laravel-analyze . --only=security,owasp
# Export HTML report
laravel-analyze . --format=html --output=report.html
# Export JSON for CI/CD
laravel-analyze . --format=json --output=analysis.json
# Export Markdown (for GitHub/GitLab)
laravel-analyze . --format=markdown --output=ANALYSIS.md
# Set a minimum quality threshold
laravel-analyze . --threshold=75
# Disable colors (for logs/CI)
laravel-analyze . --no-color---
coupling)Detects violations of the Single Responsibility Principle (SRP).
| Metric | Description | |--------|-------------| | Average coupling | Number of dependencies per class | | God Classes | Classes with > 20 methods or > 500 lines | | Long methods | Methods with > 50 lines | | Estimated cohesion | How related the class responsibilities are |
How to improve?
new ClassName()---
testing)Evaluates the quality and coverage of the test suite.
| Metric | Description | |--------|-------------| | Unit tests | Files in tests/Unit/ | | Feature tests | Files in tests/Feature/ | | Test/code ratio | % of source files with associated
Loading reviews...