Download the PHP package naimul/db-visualizer without Composer
On this page you can find all versions of the php package naimul/db-visualizer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download naimul/db-visualizer
More information about naimul/db-visualizer
Files in naimul/db-visualizer
Package db-visualizer
Short Description Laravel Database & Code Intelligence Visualizer (N+1, Relations, Performance Analyzer)
License MIT
Informations about the package db-visualizer
๐ Laravel DB Visualizer
A powerful Laravel package to analyze your application models, relationships, database usage, and detect performance issues like N+1 queries, unused columns, and missing eager loading.
๐ Features
- ๐ Scan all Eloquent Models (App + Modules support)
- ๐ Auto-detect relationships
- ๐ง Detect N+1 query risks probability
- โ Find unused columns
- โก Detect missing eager loading
- ๐ Performance scoring system (0โ100)
- ๐งน Code usage analysis
- ๐งฉ Supports Laravel Modules (nwidart style)
๐ฆ Installation
Install via Composer:
`
โ๏ธ Auto Service Provider
If you are using Laravel 10+, the package will auto-register.
If not, add manually:
๐ Publishing Configuration
To customize the package's configuration, publish the config file with:
This will create a db-visualizer.php config file in your config directory.
๐ Publishing Assets (Views, JS, CSS)
To publish the package's frontend resources (views, JS, CSS), run:
This will copy the package's resources into your application's resources/vendor/db-visualizer directory for customization.
๐ Authorization
Access to DB Visualizer is controlled via a viewDbVisualizer gate. By default, access is only granted in the local environment.
To allow access in other environments, override the gate in your AppServiceProvider:
Requests that fail the gate receive a 403 response. Unauthenticated users are redirected to the login page.
Important: Always declare a nullable
?User $userparameter in your gate callback. Laravel uses this to determine whether the gate supports unauthenticated (guest) access. A callback without any parameter โ such asfn () => trueโ will not be called for guests and will redirect them to login instead.
๐ Routes
After installation, visit:
Example:
๐ API Endpoints
Get all models analysis
Search models
Model details
๐ง What It Analyzes
โ Models
- Table name
- Columns
- Relations
- Soft deletes
โ Relations
- Used / unused detection
- N+1 query detection probability
- Missing eager loading
โ Columns
- Used / unused detection
โ Performance Score
- Calculates score (0โ100)
-
Quality labels:
- Excellent
- Good
- Average
- Poor
๐ Example Response
โก Performance Scoring Rules
| Issue | Penalty |
|---|---|
| Unused relation | -10 |
| Unused column | -2 |
| N+1 issue | -15 |
| Missing eager load | -10 |
Bonus:
- Soft deletes: +5
- Cache usage: +5
- API Resource usage: +5
๐ Requirements
- PHP >= 8.1
- Laravel 10, 11, 12, 13 supported
๐ Supported Structure
app/ModelsModules/*/EntitiesModules/*/Models- Blade Views scanning
๐ฅ Use Case
This package is useful for:
- Optimizing large Laravel applications
- Detecting hidden performance issues
- Code quality auditing
- Refactoring legacy systems
- Interview/demo projects
๐งฉ Future Plans
- N+1 Query file locate
- eagerloading File locate
- Performance booster
๐ค Contributing
Pull requests are welcome. For major changes, please open an issue first.
๐ License
MIT License ยฉ Open Source
โญ Support
If you like this package, give it a โญ on GitHub.
All versions of db-visualizer with dependencies
illuminate/support Version ^10.0 || ^11.0 || ^12.0 || ^13.0
illuminate/filesystem Version ^10.0 || ^11.0 || ^12.0 || ^13.0
illuminate/cache Version ^10.0 || ^11.0 || ^12.0 || ^13.0
illuminate/database Version ^10.0 || ^11.0 || ^12.0 || ^13.0