PHPackages                             onelearningcommunity/laravel-model-explorer - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. onelearningcommunity/laravel-model-explorer

ActiveLibrary[Database &amp; ORM](/categories/database)

onelearningcommunity/laravel-model-explorer
===========================================

A zero-config browser UI and MCP server for exploring your Eloquent models, relationships, scopes, and data.

v0.5.2(1mo ago)734.6k↑2308.3%MITPHPPHP ^8.3CI passing

Since Mar 24Pushed 1mo agoCompare

[ Source](https://github.com/One-Learning-Community/laravel-model-explorer)[ Packagist](https://packagist.org/packages/onelearningcommunity/laravel-model-explorer)[ Docs](https://github.com/one-learning-community/laravel-model-explorer)[ RSS](/packages/onelearningcommunity-laravel-model-explorer/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (8)Dependencies (46)Versions (11)Used By (0)

Model Explorer for Laravel
==========================

[](#model-explorer-for-laravel)

[![Latest Version on Packagist](https://camo.githubusercontent.com/f419ed1e280b3441efd7db7840bd0f0b973f2105eda6efa523650d98e04b0667/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6f6e656c6561726e696e67636f6d6d756e6974792f6c61726176656c2d6d6f64656c2d6578706c6f7265722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/onelearningcommunity/laravel-model-explorer)[![GitHub Tests Action Status](https://camo.githubusercontent.com/0e1762c3e2a658f3f596977d547814ddd1cddc4d56a0bdf6ffe3bc3308fd1457/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6f6e652d6c6561726e696e672d636f6d6d756e6974792f6c61726176656c2d6d6f64656c2d6578706c6f7265722f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/one-learning-community/laravel-model-explorer/actions?query=workflow%3Arun-tests+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/86ecacb0ad76caf0ae94136497228bf9cf910e20e0c3785e567f38b5d6927278/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6f6e656c6561726e696e67636f6d6d756e6974792f6c61726176656c2d6d6f64656c2d6578706c6f7265722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/onelearningcommunity/laravel-model-explorer)

A Laravel package that gives AI coding agents and developers a live, structural view of your Eloquent models — columns, relations, scopes, accessors, traits, and data — through an MCP server for agents and a browsable UI for humans. No source scanning, no stale context.

**Zero setup beyond Composer install.** No `vendor:publish`, no frontend tooling required in your application.

Requirements
------------

[](#requirements)

- PHP 8.3+
- Laravel 11, 12, or 13

Features
--------

[](#features)

- **AI Model Introspection (MCP)** — a local [`laravel/mcp`](https://laravel.com/docs/mcp) server exposing five tools (`list-models`, `inspect-model`, `find-model`, `model-source`, `model-neighbors`) so Claude Code, Cursor, and other MCP clients get live model structure and trait-correct source, instead of grepping your app
- **Model list** — searchable grid of all discovered Eloquent models
- **Model detail** — DB columns, casts, fillable/hidden/guarded, relations with type badges and foreign keys, scopes with source snippets, traits, and accessor snippets
- **Record lookup** — find any record by primary key or unique field; browse raw attributes, lazy-loaded accessor values, and expandable relations with drill-down navigation and breadcrumb trail
- **Relationship graph** — interactive force-directed SVG graph of all model relationships

Installation
------------

[](#installation)

```
composer require --dev onelearningcommunity/laravel-model-explorer
```

The package auto-registers via Laravel's package discovery — no additional setup required.

Usage
-----

[](#usage)

Visit `/_model-explorer` in your application. In local environments, access is granted by default.

AI Model Introspection (MCP)
----------------------------

[](#ai-model-introspection-mcp)

Model Explorer ships a local [`laravel/mcp`](https://laravel.com/docs/mcp) server, `model-explorer`, that lets AI coding agents introspect your Eloquent models without scanning source. Register it in your AI client:

```
{
  "mcpServers": {
    "model-explorer": {
      "command": "php",
      "args": ["artisan", "mcp:start", "model-explorer"]
    }
  }
}
```

Tools: `list-models`, `inspect-model` (opt-in sections via `include`, including a `members` section listing every method/property/constant with provenance, filterable by kind or declaring file), `find-model` (filter by `trait`/`extends`/`relatesTo`/ `hasColumn`/`definesMember`), `model-source` (fetches any member's source by name, not just scopes/relations/accessors), and `model-neighbors` (a model's depth-1 relation neighborhood — defaults to *incoming* relations, "which models point at this one"). If you use [Laravel Boost](https://laravel.com/docs/boost), `boost:install` copies this package's Boost guidelines into your project so an already-connected agent is told the server exists — it doesn't register the server itself, so the client config above is still required either way.

The tools read live by default so an agent never sees stale structure mid-development. Set `MODEL_EXPLORER_MCP_CACHE=true` to trade freshness for speed on very large model sets, or `MODEL_EXPLORER_MCP=false` to disable the server entirely. To inspect models outside your configured `model_paths` (e.g. a vendor package's model) by FQCN, set `MODEL_EXPLORER_MCP_ALLOW_UNDISCOVERED=true`.

See the [MCP guide](https://one-learning-community.github.io/laravel-model-explorer/guide/mcp.html) for the full tool reference.

Authorization
-------------

[](#authorization)

Access is controlled by the `viewModelExplorer` gate, which defaults to allowing access in `local` environments only. Override it in your `AuthServiceProvider` to control access elsewhere:

```
Gate::define('viewModelExplorer', function (User $user): bool {
    return $user->isAdmin();
});
```

To disable the explorer entirely regardless of the gate, set the environment variable:

```
MODEL_EXPLORER_ENABLED=false
```

Configuration
-------------

[](#configuration)

Publish the config file to customise behaviour:

```
php artisan vendor:publish --tag="model-explorer-config"
```

```
return [
    // Set to false to disable entirely (e.g. force off in production regardless of gate)
    'enabled' => env('MODEL_EXPLORER_ENABLED', true),

    // URL prefix for all Model Explorer routes
    'path' => env('MODEL_EXPLORER_PATH', '_model-explorer'),

    // Middleware applied to all routes ('web' is required)
    'middleware' => ['web'],

    // Directories scanned for Eloquent models (add more for DDD layouts, packages, etc.)
    // Keys are the root namespace, values are absolute directory paths.
    'model_paths' => [
        'App'             => app_path(),
        // 'Domain\\Billing' => base_path('src/Billing'),
    ],

    // Model classes matching these patterns are hidden, even inside a scanned path.
    // Entries match the FQCN and may use `*` as a wildcard (leading `\` is ignored).
    'excluded_models' => [
        // 'Laravel\\Telescope\\*',
        // 'App\\Models\\Internal\\AuditLog',
    ],

    // Traits whose FQN begins with these prefixes will be hidden in the UI
    'excluded_trait_prefixes' => [
        'Illuminate\Database\Eloquent\Concerns\\',
        'Illuminate\Database\Eloquent\HasCollection',
        'Illuminate\Support\Traits\\',
    ],

    // Related records shown per page when drilling into a to-many relation,
    // and the cap on collection-returning accessor values.
    'per_page' => env('MODEL_EXPLORER_PER_PAGE', 15),

    // Cache model discovery and inspection results (recommended for large apps).
    // Disabled by default so model changes appear immediately during development.
    'cache' => [
        'enabled' => env('MODEL_EXPLORER_CACHE', false),
        'store'   => env('MODEL_EXPLORER_CACHE_STORE'),   // null = default store
        'ttl'     => env('MODEL_EXPLORER_CACHE_TTL'),     // seconds; null = forever
    ],
];
```

### Caching

[](#caching)

For apps with many models, the filesystem scanning and reflection behind the model list, detail, and graph views can be enabled for caching via `MODEL_EXPLORER_CACHE=true`. Model detail pages auto-refresh when the model file changes; the model list and graph are cached until the TTL expires or you clear them manually:

```
php artisan model-explorer:clear
```

Security
--------

[](#security)

Model Explorer for Laravel is intended for development use. The `viewModelExplorer` gate should prevent access in production environments.

All record reads are wrapped in a rolled-back transaction with `Model::withoutEvents()` to prevent accidental writes from observers or model events. Note that non-database side effects from accessor methods (HTTP calls, cache writes, queue pushes) are **not** prevented.

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

49

—

FairBetter than 94% of packages

Maintenance92

Actively maintained with recent releases

Popularity36

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 93.2% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~11 days

Recently: every ~1 days

Total

10

Last Release

33d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b5b0aa19e00a04418b0f4472c3d9020460de899517c52ead5308d0aec0ac0a49?d=identicon)[dan-onelearningcommunity](/maintainers/dan-onelearningcommunity)

---

Top Contributors

[![serpentblade](https://avatars.githubusercontent.com/u/1483665?v=4)](https://github.com/serpentblade "serpentblade (124 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (8 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (1 commits)")

---

Tags

aideveloper-toolseloquenteloquent-orm-modelslaravellaravel-packagemcpmodel-context-protocolphpvuelaravelmcpaieloquentmodelsdeveloper-toolsModel Context Protocol

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/onelearningcommunity-laravel-model-explorer/health.svg)

```
[![Health](https://phpackages.com/badges/onelearningcommunity-laravel-model-explorer/health.svg)](https://phpackages.com/packages/onelearningcommunity-laravel-model-explorer)
```

###  Alternatives

[binaryk/laravel-restify

Laravel REST API helpers

679422.0k](/packages/binaryk-laravel-restify)[lacodix/laravel-model-filter

A Laravel package to filter, search and sort models with ease while fetching from database.

17562.4k](/packages/lacodix-laravel-model-filter)[wnx/laravel-backup-restore

A package to restore database backups made with spatie/laravel-backup.

214427.0k2](/packages/wnx-laravel-backup-restore)[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3915.5k](/packages/rawilk-profile-filament-plugin)[harris21/laravel-fuse

Circuit breaker for Laravel queue jobs. Protect your workers from cascading failures.

46273.9k](/packages/harris21-laravel-fuse)[vormkracht10/laravel-mails

Laravel Mails can collect everything you might want to track about the mails that has been sent by your Laravel app.

25060.1k](/packages/vormkracht10-laravel-mails)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
