onelearningcommunity/laravel-model-explorer
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.
composer require --dev onelearningcommunity/laravel-model-explorer
The 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=false
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'),
],
// 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.
How can I help you explore Laravel packages today?