Download the PHP package ashokdevatwal/laravel-smart-db-optimizer without Composer
On this page you can find all versions of the php package ashokdevatwal/laravel-smart-db-optimizer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ashokdevatwal/laravel-smart-db-optimizer
More information about ashokdevatwal/laravel-smart-db-optimizer
Files in ashokdevatwal/laravel-smart-db-optimizer
Package laravel-smart-db-optimizer
Short Description Laravel Smart Database Optimizer is a package designed to help developers identify slow queries, suggest optimizations, and recommend indexes to improve database performance.
License MIT
Informations about the package laravel-smart-db-optimizer
Laravel Smart Database Optimizer
Laravel Smart Database Optimizer is a package designed to help developers identify slow queries, suggest optimizations, and recommend indexes to improve database performance.
🚀 Features
- ✅ Logs slow queries automatically
- ✅ Provides CLI commands for analysis
- ✅ Suggests indexes based on query patterns
- ✅ Includes middleware for real-time query tracking
- ✅ Simple installation and configuration
📦 Installation
Step 1: Install via Composer
Step 2: Publish Configurations
Step 3: Run Migrations
Step 4: Add Middleware (Optional)
If you want to log queries globally, add this to your app/Http/Kernel.php file:
⚡ Usage
Analyze Slow Queries
Run the following command to analyze slow queries:
Suggest Indexes
Run the command to get index recommendations:
Detect Frequent Queries & Suggested Caching
Automatically Cache Queries
If auto_cache is enabled, frequently executed queries will be automatically cached.
View Logged Queries via API
You can fetch logged queries using:
⚙️ Configuration
Edit config/smartdb.php to set the slow query threshold (default: 100ms):
🛠 Troubleshooting
Query Logs Table Not Found?
Run migrations again:
Middleware Not Working?
Ensure it's registered in app/Http/Kernel.php.
📜 License
This package is open-source and available under the MIT license.
💡 Future Enhancements
- UI Dashboard for Query Analysis
- AI-powered Index Suggestions
- Support for Multiple Databases
🚀 Contributions are welcome! Feel free to submit pull requests or open issues.