The DBStan package provides detailed analysis and insights into your database schema for Laravel applications. It helps identify structural issues, missing indexes, normalization problems, nullable column risks, foreign key inconsistencies, and performance concerns.
It is an essential tool for debugging, optimizing, reviewing, and maintaining a healthy database architecture in Laravel projects.
Before using this package, ensure your database connection is properly configured in your Laravel application.
If the database is not configured correctly, DBStan will not be able to analyze your schema.
Make sure your .env file contains valid database credentials.
This package exposes detailed database schema analysis.
It is intended for admin and development use only.
Do NOT expose this tool publicly in production without proper access restrictions, as schema details may reveal sensitive structural information.
#Laravel #Database #Schema #PHP #Performance #Optimization #Analysis
- Features
- Supported Versions
- Installation
- Commands
- Output Categories
- Environment Configuration
- FAQs
- Contributing
- Security Vulnerabilities
- License
- Testing
- Support
✔ Analyze full database schema structure
✔ Detect missing indexes on foreign keys
✔ Identify nullable column risks
✔ Detect normalization issues
✔ Detect repeated fields across tables
✔ Identify tables with too many nullable columns
✔ Highlight performance risks (TEXT, JSON overuse, etc.)
✔ Detect foreign key inconsistencies
✔ Identify unused or suspicious tables
✔ Lightweight and optimized for fast schema scanning
✔ Supports Laravel 9, 10, and 11 with PHP 8+ compatibility
✔ CLI-based analysis with structured categorized output
- PHP: ^8.0
- Illuminate Support: ^9.0 | ^10.0 | ^11.0
To install the package, run:
composer require itpathsolutions/dbstanTo analyze your database schema:
php artisan dbstan:analyzeThis command scans your entire database and displays categorized results in the terminal.
DBStan categorizes findings into the following types:
Critical schema problems that require immediate attention:
- Foreign key without index
- Broken foreign key relationships
- Invalid constraints
Structural or design concerns:
- Too many nullable columns
- Overuse of JSON columns
- Excessive number of columns in a table
Improvement recommendations:
- Missing timestamps
- Repeated fields across tables
- Normalization opportunities
Potential performance bottlenecks:
- Large TEXT fields
- Unindexed foreign keys
- Repeated indexed fields
- Heavy JSON usage
Ensure your .env file contains:
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=your_database
DB_USERNAME=your_username
DB_PASSWORD=your_passwordAfter updating configuration:
php artisan config:clearDBStan analyzes your Laravel database schema and detects structural, normalization, and performance issues.
No. DBStan is completely read-only.
It does NOT make any changes to your database.
Yes, but it is recommended to use it in development or staging environments.
Avoid exposing schema analysis publicly.
Yes. You can integrate:
php artisan dbstan:analyzeinto your CI pipeline to maintain schema quality standards.
Laravel 9, 10, and 11 with PHP 8+ compatibility.
We welcome contributions from the community!
Feel free to Fork the repository and submit a Pull Request.
Please refer to the CONTRIBUTING guidelines for details.
If you discover any security vulnerability, please report it responsibly through the repository's security policy.
This package is open-source and available under the MIT License.
- Feel free to contact us if you have any questions.
- If you find this project helpful, please give us a ⭐ Star.