A developer tool for Laravel that gives you a browsable UI to explore your Eloquent models — their attributes, casts, relations, scopes, traits, and live data — without reading code.
Zero setup beyond Composer install. No vendor:publish, no frontend tooling required in your application.
- PHP 8.4+
- Laravel 11, 12, or 13
- 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
composer require --dev onelearningcommunity/laravel-model-explorerThe package auto-registers via Laravel's package discovery — no additional setup required.
Visit /_model-explorer in your application. In local environments, access is granted by default.
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=falsePublish 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'),
],
// 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\\',
],
];Laravel Model Explorer 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.
Please see CHANGELOG for more information on what has changed recently.
The MIT License (MIT). Please see License File for more information.