DEV Community

Leon
Leon

Posted on

I built a free, open-source alternative to Spatie Ray — real-time PHP debugging in the browser

Code + Result of DebugPHPFor years I've been juggling var_dump(), Xdebug setups, and paying for tools like Spatie Ray ($49/year) just to see what my PHP app is doing. None of it felt right — either it broke the page, needed heavy IDE integration, or cost money for something that should be free.

So I built DebugPHP.


What it does

DebugPHP streams your debug output to a browser-based dashboard in real-time via Server-Sent Events. No page reloads. No desktop apps. No config hell. Just call Debug::send() and watch it appear.

use DebugPHP\Debug;

Debug::init('your-session-token');

Debug::send('User created!');
Debug::send($user, 'User')->color('blue');
Debug::send($exception, 'Error')->color('red');
Enter fullscreen mode Exit fullscreen mode

Why not just use Xdebug or Ray?

dd() / var_dump() Xdebug Spatie Ray DebugPHP
Real-time output
No page disruption
Zero config
Browser-based
Free & open source
No dependencies

Current features

Labels & Colors — categorize your entries visually:

Debug::send($query, 'SQL')->color('blue');
Debug::send($error, 'Error')->color('red');
Enter fullscreen mode Exit fullscreen mode

Timers — measure performance inline:

Debug::startTimer('db-query');
$results = $db->query('SELECT * FROM users');
Debug::stopTimer('db-query');
// → Dashboard shows: "db-query: 23.4ms"
Enter fullscreen mode Exit fullscreen mode

Toolbar Metrics — live key-value chips in the topbar, perfect for request-level data:

Debug::metric('Template', 'home.php');
Debug::metric('Memory', memory_get_usage(true) / 1024 / 1024 . 'MB');
Enter fullscreen mode Exit fullscreen mode

Metrics auto-disappear from the toolbar when you remove them from your code — no stale data.

Tables — render arrays as proper tables:

Debug::table([
    ['name' => 'Leon', 'role' => 'Developer'],
    ['name' => 'Sarah', 'role' => 'Designer'],
]);
Enter fullscreen mode Exit fullscreen mode

Pause / Resume / Clear — full control without touching your app.


Self-hostable

Don't want your debug data leaving your machine? The server component is fully open source too:

git clone https://github.com/CallMeLeon167/debugphp-server.git
cd debugphp-server
composer install
# Open /setup/ in the browser — the wizard does the rest
Enter fullscreen mode Exit fullscreen mode

Then just point the client at your own server:

Debug::init('your-token', [
    'host' => 'http://localhost:8080',
]);
Enter fullscreen mode Exit fullscreen mode

Technical details (for those who care)

  • PHP 8.1+ required, zero runtime dependencies (just ext-curl)
  • PHPStan Level 10 — the strictest static analysis level, fully passing
  • SSE-based push architecture — no WebSocket server needed, works on any standard Apache/nginx setup
  • Data is serialized with PHP's native serialize() + base64 for full type fidelity (objects, exceptions, nested structures all work)
  • Session tokens tie your app to your dashboard tab — multiple sessions work in parallel

Installation

composer require callmeleon167/debugphp --dev
Enter fullscreen mode Exit fullscreen mode

Requires PHP 8.1+ and ext-curl. That's it.


Status

Currently in pre-release — the core is working and the dashboard is functional, but I'm still polishing things before the public launch on GitHub.

If this sounds useful to you: feel free to open issues or drop feedback here. I'm especially curious whether the self-hosted setup flow works smoothly on different environments.


Built by a PHP dev, for PHP devs. MIT licensed.

Top comments (2)

Collapse
 
tyler36 profile image
tyler36

Sounds interesting but I can't see the repo from github.com/CallMeLeon167.

Collapse
 
callmeleon167 profile image
Leon

Hey, thanks for the heads up! The repo is still set to private — I'm planning to make it public right before the official launch. I'll drop a note here once it's live so you can check it out. 🙂