imrandevbd / drutogoti
Auto-detect, visualize, and fix performance bottlenecks in Laravel.
Package info
github.com/imranbru99/laravel-speed-optimization-drutogoti
pkg:composer/imrandevbd/drutogoti
Requires
- php: ^8.3
- illuminate/cache: ^11.0|^12.0
- illuminate/console: ^11.0|^12.0
- illuminate/contracts: ^11.0|^12.0
- illuminate/database: ^11.0|^12.0
- illuminate/log: ^11.0|^12.0
- illuminate/routing: ^11.0|^12.0
- illuminate/support: ^11.0|^12.0
Requires (Dev)
- laravel/pint: ^1.13
- orchestra/testbench: ^9.0
- pestphp/pest: ^3.0
- pestphp/pest-plugin-laravel: ^3.0
- phpstan/phpstan: ^1.10
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-10-16 22:19:15 UTC
README
⚡ Drutogoti (দ্রুতগতি) for Laravel
Auto-detect, visualize, and fix performance bottlenecks in Laravel applications.
📖 Introduction
Drutogoti (Bengali for "Rapid Velocity / High Speed") is a lightweight, zero-overhead Application Performance Profiler and Optimization Engine designed specifically for Laravel 11.x and 12.x.
Modern web applications slow down silently. Hidden N+1 queries, unindexed slow queries, repeated cache misses, oversized header cookies, and unoptimized image payloads degrade user experience and inflate cloud server costs.
Drutogoti runs in the background of your application, intercepts key lifecycle events, and offloads analysis asynchronously to your queue worker—guaranteeing virtually zero response-time overhead for production workloads.
🚀 Key Highlights
- 🔍 Autonomous N+1 Query Detection: Groups duplicate and recurring SQL statements across request cycles and flags relationships that require eager loading.
- ⏱️ Slow Query Diagnostics: Intercepts database queries exceeding configurable execution latency thresholds (e.g., > 100ms) with full backtrace down to the calling controller line.
- ⚡ Non-Blocking Queue Offloading: Event telemetry is buffered in memory during request lifecycle and dispatched in the
terminatingcallback to background queue workers (syncorqueuedrivers). - 🗄️ Cache Performance Telemetry: Real-time metrics on cache hits and misses to detect cold caches or missing cache strategies.
- 🍪 Cookie & Header Bloat Monitoring: Monitors cookie payloads and triggers alerts when request/response cookies breach maximum sizing budgets (default: 4096 bytes).
- 🖼️ Asset & Image Scanner: Detects uncompressed image assets across public directories and recommends compression workflows using standard CLI binaries (
jpegoptim,optipng,pngquant,cwebp). - 💡 Intelligent Suggestion Engine: Deduplicates repetitive issues and tracks first-seen, last-seen, and frequency occurrences with severity scoring.
- 🛡️ Production-Safe Sampling & Route Filtering: Configurable sampling rate (
DRUTOGOTI_SAMPLE_RATE=0.1for 10% sampling) and path exclusion patterns (/up,/telescope*,/horizon*).
📦 Requirements
- PHP:
^8.3 - Laravel:
^11.0or^12.0 - Database: MySQL, PostgreSQL, SQLite, or MariaDB
⚡ Installation
Install Drutogoti into your project via Composer:
composer require imrandevbd/drutogoti
1. Publish Configuration & Migrations
Publish the package configuration file and database migrations:
php artisan vendor:publish --tag="drutogoti-config" php artisan vendor:publish --tag="drutogoti-migrations"
2. Run Database Migrations
Run the migrations to create the required telemetry and suggestion tables:
php artisan migrate
⚙️ Configuration
The configuration file is published to config/drutogoti.php. You can customize settings directly or override them via your .env file:
# Enable or disable Drutogoti profiling DRUTOGOTI_ENABLED=true # Storage Mode: 'queue' (recommended for production) or 'sync' (development) DRUTOGOTI_STORAGE_DRIVER=queue DRUTOGOTI_QUEUE_CONNECTION=redis DRUTOGOTI_QUEUE_NAME=default # Query Watcher Thresholds DRUTOGOTI_WATCHER_QUERIES_ENABLED=true DRUTOGOTI_SLOW_THRESHOLD_MS=100 DRUTOGOTI_N_PLUS_ONE_THRESHOLD=3 # Cache & Cookie Watchers DRUTOGOTI_WATCHER_CACHE_ENABLED=true DRUTOGOTI_WATCHER_COOKIES_ENABLED=true # Image Scanner DRUTOGOTI_WATCHER_IMAGES_ENABLED=true # Production Request Sampling (1.0 = 100%, 0.1 = 10%) DRUTOGOTI_SAMPLE_RATE=1.0
Configuration Overview
return [ 'enabled' => env('DRUTOGOTI_ENABLED', false), 'storage' => [ // 'queue' offloads event writing to avoid blocking user HTTP responses 'driver' => env('DRUTOGOTI_STORAGE_DRIVER', 'queue'), 'queue_connection' => env('DRUTOGOTI_QUEUE_CONNECTION', env('QUEUE_CONNECTION', 'sync')), 'queue_name' => env('DRUTOGOTI_QUEUE_NAME', 'default'), 'retention_days' => 7, 'auto_prune' => true, ], 'watchers' => [ 'queries' => [ 'enabled' => env('DRUTOGOTI_WATCHER_QUERIES_ENABLED', true), 'slow_threshold_ms' => 100, 'n_plus_one_threshold' => 3, 'exclude_paths' => [ 'vendor', ], ], 'cache' => [ 'enabled' => env('DRUTOGOTI_WATCHER_CACHE_ENABLED', true), ], 'cookies' => [ 'enabled' => env('DRUTOGOTI_WATCHER_COOKIES_ENABLED', true), 'size_warning_bytes' => 4096, ], 'images' => [ 'enabled' => env('DRUTOGOTI_WATCHER_IMAGES_ENABLED', true), 'scan_paths' => [ 'public', 'storage/app/public', ], 'binaries' => [ 'jpegoptim' => '/usr/bin/jpegoptim', 'optipng' => '/usr/bin/optipng', 'pngquant' => '/usr/bin/pngquant', 'gifsicle' => '/usr/bin/gifsicle', 'cwebp' => '/usr/bin/cwebp', ], ], ], 'dashboard' => [ 'enabled' => true, 'route_prefix' => 'drutogoti', 'middleware' => ['web', 'auth'], ], 'exclude_paths' => [ 'drutogoti*', 'up', // Laravel health check ], 'sample_rate' => env('DRUTOGOTI_SAMPLE_RATE', 1.0), ];
🛠️ How It Works
Zero-Overhead Lifecycle Hook
Drutogoti hooks into Laravel's request lifecycle using a singleton CaptureContext:
Incoming Request
│
▼
┌────────────────────────────────────────┐
│ App Execution & Query Listeners │
│ (In-memory capture of SQL, Cache, etc.)│
└────────────────────────────────────────┘
│
▼
Response Sent to Client (HTTP 200)
│
▼
┌────────────────────────────────────────┐
│ App Terminating Hook │
│ └── flushAndDispatch() │
│ └── Dispatched to Queue Worker │
└────────────────────────────────────────┘
│
▼
Async StoreCapturedEvents Job -> Database Log & Suggestion Engine
Because telemetry persistence is deferred to queue workers after HTTP responses are flushed to the browser, users experience no added latency.
🧪 Testing
Drutogoti is thoroughly tested using Pest PHP and PHPStan:
# Run Pest test suite composer test # Run static analysis composer analyse # Run code style formatting composer format
🗺️ Roadmap
- Query & N+1 Watcher with execution backtracing
- Asynchronous queue ingestion
- Intelligent suggestion grouping and deduplication
- Dedicated UI Dashboard for live telemetry visualization
- Slack & Discord webhook alerting for critical performance drops
- GitHub PR automated query regression check integration
🤝 Contributing
Contributions, issues, and feature requests are welcome! Feel free to check the issues page if you want to contribute.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
📄 License
This open-source software is licensed under the MIT License.
🤝 Let's Connect & Collaborate
I am open to Senior Remote Full-Stack Roles, AI Platform Architecture Contracts, and Enterprise Technical Advisory.
- Timezone: UTC+6 (Dhaka / Rangpur, Bangladesh) — Flexible overlap with US, UK, and European business hours.
- Delivery Mode: Async-ready, Slack, Discord, Jira, GitHub, and production-first accountability.
| Channel | Address / Handle | Quick Action |
|---|---|---|
| 🌐 Primary Portfolio | imrandev.bd | Visit Site ↗ |
| 📦 Packagist Packages | packagist.org/packages/imrandevbd/ | View Packages ↗ |
| 💼 LinkedIn Profile | linkedin.com/in/imranbru99 | Connect ↗ |
| 🐙 GitHub Profile | github.com/imranbru99 | Follow ↗ |
| 💬 WhatsApp Direct | +880 1576-918420 | Chat Now ↗ |
| 📧 Direct Email | me@imrandev.bd | Send Email ↗ |
| 🐦 X (Twitter) | @imrandev_bd | Follow ↗ |
| 📺 YouTube Tech | @ImranDevBD | Subscribe ↗ |