PHPackages                             maxis/laravel-eloquent-guard - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. maxis/laravel-eloquent-guard

ActiveLibrary[Database &amp; ORM](/categories/database)

maxis/laravel-eloquent-guard
============================

Runtime Eloquent performance monitor

v1.0.6(1mo ago)196↓100%MITPHPPHP ^8.2

Since Mar 9Pushed 1mo agoCompare

[ Source](https://github.com/Maxiz88/laravel-eloquent-guard)[ Packagist](https://packagist.org/packages/maxis/laravel-eloquent-guard)[ Docs](https://github.com/Maxiz88/laravel-eloquent-guard)[ RSS](/packages/maxis-laravel-eloquent-guard/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (7)Versions (8)Used By (0)

Eloquent Guard for Laravel 🛡️
=============================

[](#eloquent-guard-for-laravel-️)

[![Latest Version on Packagist](https://camo.githubusercontent.com/787dd87949e44969158f759c57a85ca0a8e9a726c135d833412e5e0ff465ce00/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d617869732f6c61726176656c2d656c6f7175656e742d6775617264)](https://packagist.org)[![Total Downloads](https://camo.githubusercontent.com/245809c393a974ebe00b8725a148faa66e96c8bf859e7ded8ecb33cc441539a4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d617869732f6c61726176656c2d656c6f7175656e742d6775617264)](https://packagist.org)

**Eloquent Guard** is a lightweight, production-ready runtime performance monitor for Laravel. It detects N+1 queries and slow database operations as they happen, helping you keep your application fast and efficient.

✨ Features
----------

[](#-features)

- **N+1 Query Detection**: Automatically detects repeated queries within a single request.
- **Slow Query Monitor**: Alerts you when a query exceeds your defined time limit.
- **Laravel Pulse Integration**: Beautiful custom dashboard card to visualize alerts.
- **Smart Backtrace**: Pinpoints the exact file and line of code causing the issue (skips vendor files).
- **Multi-channel Reporting**: Built-in support for Log, Slack, Telegram, and Sentry.
- **Zero Configuration**: Works out of the box with sensible defaults.

📢 Multi-Channel Reporting
-------------------------

[](#-multi-channel-reporting)

Stay informed where your team already works. All alerts include a **Smart Backtrace** that points directly to your code, skipping the `vendor/` noise.

ChannelPreview**Slack**[![Slack Alert](art/slack.png)](art/slack.png)**Telegram**[![Telegram Alert](art/telegram.png)](art/telegram.png)**Sentry**[![Sentry Issue](art/sentry.png)](art/sentry.png)**Laravel Logs**`[2026-03-09 21:27:16] local.WARNING: Eloquent Guard: N+1 detected! {"sql":"select * from `users` where `users`.`id` = ? limit 1","count":5,"source":"/var/www/html/routes/web.php:9"}`
`[2026-03-09 21:27:17] local.CRITICAL: Eloquent Guard: Slow Query! {"sql":"SELECT SLEEP(1)","duration":"1000.47ms","source":"/var/www/html/routes/web.php:13"}`🚀 Installation
--------------

[](#-installation)

You can install the package via composer:

```
composer require maxis/laravel-eloquent-guard
```

Usage
-----

[](#usage)

### Publish Configuration

[](#publish-configuration)

Publish the configuration file to customize thresholds, ignored tables, and active reporters:

```
php artisan vendor:publish --provider="Maxis\EloquentGuard\EloquentGuardServiceProvider" --tag="config"
```

### Configure Environment

[](#configure-environment)

Add your webhook URLs or bot tokens to your .env file for instant alerts:

```
ELOQUENT_GUARD_ENABLED=true
ELOQUENT_GUARD_SLACK_WEBHOOK=https://hooks.slack.com...
ELOQUENT_GUARD_TELEGRAM_TOKEN=your-bot-token
ELOQUENT_GUARD_TELEGRAM_CHAT_ID=your-chat-id
```

Important

**Queue Worker Required:** To ensure your application's performance is not affected, reporting (Slack, Telegram, Sentry) is handled via Laravel's queue system. Make sure your queue worker is running (`php artisan queue:work`) to receive alerts.

### ⚙️ Configuration

[](#️-configuration)

Once published, you can find the settings in config/eloquent-guard.php.

#### Thresholds &amp; Limits

[](#thresholds--limits)

Customize what constitutes a performance issue for your specific application:

```
'limits' => [
    'n_plus_one_threshold' => 5,   // Alert after 5 identical queries in one request
    'query_duration_ms' => 500,    // Alert if a single query takes more than 500ms
],
```

#### Reporters

[](#reporters)

Enable or disable notification channels by adding/removing classes from the reporters array:

```
'reporters' => [
    \Maxis\EloquentGuard\Reporters\LogReporter::class,      // Standard Laravel Logs
    \Maxis\EloquentGuard\Reporters\SlackReporter::class,    // Slack Webhooks (Queue supported)
    \Maxis\EloquentGuard\Reporters\TelegramReporter::class, // Telegram Bot API
    \Maxis\EloquentGuard\Reporters\SentryReporter::class,   // Sentry Issue Tracking
],
```

#### Ignored Tables

[](#ignored-tables)

Prevent noise from system tables (like sessions or cache):

```
'except_tables' => ['sessions', 'cache', 'pulse_entries', 'jobs', 'migrations'],
```

### 📊 Laravel Pulse Integration

[](#-laravel-pulse-integration)

Eloquent Guard comes with a dedicated Laravel Pulse card to visualize N+1 and Slow Query trends directly in your dashboard.

[![Eloquent Guard Pulse Card](art/pulse.png)](art/pulse.png)

#### Add the Card to Dashboard

[](#add-the-card-to-dashboard)

Include the Livewire component in your resources/views/vendor/pulse/dashboard.blade.php:

```

```

### 🧪 Testing

[](#-testing)

The package is fully tested with PHPUnit. If you are developing locally or using Laravel Sail, run the test suite with:

```
# Using Laravel Sail
sail php ./packages/maxis/eloquent-guard/vendor/bin/phpunit -c ./packages/maxis/eloquent-guard/phpunit.xml

# Or standard PHPUnit from the package directory
./vendor/bin/phpunit
```

### 🤝 Contributing

[](#-contributing)

Contributions make the open-source community amazing!

1. **Fork** the Project
2. **Create** your Feature Branch (`git checkout -b feature/AmazingFeature`)
3. **Commit** your Changes (`git commit -m 'Add some AmazingFeature'`)
4. **Push** to the Branch (`git push origin feature/AmazingFeature`)
5. **Open** a Pull Request

### 📄 License

[](#-license)

Distributed under the MIT License. See LICENSE.md for more information.

###  Health Score

43

—

FairBetter than 91% of packages

Maintenance89

Actively maintained with recent releases

Popularity14

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 60% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~1 days

Total

7

Last Release

56d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/fff0f044eff6166e4aa68ab0587579f93c8d0109807e1ef50c0416b1124e7653?d=identicon)[Maxiz88](/maintainers/Maxiz88)

---

Top Contributors

[![max-kosenko](https://avatars.githubusercontent.com/u/166387836?v=4)](https://github.com/max-kosenko "max-kosenko (6 commits)")[![Maxiz88](https://avatars.githubusercontent.com/u/14619331?v=4)](https://github.com/Maxiz88 "Maxiz88 (4 commits)")

---

Tags

eloquentlaravelmysqln-plus-1n-plus-onen-plus-one-detectionn-plus-one-problempostgresqlslow-queriesslow-query-logssqllaravelmonitoringperformanceeloquentn-plus-onepulse

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/maxis-laravel-eloquent-guard/health.svg)

```
[![Health](https://phpackages.com/badges/maxis-laravel-eloquent-guard/health.svg)](https://phpackages.com/packages/maxis-laravel-eloquent-guard)
```

###  Alternatives

[watson/validating

Eloquent model validating trait.

9723.3M47](/packages/watson-validating)[silber/bouncer

Eloquent roles and abilities.

3.6k4.4M25](/packages/silber-bouncer)[dyrynda/laravel-model-uuid

This package allows you to easily work with UUIDs in your Laravel models.

4802.8M8](/packages/dyrynda-laravel-model-uuid)[reedware/laravel-relation-joins

Adds the ability to join on a relationship by name.

2121.2M13](/packages/reedware-laravel-relation-joins)[cybercog/laravel-love

Make Laravel Eloquent models reactable with any type of emotions in a minutes!

1.2k302.7k1](/packages/cybercog-laravel-love)[cviebrock/eloquent-taggable

Easy ability to tag your Eloquent models in Laravel.

567694.8k3](/packages/cviebrock-eloquent-taggable)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
