Download the PHP package laravel-analyzer/cli without Composer
On this page you can find all versions of the php package laravel-analyzer/cli. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download laravel-analyzer/cli
More information about laravel-analyzer/cli
Files in laravel-analyzer/cli
Package cli
Short Description Static analysis CLI and MCP server for Laravel projects โ zero dependencies, pure PHP 8.2+
License MIT
Homepage https://github.com/lucasgio/laravel-analyzer
Informations about the package cli
๐ Laravel Best Practices Analyzer CLI
A command-line tool for analyzing the quality and security of Laravel projects. Zero external dependencies โ pure PHP only.
๐ฆ Installation
Option A โ Direct use (no composer install required)
Option B โ Global via Composer
๐ Usage
๐ Analysis Modules
๐ Coupling & Cohesion (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?
- Break God Classes into specific services
- Use dependency injection instead of
new ClassName() - Define interfaces for each dependency
๐งช Test Coverage (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 tests |
| Line coverage | From clover.xml (if present) |
To generate a coverage report:
๐ธ Technical Debt (debt)
Identifies indicators of accumulated technical debt.
| Indicator | Severity |
|---|---|
FIXME |
HIGH |
HACK / XXX |
MEDIUM |
TODO |
LOW |
$guarded = [] |
CRITICAL |
Model::create($request->all()) |
CRITICAL |
Dependencies with wildcard version * |
HIGH |
| Large commented-out code blocks | MEDIUM |
๐งฎ Refactoring Complexity (complexity)
Analyzes the Cyclomatic Complexity (CC) of each method.
| CC | Risk | Description |
|---|---|---|
| 1โ5 | Low | Simple, easy to test |
| 6โ10 | Medium | Moderate, testable |
| 11โ20 | High | Hard to test |
| > 20 | Critical | Practically untestable |
Formula: CC = 1 + (if + for + foreach + while + case + catch + && + \|\|)
๐ Laravel Security (security)
Detects vulnerabilities specific to the Laravel ecosystem.
| Vulnerability | OWASP | Dangerous example |
|---|---|---|
| SQL Injection | A03 | DB::select("SELECT * WHERE id=" . $id) |
| Mass Assignment | A01 | Model::create($request->all()) |
| XSS | A03 | {!! $userInput !!} |
| Command Injection | A03 | shell_exec("ls " . $path) |
| Weak Hashing | A02 | md5($password) |
| Open Redirect | A01 | redirect($request->get('url')) |
| Debug in prod | A05 | APP_DEBUG=true + APP_ENV=production |
๐ก๏ธ OWASP Top 10 (owasp)
Checks the project against the OWASP Top 10 standard (2021).
| Code | Category | What it checks |
|---|---|---|
| A01 | Broken Access Control | Policies, IDOR, protected routes |
| A02 | Cryptographic Failures | MD5/SHA1, hardcoded secrets, HTTPS |
| A03 | Injection | SQL, Command, Object injection |
| A04 | Insecure Design | Rate limiting, validation on store/update |
| A05 | Security Misconfiguration | APP_DEBUG, SameSite cookies, CORS |
| A06 | Vulnerable Components | Dependency versions, composer.lock |
| A07 | Auth Failures | Session fixation, MFA, regeneration |
| A08 | Integrity Failures | CI/CD, unserialize(), secure pipelines |
| A09 | Logging Failures | Security events logged |
| A10 | SSRF | HTTP requests with user-supplied URLs |
๐ Output Formats
Console (default)
Colorized terminal view with progress bars.
JSON
HTML
Full visual report with tables, progress bars, and OWASP breakdown.
Markdown
Compatible with GitHub/GitLab. Ideal for PRs or documentation wikis.
๐ CI/CD Integration
GitHub Actions
GitLab CI
๐ ๏ธ Complementary Tools
| Tool | Installation | Purpose |
|---|---|---|
| Larastan/PHPStan | composer require --dev nunomaduro/larastan |
Advanced static analysis |
| Laravel Pint | Included in Laravel 9+ | Code formatting |
| Enlightn | composer require --dev enlightn/enlightn |
Security audit |
| PHP Insights | composer require nunomaduro/phpinsights |
Quality metrics |
| PHPMD | composer require --dev phpmd/phpmd |
Code smell detection |
๐ Score Interpretation
| Score | Grade | Meaning |
|---|---|---|
| 90โ100 | A+ | Excellent quality |
| 80โ89 | A | Very good quality |
| 70โ79 | B | Good quality, minor improvements needed |
| 60โ69 | C | Acceptable quality, work needed |
| 50โ59 | D | Low quality, urgent refactoring required |
| < 50 | F | Critical quality, high risk |
๐ License
MIT License โ Free for commercial and personal use.