Debug PHP Smarter, Not Harder: Introducing Buggregator

Pavel Buchnev
5 min readApr 22, 2024

--

Hey there! Have you ever found yourself juggling multiple debugging tools, struggling to keep track of logs from various services? That was exactly my situation, so I built Buggregator.

Before we dive in, let’s take a moment to watch an introductory video about Buggregator Server. It shows how Buggregator simplifies application debugging efficiently.

The Inspiration

My journey with Buggregator started when I was exploring the capabilities of the Ray app. As much as I admired Ray, I saw an opportunity to create something similar but slightly different, akin to how MailHog operates for SMTP testing. I wanted a tool that matched existing functionalities and added unique features, accessible to everyone for free.

What Buggregator Offers

It is a free, versatile tool that combines various debugging and monitoring features into one platform. It works seamlessly with the libraries you already use, like Ray, Symfony/VarDumper, Monolog, and Sentry.

The goal? Simplify integration and provide a central server to manage and display all data from your project’s libraries.

It stands out for several reasons that make it a compelling choice for developers, especially those working in complex or distributed environments.

What makes it special

  1. Unified Debugging Dashboard

Aggregates logs, dumps, and other debug info into one interface, perfect for managing multiple services.

2. Cross-Service Debugging

View and interact with data across different services without toggling between tools.

3. Real-Time Monitoring on Various Devices

Access Buggregator’s GUI on tablets, monitoring debug info in real-time.

4. Ease of Access and Use

Integrate Buggregator into your Docker development infrastructure, routing all debug info to Buggregator’s server.

5. Kubernetes Compatibility

Deploy Buggregator in a Kubernetes cluster to enhance debugging and operational efficiency.

6. SSO Support

Secure access with Single Sign-On (SSO) from providers like Auth0 or Kinde.

7. External Database Support

The flexibility to configure it with external databases like MySQL or PostgreSQL.

8. Open Source and Customizable

Free to use, modify, and enhance, fostering continuous improvement through community contributions.

9. Cost-Effective

Free for developers at all levels, from individuals to large enterprises.

How it Works

  1. HTTP Server: This server handles several types of requests:
    - HTTP Dump Requests: It displays all the data you send to Buggregator, including methods, body, URL, headers, etc.
    - Sentry Exceptions: If your application throws an error, Sentry client sends the details to a specific URL which you can point to a server.
    - Dumps from the spatie/ray Package: After setting up this package, you can send data dumps to a server using the ray function.
    - xhprof PHP Profiler: It receives profiling data from xhprof to help visualize where your PHP application might be slowing down.
    - Inspector.dev Code Execution Monitoring: A client can send execution profiles to a server, showing a timeline of what your application is doing. This helps identify parts of your code that could be optimized.
  2. TCP Server on Port 9912: This is for receiving data from the symfony/var-dumper package. This tool can not only display data dumps directly in your browser or console but also send them to a server.
  3. SMTP Server on Port 1025: Buggregator lets you test email functionalities in your applications without using external email servers. Just send your emails to this port to see all the details about them.
  4. TCP Server on Port 9913: It can receive logs sent from your PHP applications using the monolog/monolog package.

How to Set Up Clients

To connect your applications to Buggregator, you simply need to configure a few settings in the client applications.

Here’s how you can do it for a couple of popular packages:

  1. For the symfony/var-dumper package

You just need to set a couple of environment variables. Add these lines to your .env file:

VAR_DUMPER_FORMAT=server  
VAR_DUMPER_SERVER=127.0.0.1:9912

2. For sending Sentry exceptions from a Laravel application:

Again, you need to update your .env file with the following line to direct Sentry to send exceptions to your server:

SENTRY_LARAVEL_DSN=http://sentry@127.0.0.1:8000/1

Setting up clients to send data to a server is easy and quick, allowing you to integrate seamlessly and start monitoring and debugging without delay.

Read more about available integrations here.

Getting Started

Getting Buggregator up and running is super simple! Just make sure Docker is installed on your server. Then, run this command in your terminal:

GUI with received dumps
docker run 
-p 8000:8000
-p 1025:1025
-p 9912:9912
-p 9913:9913
ghcr.io/buggregator/server:latest

Read more about installation and configuration here.

Key Technologies

It’s built on a foundation of robust and reliable technologies, including the Spiral Framework, RoadRunner, and Centrifugo.

  • Spiral Framework — A PHP framework that’s the foundation of our server.
  • RoadRunner — Manages different server tasks like HTTP, TCP, queues, and caching.
  • Centrifugo — Handles real-time messaging through WebSockets.
  • VueJs 3 — This framework builds the interactive user interface.
  • TailwindCSS — Styles the frontend, making it look good and responsive.
  • Storybook — Helps us develop and organize UI components.

Buggregator Trap

We also offer a lightweight version called Trap, a minified version of the Server in a PHP composer package.

To install it in your PHP application:

composer require --dev buggregator/trap -W

And that’s it. Trap is ready to go. To start the Trap server:

vendor/bin/trap

Trap operates on port 9912 by default but can be adjusted with the -p option. For example:

vendor/bin/trap -p8000

Sometimes, it’s convenient to run Trap on the same ports that Server uses by default. Well, that’s also possible:

vendor/bin/trap -p1025 -p9912 -p9913 -p8000 --ui=8080

The --ui option flag is a powerful feature that allows you to specify a port for the web interface of the Trap server. This web interface provides a user-friendly way to view and manage your debug information in real-time.

Trap is a valuable addition to your development toolkit. It offers a streamlined and efficient way to handle debugging in PHP applications.

Being open-source and easy to use, Trap is a must-have for any PHP developer.

Contributing to Buggregator

I’m excited to invite you to contribute to the project! Your involvement is crucial, whether it’s reporting bugs, suggesting new features, or any other form of contribution. To get started, simply create an issue or submit a pull request on our GitHub repository.

In our repository, we categorize issues that are open for community contribution using the for contributors label. This makes it easier for you to find ways to participate.

Additionally, we use labels such as c:easy, c:medium, and c:difficult to indicate the complexity level of issues, helping you choose tasks that match your skill level.

Remember, every expert was once a beginner. Contributing to open source is a valuable step in your development journey.

We appreciate any contributions to help make Buggregator better!

Visit Buggregator’s website for more info.

--

--

Pavel Buchnev

Senior PHP Developer | Contributor to Spiral Framework 🚀 | Enthusiast of RoadRunner & long-running applications | Creator of Buggregator