PHPackages                             rayzenai/ray - 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. [Debugging &amp; Profiling](/categories/debugging)
4. /
5. rayzenai/ray

ActiveLibrary[Debugging &amp; Profiling](/categories/debugging)

rayzenai/ray
============

A lightweight Ray-like debugging tool for Laravel applications

v1.0.0(4mo ago)1488MITBladePHP ^8.2

Since Jan 4Pushed 4mo agoCompare

[ Source](https://github.com/rayzenai/ray)[ Packagist](https://packagist.org/packages/rayzenai/ray)[ RSS](/packages/rayzenai-ray/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (3)Versions (2)Used By (0)

Ray Debug for Laravel
=====================

[](#ray-debug-for-laravel)

A lightweight Ray-like debugging tool for Laravel applications with a web-based debug viewer.

Features
--------

[](#features)

- `ray()` helper function for quick debugging
- Automatic slow query logging (configurable threshold)
- Request profiling middleware (N+1 detection, memory usage)
- Web-based debug viewer at `/debug/ray`
- Color-coded entries (red, orange, yellow, green, blue)
- Configurable access control via email whitelist

Requirements
------------

[](#requirements)

- PHP 8.2+
- Laravel 11 or 12

Installation
------------

[](#installation)

```
composer require rayzenai/ray
```

Configuration
-------------

[](#configuration)

Publish the config file:

```
php artisan vendor:publish --tag=ray-config
```

This creates `config/ray.php`:

```
return [
    // Define allowed users by email
    // Use ['*'] to allow all authenticated users
    'allowed_emails' => [
        // '*',
        // 'admin@example.com',
    ],

    // User model configuration (for apps with custom user tables)
    'user_model' => \App\Models\User::class,
    'user_email_field' => 'email',

    // Queries slower than this (ms) are auto-logged
    'slow_query_threshold' => 100,

    // Max debug entries to keep
    'max_entries' => 100,

    // Storage location
    'storage_path' => storage_path('logs/ray-debug.json'),
];
```

Usage
-----

[](#usage)

### Basic Debugging

[](#basic-debugging)

```
// Simple debug
ray($variable);

// With label
ray('user data', $user);

// With colors
ray($data)->red();
ray($data)->green();
ray($data)->blue();
ray($data)->yellow();
ray($data)->orange();

// Chained
ray($data)->label('My Label')->green();
```

### Static Methods

[](#static-methods)

```
// Semantic logging
Ray::error($data);    // Red
Ray::warning($data);  // Yellow
Ray::success($data);  // Green
Ray::info($data);     // Blue

// Performance
Ray::measure('label');        // Start timer
// ... code ...
Ray::measure('label');        // Stop & log elapsed time

Ray::memory();                // Log memory usage

// Debugging
Ray::trace();                 // Log stack trace
Ray::caller();                // Log caller info

// Query logging
Ray::showQueries();           // Start logging all queries
Ray::showSlowQueries(50);     // Log queries > 50ms
Ray::stopQueries();           // Stop logging
Ray::querySummary();          // Get query stats
```

### Counter

[](#counter)

```
// Count iterations
foreach ($items as $item) {
    Ray::count('loop');       // Increments each call
}

Ray::resetCount('loop');      // Reset counter
```

### Die &amp; Dump

[](#die--dump)

```
ray($data)->die();            // Log and exit

// Or use helper
rayDie($data, 'label');
```

Request Profiler Middleware
---------------------------

[](#request-profiler-middleware)

Add the middleware to log slow requests and detect N+1 queries:

```
// app/Http/Kernel.php
protected $middlewareGroups = [
    'web' => [
        // ... other middleware
        \RayzenAI\Ray\Middleware\RayRequestProfiler::class,
    ],
];
```

The profiler automatically logs:

- Requests taking &gt; 100ms
- Requests using &gt; 25MB memory
- N+1 query detection (same query 3+ times)

Debug Viewer
------------

[](#debug-viewer)

Access the debug viewer at `/debug/ray` (local environment only).

Features:

- Tabs: Debug, Requests, Queries
- Color filters
- Search
- Auto-refresh toggle
- Expand/collapse entries
- Copy to clipboard
- Delete individual entries or clear all

Security
--------

[](#security)

The package only works in `local` environment. Access is controlled by:

1. **Empty config** - Shows error message prompting configuration
2. **Wildcard `['*']`** - Allows all authenticated users
3. **Email list** - Only specified emails can access

License
-------

[](#license)

MIT

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance75

Regular maintenance activity

Popularity18

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 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

134d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/351e3224dcfda5f2fc1a86fb6424f60a9a060a39c938c6338a244d01912e077d?d=identicon)[kiran1991](/maintainers/kiran1991)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/rayzenai-ray/health.svg)

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

###  Alternatives

[barryvdh/laravel-debugbar

PHP Debugbar integration for Laravel

19.2k124.3M624](/packages/barryvdh-laravel-debugbar)[livewire/livewire

A front-end framework for Laravel.

23.5k75.5M1.8k](/packages/livewire-livewire)[fruitcake/laravel-debugbar

PHP Debugbar integration for Laravel

19.1k662.9k29](/packages/fruitcake-laravel-debugbar)[spatie/laravel-ray

Easily debug Laravel apps

31738.4M2.8k](/packages/spatie-laravel-ray)[recca0120/laravel-tracy

A Laravel Package to integrate Nette Tracy Debugger

388283.0k3](/packages/recca0120-laravel-tracy)[api-platform/laravel

API Platform support for Laravel

59126.4k6](/packages/api-platform-laravel)

PHPackages © 2026

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