Download the PHP package devlin/laravel-model-analyzer without Composer

On this page you can find all versions of the php package devlin/laravel-model-analyzer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-model-analyzer

Laravel Model Analyzer

A Laravel package that scans your Eloquent models and validates their relationships against your actual database schema. It detects missing inverse relationships, circular dependencies, missing foreign key columns, missing indexes, and more — then reports a health score for your model layer.

Demo

You can check a quick demo here

Requirements

Dependency Version
PHP ^7.4 or ^8.0
Laravel / Illuminate ^8.0
Symfony Finder ^5.0

Installation

Install via Composer:

Laravel's package auto-discovery registers the service provider automatically. If you have auto-discovery disabled, add the provider manually in config/app.php:

Publish the config file

This creates config/model-analyzer.php.

Configuration

Commands

model-analyzer:analyze

Runs a full analysis of all discovered models and prints a report.

Options:

Option Description
--format=cli Output format: cli (default) or json
--strict Exit with code 1 if any warnings are found
--models=User,Post Analyze only the specified models (comma-separated)

Examples:

Exit codes:


model-analyzer:health

Displays a summary health score and grouped recommendation report.

Exit codes:


model-analyzer:list-models

Lists all Eloquent models discovered in the configured paths.

Options:

Option Description
--with-relationships Show relationship count per model
--json Output as a JSON array of fully-qualified class names

Examples:

model-analyzer:visualize

Generates a visual diagram of your model relationships as a standalone file.

Options:

Option Description
--output=path Output file path (default: model-relationships.html or model-erd.html)
--models=User,Post Comma-separated list of models to include
--erd Generate an Entity Relationship Diagram instead of a force-directed graph
--format=html Output format: html (interactive, D3.js) or svg (static, embeddable)

Examples:

HTML format produces a standalone file with D3.js — drag nodes, zoom, hover for details.

SVG format produces a pure <svg> file with no JavaScript — lightweight, scalable, and works anywhere images are supported.


What It Detects

Issue Severity Description
Missing inverse relationship Warning e.g. User hasMany Post exists but Post belongsTo User is missing
Circular dependency Error Two models reference each other in a way that creates a loop
Missing foreign key column Error A relationship references a column that does not exist in the database
Missing index on foreign key Warning A foreign key column has no index, which can hurt query performance

Health Score

The model-analyzer:analyze and model-analyzer:health commands calculate a 0–100 health score based on the number and severity of issues found relative to the total number of relationships. A score of 100 means no issues were detected.

CI Integration

Run the analyzer in strict mode to fail your pipeline when any issue is found:

Or allow warnings but fail only on errors (the default):

Running Tests

License

MIT


All versions of laravel-model-analyzer with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4|^8.0
illuminate/support Version ^8.0
illuminate/console Version ^8.0
illuminate/database Version ^8.0
symfony/finder Version ^5.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package devlin/laravel-model-analyzer contains the following files

Loading the files please wait ...