Deep query analyzer for Laravel Eloquent models. Detects N+1 loops, memory spikes, and outputs actionable query logs.
- Production-Grade Architecture: Designed specifically with decoupled, testable interfaces.
- Enterprise Resiliency: Built-in safeguards, structured exception handling, and observability.
- Zero-Friction Setup: Configurable via sensible defaults or deep environment customization.
- Strictly Typed: Complete type declarations compatible with PHP 8.2+ and modern standards.
graph TD
Client[Incoming Request / Trigger] --> Gate[Input Validator & Security Guard]
Gate --> CoreEngine[EloquentLens: Query Optimizer & N+1 Detector]
CoreEngine --> Adapter[External Storage / Cloud / DB]
CoreEngine --> Observer[Telemetry & Audit Logger]
- PHP:
^8.2 - Composer: Modern Composer v2+
composer require smit-backend/eloquent-lensPublish configuration and default assets:
php artisan vendor:publish --tag="eloquent-lens-config"Sample configuration excerpt (config/eloquent-lens.php):
return [
'enabled' => env('ELOQUENT_LENS_ENABLED', true),
'log_channel' => env('ELOQUENT_LENS_LOG', 'stack'),
];Run test suites locally:
composer testIf you discover any security-related issues, please open an issue or email directly via GitHub. Contributions via pull requests are always welcome!
This package is open-sourced software licensed under the MIT License.
Developed and maintained with ❤️ by smit-backend.