A server for debugging more than just Laravel applications.
Buggregator is a beautiful, lightweight web server built on Laravel and VueJs that helps debugging your app. It runs without installation on multiple platforms via docker and supports symfony var-dumper, monolog, sentry, smtp and spatie ray package.
Contents
Features
VarDumper server
1. SymfonyThe dump()
and dd()
functions output its contents in the same browser window or console terminal as your own application. Sometimes mixing the real output with the debug output can be confusing. That’s why this Buggregator can be used to collect all the dumped data. Buggregator can display dump output in the browser as well as in a terminal (console output).
Example
VAR_DUMPER_FORMAT=server
VAR_DUMPER_SERVER=127.0.0.1:9912
2. Fake SMTP server for catching mail
Buggregator also is an email testing tool that makes it super easy to install and configure a local email server (Like MailHog). Buggregator sets up a fake SMTP server and you can configure your preferred web applications to use Buggregator’s SMTP server to send and receive emails. For instance, you can configure a local WordPress site to use Buggregator for email deliveries.
Example
MAIL_MAILER=smtp
MAIL_HOST=127.0.0.1
MAIL_PORT=1025
3. Compatible with Sentry
Buggregator can be used to receive Sentry reports from your application. Buggregator is a lightweight alternative for local development. Just configure Sentry DSN to send data to Buggregator. It can display dump output in the browser as well as in a terminal (console output).
Simple example SENTRY_LARAVEL_DSN=http://[email protected]:23517/1
.
Monolog
4. Compatible withBuggregator can receive logs from monolog/monolog
package via \Monolog\Handler\SlackWebhookHandler
or \Monolog\Handler\SocketHandler
handler. Buggregator can display dump output in the browser as well as in a terminal (console output).
Example
LOG_CHANNEL=slack
LOG_SLACK_WEBHOOK_URL=http://127.0.0.1:23517/slack
Ray debug tool
5. SpatieBuggregator 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. Buggregator can display dump output in the browser as well as in a terminal (console output).
Supported features: Simple data, Colors, Sizes, Labels, New screen, Clear all, Caller, Trace, Pause, 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, Ban, Charles, Remove, Hide/Show events, Application log, Show Http client requests, Mailable
Read more about spatie/ray
package.
Example
RAY_HOST=127.0.0.1 # Ray server host
RAY_PORT=23517 # Ray server port
It is a free alternative of The Ray app for those who want to run a server without GUI, cannot afford the paid version or just like open source.
But it doesn’t mean you shouldn’t support spatie’s packages!
UI
Buggregator has a responsive design and a mobile device can be used as an additional screen for viewing event history. Also you can user a termial to collect dump output if you don't want to use a browser.
Code samples
Code samples of configured Laravel application ready to send data to Buggregator you can find here.
Articles
- A server for debugging more than just Laravel applications..
- Сервер для дебага Laravel приложений и не только.
Technological stack
- Laravel 8
- InertiaJs
- Swoole Http/Websocket/TCP server
- Vue
- TailwindCSS
Installation
Docker image
You can run Buggregator via docker from Docker Hub or using the provided Dockerfile
Just run on bash command
docker run --pull always -p 23517:8000 -p 1025:1025 -p 9912:9912 -p 9913:9913 butschster/buggregator:latest
# --pull always - optional option checks latest version on every running. You can omit it
# or specific version
docker run -p 23517:8000 -p 1025:1025 -p 9912:9912 -p 9913:9913 butschster/buggregator:v1.18
# You can omit unused ports if you use, for example, only var-dumper
docker run --pull always -p 9912:9912 butschster/buggregator:latest
You can omit unused ports
If you don't want to see dump output in your terminal, you can disable it through ENV variables:
CLI_SMTP_STREAM=false
CLI_VAR_DUMPER_STREAM=false
CLI_SENTRY_STREAM=false
CLI_RAY_STREAM=false
CLI_MONOLOG_STREAM=false
Example
docker run --pull always --env CLI_SMTP_STREAM=false --env CLI_SENTRY_STREAM=false -p 23517:8000 -p 1025:1025 -p 9912:9912 -p 9913:9913 butschster/buggregator:latest
Docker compose
// docker-compose.yml
version: "2"
services:
debugger:
image: butschster/buggregator:latest
environment:
DB_CONNECTION: pgsql
DB_HOST: db
DB_DATABASE: homestead
DB_USERNAME: homestead
DB_PASSWORD: secret
ports:
- 23517:8000
- 1025:1025
- 9912:9912
- 9913:9913
Configuration
- Configure your .env for VarDumper
VAR_DUMPER_FORMAT=server
VAR_DUMPER_SERVER=127.0.0.1:9912
- Configure your .env for mail
MAIL_MAILER=smtp
MAIL_HOST=127.0.0.1
MAIL_PORT=1025
- Configure your .env for Sentry package
SENTRY_LARAVEL_DSN=http://[email protected]:23517/1
- Configure your .env for Ray package
RAY_HOST=127.0.0.1 # Debugger host
RAY_PORT=23517 # Debugger port
- Configure your .env for monolog logs
Socket
Add a new channel to config file config/logging.php
'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'),
],
],
]
the set default channel to socket
LOG_CHANNEL=socket
LOG_SOCKET_URL=127.0.0.1:9913
Slack
LOG_CHANNEL=slack
LOG_SLACK_WEBHOOK_URL=http://127.0.0.1:23517/slack
That's it. Now you open http://127.0.0.1:23517 url in your browser or terminal and collect dump output from your application.
Enjoy!
Contributing
There are several projects in this repo with unresolved issues and it would be great if you help a community solving them.
Server requirements
- PHP 8.0
- Swoole 4.7
- NodeJS
Installation
- Clone repository
- Run composer `composer install
- Run npm
npm i
- Run HTTP server
php artisan server:start --host=127.0.0.1 --port=23517
- Run SMTP server
php artisan smtp:start --host=127.0.0.1 --port=1025
- Run var-dumper server
php artisan dump-server:start --host=127.0.0.1 --port=9912
- Run monolog server
php artisan monolog:start --host=127.0.0.1 --port=9913
- Build npm
npm run prod
License
Buggregator is open-sourced software licensed under the MIT license.