Skip to content
This repository has been archived by the owner on May 20, 2023. It is now read-only.
/ laravel-app Public archive

The old version of Buggregator, which uses Laravel framework, is no longer being actively developed. The new beta version, built with Spiral framework, is now available at https://github.com/buggregator/spiral-app and offers significant improvements in performance and stability, as well as a lighter docker image size of around 300mb.

License

Notifications You must be signed in to change notification settings

buggregator/laravel-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hello dear developer!

The old version of Buggregator, which uses Laravel framework, is no longer being actively developed. The new beta version, built with Spiral framework, is now available at https://github.com/buggregator/spiral-app and offers significant improvements in performance and stability, as well as a lighter docker image size of around 300mb. It also includes xhprof support for profiling PHP applications. Developers are encouraged to switch to the new version for the best debugging experience.

Stay tuned for the upcoming stable release!


A server for debugging PHP applications and more.

Support me on Patreon StyleCI build Downloads Twitter Join to our telegram

Frame 2

Buggregator is a beautiful, lightweight standalone server built on Laravel, VueJs and RoadRunner underhood, that helps debugging mostly PHP applications without extra packages. It runs without installation on multiple platforms via docker and supports symfony var-dumper, monolog, sentry, smtp, inspector and spatie ray package.

Contents

  1. Features
  2. Installation
  3. Configuration
  4. Contributing
  5. License

Buggregator

1. Symfony VarDumper server

The 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).

Installation

composer require --dev symfony/var-dumper

Settings

Env variables

// Laravel
VAR_DUMPER_FORMAT=server
VAR_DUMPER_SERVER=127.0.0.1:9912

// Plain PHP
$_SERVER['VAR_DUMPER_FORMAT'] = 'server';
$_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.

Settings

Env variables

// Laravel
MAIL_MAILER=smtp
MAIL_HOST=127.0.0.1
MAIL_PORT=1025

// Symfony
MAILER_DSN=smtp://127.0.0.1:1025

3. Compatible with Sentry reports

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).

Laravel settings

Laravel is supported via a native package. You can read about integrations on official site

// DSN for the Buggregator
SENTRY_LARAVEL_DSN=http://[email protected]:23517/1

Other platforms

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


4. Monolog server

Buggregator can display dump output in the browser as well as in a terminal (console output). Buggregator can receive logs from monolog/monolog package via \Monolog\Handler\SlackWebhookHandler or \Monolog\Handler\SocketHandler handler.

Laravel settings for SlackWebhookHandler

Env variables

LOG_CHANNEL=slack
LOG_SLACK_WEBHOOK_URL=http://127.0.0.1:23517/slack

Laravel settings for SocketHandler

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

Other PHP frameworks

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');

5. Compatible with Inspector reports

Buggregator can be used to receive Inspector events from your application. Buggregator is a lightweight alternative for local development. Just configure Inspector client URL to send data to Buggregator. It can display dump output in the browser as well as in a terminal (console output).

Laravel settings

Laravel is supported via a native package. You can read about integrations on official site

INSPECTOR_URL=http://127.0.0.1:23517/inspector
INSPECTOR_API_KEY=test
INSPECTOR_INGESTION_KEY=1test
INSPECTOR_ENABLE=true

Other platforms

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://127.0.0.1:23517/inspector');
$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. You can find out documentation on official site


6. 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. 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

7. HTTP Requests dump server

Buggregator can receive HTTP requests and store them for inspection.

Laravel settings

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

RAY_HOST=127.0.0.1  # Ray server host
RAY_PORT=23517      # Ray server port

Framework agnostic PHP

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' => '127.0.0.1',

    /*
     *  The port number used to communicate with the Ray app. 
     */
    'port' => 23517,
    
    /*
     *  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

UI

Buggregator has a responsive design and a mobile device can be used as an additional screen for viewing event history. Also you can use a termial to collect dump output if you don't want to use a browser.

Buggregator devices


Technological stack

Installation

Docker image

You can run Buggregator via docker from Docker Hub or using the provided Dockerfile

Just run one of bash command

Latest stable release

docker run --pull always -p 23517:8000 -p 1025:1025 -p 9912:9912 -p 9913:9913 butschster/buggregator:latest

Latest beta release

docker run --pull always -p 23517:8000 -p 1025:1025 -p 9912:9912 -p 9913:9913 butschster/buggregator:beta

You can omit --pull always argument if your docker-compose doesn't support it.

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

Using buggregator with docker compose

// docker-compose.yml
version: "2"
services:
    ...

    buggregator:
        image: butschster/buggregator:latest
        ports:
        - 23517:8000
        - 1025:1025
        - 9912:9912
        - 9913:9913

Authentication

By default Buggregator doesn't use any authentication, but you can enable it via ENV variables.

AUTH_ENABLED=true
AUTH_USERNAME=admin
AUTH_PASSWORD=secret

Example

docker run --pull always --env AUTH_ENABLED=true --env AUTH_USERNAME=admin --env AUTH_PASSWORD=secret -p 23517:8000 -p 1025:1025 -p 9912:9912 -p 9913:9913 butschster/buggregator:latest

or

// docker-compose.yml
version: "2"
services:
    ...

    buggregator:
        image: butschster/buggregator:latest
        ports:
        - 23517:8000
        - 1025:1025
        - 9912:9912
        - 9913:9913
        environment:
            AUTH_ENABLED: false
            AUTH_USERNAME: admin
            AUTH_PASSWORD: secret

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

or

// docker-compose.yml
version: "2"
services:
    ...

    buggregator:
        image: butschster/buggregator:latest
        ports:
        - 23517:8000
        - 1025:1025
        - 9912:9912
        - 9913:9913
        environment:
            CLI_SMTP_STREAM: false
            CLI_RAY_STREAM: false

That's it. Now you open http://127.0.0.1:23517 url in your browser or open 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.

Backend part

Server requirements

  1. PHP 8.0

Installation

  1. Clone repository git clone https://github.com/buggregator/app.git
  2. Run composer composer install
  3. Run migrations php artisan app:configure
  4. Download RoadRunner binary vendor/bin/rr get-binary
  5. Run RoadRunner server ./rr serve

Frontend part

Server requirements

  1. NodeJS
  2. IntertiaJS
  3. TailwindCSS

Installation

  1. Run npm npm i
  2. Build npm npm run watch - for development
  3. Build npm npm run prod - for production

Code samples

Code samples of configured Laravel application ready to send data to Buggregator you can find here.

Articles


License

Buggregator is open-sourced software licensed under the MIT license.

About

The old version of Buggregator, which uses Laravel framework, is no longer being actively developed. The new beta version, built with Spiral framework, is now available at https://github.com/buggregator/spiral-app and offers significant improvements in performance and stability, as well as a lighter docker image size of around 300mb.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published