Buggregator is a lightweight, standalone server that offers a range of debugging features for PHP applications. Built using the reliable Spiral Framework, the powerful NuxtJs, and the speedy RoadRunner under the hood. It's a versatile tool that can be run on multiple platforms via Docker.
Whether you're an experienced developer or just starting, Buggregator offers essential features like Xhprof, Symfony var-dumper, Monolog, Sentry, SMTP catcher, andInspector that make it easy to identify and resolve issues. With no additional packages required, it's effortless to use, making it a must-have tool in your development arsenal.
In this section, we'll explore the different features that Buggregator supports and how they can help you identify and resolve issues with your application.
The Xhprof profiler is an essential feature of Buggregator that offers a lightweight and hierarchical profiling solution for PHP applications. It uses instrumentation to keep track of call counts and inclusive metrics for arcs in the dynamic callgraph of your program during the data collection phase. In the reporting and post-processing phase, the profiler computes exclusive metrics such as wall (elapsed) time, CPU time, and memory usage.
With the Xhprof profiler, you can easily identify performance bottlenecks and optimize your application's code for better efficiency. So, if you're looking to fine-tune your PHP application's performance, the Xhprof profiler is the perfect tool for the job.
- Install Xhprof extension One of the way to install Xhprof is to use PECL package.
pear channel-update pear.php.net
pecl install xhprof
- Install the package
If you are using Spiral Framework you just need to install the spiral/profiler package.
composer require --dev spiral/profiler:^3.0
After installing the package, you need to configure it. The package provides predefined environment variables to configure the profiler.
PROFILER_ENDPOINT=http://[email protected]:8000
PROFILER_APP_NAME=My super app
Note: Read more about package usage in the package documentation.
Buggregator is fully compatible with the
Symfony VarDumper component, which is an
essential feature for debugging PHP applications. By default, the dump()
and dd()
functions output their contents
in the same browser window or console terminal as your own application. This can be confusing at times, as it mixes the
real output with the debug output.
With Buggregator, however, you can easily collect all the dumped data, making it simpler to identify and isolate issues. So, whether you're an experienced developer or just starting, the Symfony VarDumper server in Buggregator is an essential tool to have in your development arsenal.
composer require --dev symfony/var-dumper
You should change dumper format to server
for var-dumper component. There is a VAR_DUMPER_FORMAT
env variable in the
package to do it.
VAR_DUMPER_FORMAT=server
VAR_DUMPER_SERVER=127.0.0.1:9912 # Default value
via PHP
// Plain PHP
$_SERVER['VAR_DUMPER_FORMAT'] = 'server';
$_SERVER['VAR_DUMPER_SERVER'] = '127.0.0.1:9912';
Buggregator is more than just a PHP debugging tool. It also includes a powerful email testing feature that allows you to install and configure a local email server with ease.
For example, you can configure a local WordPress site to use Buggregator's SMTP server for email deliveries. This makes it effortless to test email functionality during the development phase, ensuring that everything works as expected before deployment. So, if you're looking for a reliable and easy-to-use email testing tool, Buggregator's fake SMTP server is the way to go.
Env variables
// Spiral Framework or Symfony
MAILER_DSN=smtp://127.0.0.1:1025
# Laravel
MAIL_MAILER=smtp
MAIL_HOST=127.0.0.1
MAIL_PORT=1025
4. Compatible with Sentry reports
Buggregator offers seamless integration with Sentry reports, making it a reliable tool for local development. With it, you can easily configure your Sentry DSN to send data directly to the server, providing you with a lightweight alternative for debugging your application.
By using Buggregator to receive Sentry reports, you can identify and fix issues with your application before deploying it to production. This ensures that your application is robust and efficient, providing a smooth experience for your users. So, if you're looking for an easy and efficient way to receive Sentry reports during local development, Buggregator is the perfect tool for you.
Spiral Framework is supported via a native package. You can read about integrations on official site
SENTRY_DSN=http://[email protected]:8000/1
Laravel is supported via a native package. You can read about integrations on official site
SENTRY_LARAVEL_DSN=http://[email protected]:8000/1
To report to Buggregator you’ll need to use a language-specific SDK. The Sentry team builds and maintains these for most popular languages.
You can find out documentation on official site
5. Monolog server
Buggregator comes with a powerful Monolog server that can receive logs from the popular monolog/monolog
package via
the \Monolog\Handler\SocketHandler
handler. With this feature, you can easily track and analyze the logs generated by
your PHP application, making it easier to identify issues and improve its overall performance.
By using Buggregator's Monolog server, you can gain valuable insights into your application's behavior and improve its overall efficiency. So, whether you're a seasoned developer or just starting, the Monolog server in Buggregator is a must-have tool for anyone serious about PHP development.
You can register socket handler for monolog via bootloader.
Bootloader example
<?php
declare(strict_types=1);
namespace App\Bootloader;
use Monolog\Formatter\JsonFormatter;
use Monolog\Handler\SocketHandler;
use Spiral\Boot\Bootloader\Bootloader;
use Spiral\Boot\EnvironmentInterface;
use Spiral\Monolog\Bootloader\MonologBootloader;
class LoggingBootloader extends Bootloader
{
public function init(MonologBootloader $monolog, EnvironmentInterface $env): void
{
$handler = new SocketHandler($env->get('MONOLOG_SOCKET_HOST'), chunkSize: 10);
$handler->setFormatter(new JsonFormatter(JsonFormatter::BATCH_MODE_NEWLINES));
$monolog->addHandler('socket', $handler);
}
}
Env variables
MONOLOG_DEFAULT_CHANNEL=socket
MONOLOG_SOCKET_HOST=127.0.0.1:9913
Config
// config/logging.php
return [
// ...
'channels' => [
// ...
'socket' => [
'driver' => 'monolog',
'level' => env('LOG_LEVEL', 'debug'),
'handler' => \Monolog\Handler\SocketHandler::class,
'formatter' => \Monolog\Formatter\JsonFormatter::class,
'handler_with' => [
'connectionString' => env('LOG_SOCKET_URL', '127.0.0.1:9913'),
],
],
],
];
Env variables
LOG_CHANNEL=socket
LOG_SOCKET_URL=127.0.0.1:9913
Install monolog
composer require monolog/monolog
<?php
use Monolog\Logger;
use Monolog\Handler\SocketHandler;
use Monolog\Formatter\JsonFormatter;
// create a log channel
$log = new Logger('buggregator');
$handler = new SocketHandler('127.0.0.1:9913');
$handler->setFormatter(new JsonFormatter());
$log->pushHandler($handler);
// Send records to the Buggregator
$log->warning('Foo');
$log->error('Bar');
6. Compatible with Inspector reports
Buggregator is also compatible with Inspector reports, providing you with a lightweight alternative for local development. With it, you can easily configure your Inspector client URL to send data directly to the server, making it easier to identify and fix issues during the development phase.
Laravel is supported via a native package. You can read about integrations on official site
INSPECTOR_URL=http://[email protected]:8000
INSPECTOR_API_KEY=test
INSPECTOR_INGESTION_KEY=1test
INSPECTOR_ENABLE=true
For PHP you can use inspector-apm/inspector-php
package.
use Inspector\Inspector;
use Inspector\Configuration;
$configuration = new Configuration('YOUR_INGESTION_KEY');
$configuration->setUrl('http://[email protected]:8000');
$inspector = new Inspector($configuration);
// ...
To report to Buggregator you’ll need to use a language-specific SDK. The Inspector team builds and maintains these for most popular languages.
Note: You can find out documentation on official site
It's an indispensable tool that simplifies the process of capturing, analyzing, and debugging HTTP requests in their applications. With the HTTP Requests Dump Server, developers can effortlessly capture all the relevant request data and gain valuable insights. They can dive deep into the captured requests, examine their contents, and pinpoint any issues or anomalies that might be affecting their application's performance.
Simply start the server and send your requests to the http://[email protected]:8000
URL, it will not only
capture the URI segments but also gather additional details such as the request headers
, cookies
, POST data
,
query strings
, and any uploaded files
.
For instance, let's say you have a POST request: http://[email protected]:8000/user/3/update
. In this case,
server will intercept the request and capture all the relevant information. It will then display the
dumped data, allowing you to examine the request details, including the URI segments (user/3/update
in this example).
8. Spatie Ray debug tool
Buggregator is compatible with spatie/ray
package. The Ray debug tool supports PHP, Ruby, JavaScript, TypeScript,
NodeJS, Go and Bash applications. After installing one of the libraries, you can use the ray function to quickly dump
stuff. Any variable(s) that you pass will be sent to the Buggregator.
Supported features: Simple data, Labels, Caller, Trace, Counter, Class name of an object, Measure, Json, Xml, Carbon, File, Table, Image, Html, Text, Notifications, Phpinfo, Exception, Show queries, Count queries, Show events, Show jobs, Show cache, Model, Show views, Markdown, Collections, Env, Response, Request, Application log, Show Http client requests
Please make sure ray.php
config published to the project root.
You can run an artisan command to publish it in to the project root.
php artisan ray:publish-config
Env variables
[email protected] # Ray server host (Current HTTP buggregator port)
RAY_PORT=8000 # Ray server port
In framework agnostic projects you can use this template as the ray config file.
<?php
// Save this in a file called "ray.php"
return [
/*
* This settings controls whether data should be sent to Ray.
*/
'enable' => true,
/*
* The host used to communicate with the Ray app.
*/
'host' => '[email protected]',
/*
* The port number used to communicate with the Ray app.
*/
'port' => 8000,
/*
* Absolute base path for your sites or projects in Homestead, Vagrant, Docker, or another remote development server.
*/
'remote_path' => null,
/*
* Absolute base path for your sites or projects on your local computer where your IDE or code editor is running on.
*/
'local_path' => null,
/*
* When this setting is enabled, the package will not try to format values sent to Ray.
*/
'always_send_raw_values' => false,
];
You can find out more information about installation and configuration on official site
- Spiral Framework
- RoadRunner Http, Websocket, TCP, Queue, Cache server in one bottle
- NuxtJs 3
- VueJs 3
- TailwindCSS
- Storybook
To run Buggregator using docker, you can use the docker image available on Github Packages
Latest stable release
To run the latest stable release, use the following command:
docker run --pull always -p 8000:8000 -p 1025:1025 -p 9912:9912 -p 9913:9913 ghcr.io/buggregator/server:latest
Latest dev release
To run the latest development release, use the following command:
docker run --pull always -p 8000:8000 -p 1025:1025 -p 9912:9912 -p 9913:9913 ghcr.io/buggregator/server:dev
Note: You can omit
--pull always
argument if your docker-compose doesn't support it.
Specific version
To run a specific version of Buggregator, use the following command:
docker run -p 8000:8000 -p 1025:1025 -p 9912:9912 -p 9913:9913 ghcr.io/buggregator/server:v1.00
Note: You can omit unused ports if you only use, for example,
symfony/var-dumper
.
docker run --pull always -p 9912:9912 ghcr.io/buggregator/server:latest
You can also use Buggregator with Docker Compose. Add the following service definition to
your docker-compose.yml
file:
services:
# ...
buggregator:
image: ghcr.io/buggregator/server:dev
ports:
- 8000:8000
- 1025:1025
- 9912:9912
- 9913:9913
After that, you can open http://127.0.0.1:8000 in your browser and start collecting dumps from your application.
Enjoy!
Contributing to open source projects like Buggregator can be a rewarding experience, and we welcome contributions from the community. There are several issues in this repo with unresolved issues, and it would be great if you help a community solving them.
We appreciate any contributions to help make Buggregator better!*
- PHP 8.1
- Clone repository
git clone https://github.com/buggregator/spiral-app.git
- Install backend dependencies
composer install
- Download RoadRunner binary
vendor/bin/rr get-binary
- Install frontend dependencies
cd frontend && yarn install
- Install Centrifugo server
cd bin && ./get-binaries.sh
- Run RoadRunner server
./rr serve
Buggregator is open-sourced software licensed under the MIT license.