PHPackages                             jati/guciravel - 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. jati/guciravel

ActiveLibrary

jati/guciravel
==============

N+1 Query Healer for Laravel. Visual detection for development environments.

v1.0.1(2d ago)00MITPHPPHP ^8.0

Since Jul 26Pushed todayCompare

[ Source](https://github.com/ginganomercy/guciravel)[ Packagist](https://packagist.org/packages/jati/guciravel)[ RSS](/packages/jati-guciravel/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (3)Versions (2)Used By (0)

♨️ Guciravel
============

[](#️-guciravel)

**The Visual N+1 Query Healer for Laravel**

*Detect, Trace, and Heal Laravel Performance Issues Visually.*

 [![Version 1.0.0](https://camo.githubusercontent.com/1acdf48533773dfbb8656b97d5d484cd1eb366b49e99bc456a105c8aba8a9dd2/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f76657273696f6e2d312e302e302d656634343434)](https://camo.githubusercontent.com/1acdf48533773dfbb8656b97d5d484cd1eb366b49e99bc456a105c8aba8a9dd2/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f76657273696f6e2d312e302e302d656634343434) [![PHP 8.0+](https://camo.githubusercontent.com/e5c69402e78c355a840a6575dfc87b49382500bd210211d1c8d16670811960c0/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e302532422d3737374242343f6c6f676f3d706870)](https://camo.githubusercontent.com/e5c69402e78c355a840a6575dfc87b49382500bd210211d1c8d16670811960c0/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e302532422d3737374242343f6c6f676f3d706870) [![Laravel 9.x - 12.x](https://camo.githubusercontent.com/86edf3a66cae54fb1367d66b3d7942497f0e15f320c5d764e5f627a1d75e9fee/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d392e782d2d31322e782d4646324432303f6c6f676f3d6c61726176656c)](https://camo.githubusercontent.com/86edf3a66cae54fb1367d66b3d7942497f0e15f320c5d764e5f627a1d75e9fee/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d392e782d2d31322e782d4646324432303f6c6f676f3d6c61726176656c) [![Composer 2.x](https://camo.githubusercontent.com/f3ec61b01126b53dd88038b761ef0e180730b075e1983f1b449d045e37da415c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f436f6d706f7365722d322e782d3838353633303f6c6f676f3d636f6d706f736572)](https://camo.githubusercontent.com/f3ec61b01126b53dd88038b761ef0e180730b075e1983f1b449d045e37da415c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f436f6d706f7365722d322e782d3838353633303f6c6f676f3d636f6d706f736572)

---

📖 What is Guciravel?
--------------------

[](#-what-is-guciravel)

**Guciravel** is an *N+1 Query* detection library tailored specifically for *Development* environments. Inspired by the Guci Hot Springs in Tegal, Indonesia (famous for its healing properties), this library "heals" the chronic *N+1 Query* disease that silently kills your Laravel application's performance.

Unlike Laravel's built-in `preventLazyLoading()` feature which throws a disruptive error page, Guciravel acts like a **Secret Intelligence Agent**. It allows your application to run normally, but if it detects an *N+1 Query*, it seamlessly injects a highly informative **Alert Panel** into the corner of your browser.

🛡️ Enterprise-Grade Safety
--------------------------

[](#️-enterprise-grade-safety)

Guciravel is engineered with absolute **Production Safety** in mind:

- **Zero Overhead in Production:** The library completely disables itself if `APP_DEBUG=false` or if your app is running in `production`.
- **Memory Leak Proof (RAM Safe):** It features a built-in memory limiter (max 1000 tracked queries). It will never exhaust your server's RAM, even when running in Long-Running processes like Queue Workers (`php artisan queue:work`).
- **CLI Protected:** It automatically deactivates during Console/Terminal execution. It strictly intercepts Web Requests (HTML) only.

---

🖥️ Server Requirements &amp; Compatibility (Versioning)
-------------------------------------------------------

[](#️-server-requirements--compatibility-versioning)

Guciravel is engineered for wide enterprise compatibility across both legacy and modern Laravel LTS/stable releases. Its dependencies are decoupled from heavy application layers and bind strictly to `illuminate/support`, `illuminate/database`, and `illuminate/contracts`.

### 1. Supported PHP &amp; Laravel Versions

[](#1-supported-php--laravel-versions)

ComponentSupported Version RangesMinimum RequirementNotes**PHP Runtime**`8.0`, `8.1`, `8.2`, `8.3`, `8.4``^8.0`Strict types enabled; PHP 7.x intentionally unsupported**Laravel Framework**`9.x`, `10.x`, `11.x`, `12.x``^9.0`Full support for Laravel 11/12 streamlined bootstrap**Composer**`2.x``^2.0`Utilizes PSR-4 autoloading &amp; Laravel package auto-discovery### 2. Composer Dependency Matrix

[](#2-composer-dependency-matrix)

Composer Package RequirementVersion ConstraintPurpose`php``^8.0`Core PHP engine and typed property compatibility`illuminate/support``^9.0|^10.0|^11.0|^12.0`Event Dispatcher &amp; Collection utilities`illuminate/database``^9.0|^10.0|^11.0|^12.0``QueryExecuted` event interception &amp; Eloquent model tracing`illuminate/contracts``^9.0|^10.0|^11.0|^12.0`Laravel IoC container and Http Kernel contracts---

📦 Installation
--------------

[](#-installation)

Since this is purely a development tool, it is **highly recommended** to install it as a `--dev` dependency with semantic versioning:

```
composer require jati/guciravel:"^1.0" --dev
```

*This package utilizes Laravel Auto-Discovery. You do not need to register the Service Provider manually.*

---

🚀 Usage
-------

[](#-usage)

There is **Zero Configuration required**. Simply serve your Laravel application locally as you normally would.

### Detection Scenario:

[](#detection-scenario)

1. You define an Eloquent relationship (e.g., `User` has many `Posts`).
2. You iterate through them without *Eager Loading* in your Blade view: ```
    @foreach(App\Models\User::all() as $user)

        Total Posts: {{ $user->posts->count() }}
    @endforeach
    ```
3. When you load the page in your browser, the **Guciravel Panel** will automatically pop up in the bottom right corner of your screen.

### What Does Guciravel Tell You?

[](#what-does-guciravel-tell-you)

The Guciravel panel provides a detailed forensic diagnosis:

1. 🧮 **Duplication Count:** How many times the exact same query was executed.
2. 💾 **Raw SQL:** The raw SQL statement causing the bottleneck.
3. 📍 **File Location:** **(CRITICAL!)** Guciravel traces the execution stack and pinpoints the specific file name and line number (e.g., `resources/views/users.blade.php (Line: 12)`).
4. 💊 **Healing Remedy:** Recommendation to fix the issue using the `with()` method.

---

⚠️ Recommendations &amp; Best Practices
---------------------------------------

[](#️-recommendations--best-practices)

### 1. When to use `with()`?

[](#1-when-to-use-with)

Guciravel will advise you to use eager loading. This means you should change your Eloquent calls from:

```
// ❌ Bad (Triggers N+1)
$users = User::all();
```

To:

```
// ✅ Good (Eager Loading)
$users = User::with('posts')->get();
```

### 2. Does this replace `preventLazyLoading()`?

[](#2-does-this-replace-preventlazyloading)

No, both can work side-by-side. However, if you enable `Model::preventLazyLoading(! app()->isProduction());` in your `AppServiceProvider`, your application will crash (throw an Exception) before Guciravel has a chance to render its beautiful UI.

If you prefer a visual, educational approach (especially useful when working with Junior developers who need exact file locations), you can rely entirely on Guciravel without enabling `preventLazyLoading()`.

### 3. SPA &amp; API Compatibility

[](#3-spa--api-compatibility)

Guciravel is designed **exclusively** to inject pure HTML pages.

- If your application is serving API responses (JSON), Guciravel will silently step aside to prevent breaking your JSON structure.
- If you are using the **TurboBlade** library, Guciravel is fully compatible and its alert panel will persist seamlessly across page navigations.

---

🏛️ Enterprise Architecture &amp; Zero-PDO Overhead
--------------------------------------------------

[](#️-enterprise-architecture--zero-pdo-overhead)

Guciravel uses an **Event-Driven Interceptor** architecture (`Illuminate\Support\Facades\Event::listen(QueryExecuted::class)`).

- **No Unnecessary Database Connections:** Unlike traditional libraries that bind directly to `DB::listen` (which can force an eager PDO database connection initialization during package booting), Guciravel listens to the Laravel Event Dispatcher.
- **Safe CLI &amp; Standalone Fallback:** The execution stack tracer uses `function_exists('base_path')` with fallback to `getcwd()`, ensuring 100% safety when running standalone unit tests or external CLI scripts.

---

🧪 Testing &amp; Verification
----------------------------

[](#-testing--verification)

Guciravel comes with a complete automated test suite powered by **PHPUnit 10** and **Orchestra Testbench 9**.

To run the verification suite locally:

```
# 1. Install development dependencies
composer install

# 2. Run the test suite
composer test
# or
vendor/bin/phpunit
```

The test suite covers:

- **Unit Tests:** Threshold limits (queries ≤ 3 ignored), duplicate SQL hash detection, and 1,000-query RAM memory protection.
- **Integration Tests:** Middleware HTML injection before ``, JSON API non-interference, and Gzip binary stream protection.

---

👨‍💻 Author
----------

[](#‍-author)

**Rafly A.R**📧 Email: 📸 Instagram: [@galaxy\_scream](https://instagram.com/galaxy_scream)

---

📜 License
---------

[](#-license)

This library is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance100

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

2d ago

### Community

Maintainers

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

---

Top Contributors

[![ginganomercy](https://avatars.githubusercontent.com/u/155315911?v=4)](https://github.com/ginganomercy "ginganomercy (12 commits)")

### Embed Badge

![Health badge](/badges/jati-guciravel/health.svg)

```
[![Health](https://phpackages.com/badges/jati-guciravel/health.svg)](https://phpackages.com/packages/jati-guciravel)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3345.3M348](/packages/psalm-plugin-laravel)[laravel/ai

The official AI SDK for Laravel.

1.0k3.2M250](/packages/laravel-ai)[illuminate/queue

The Illuminate Queue package.

20432.6M1.7k](/packages/illuminate-queue)[api-platform/laravel

API Platform support for Laravel

58174.6k17](/packages/api-platform-laravel)[pressbooks/pressbooks

Pressbooks is an open source book publishing tool built on a WordPress multisite platform. Pressbooks outputs books in multiple formats, including PDF, EPUB, web, and a variety of XML flavours, using a theming/templating system, driven by CSS.

45444.2k1](/packages/pressbooks-pressbooks)[simplestats-io/laravel-client

Server-side analytics for Laravel that follows the full funnel from visit to registration to payment, attributed to the channel that drove it. Revenue, MRR, churn and ad-spend profit (ROAS/CAC) per channel. GDPR compliant, ad-blocker proof.

5022.6k](/packages/simplestats-io-laravel-client)

PHPackages © 2026

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