Laravel Model Analyzer

Detect relationship issues before they hit production.

composer require devlin/laravel-model-analyzer
See It In Action

Relationship Validation

Automatically scans all Eloquent models and validates that relationships are properly defined with matching columns, indexes, and inverse methods.

Health Score

Get a 0-100 health score for your model layer. Weighted across five categories: inverse relationships, circular deps, column existence, FK indexes, and constraints.

CI Integration

Use --format=json to pipe results into your CI/CD pipeline. Fail builds when the health score drops below your threshold.

Quick Start

# Install the package

$ composer require devlin/laravel-model-analyzer

 

# Analyze your models

$ php artisan model-analyzer:analyze

 

# Check health score

$ php artisan model-analyzer:health

 

# List all models

$ php artisan model-analyzer:list-models --with-relationships