tighten / takeout

Docker-based development-only dependency manager. macOS, Linux, and WSL2-only and installs via PHP's Composer... for now.
MIT License
1.59k stars 83 forks source link

Adds Buggregator as a tool #334

Closed tonysm closed 5 months ago

tonysm commented 5 months ago

Added


Hat tip to @gcavanunez for pointing me to Buggregator.

Usage:

takeout enable buggregator

After answering the prompted questions (about where the web UI, the VarDumper server, the Monolog server port, and network alias), the service should run at localhost:8000 (unless you change the default port).

VarDumper Server

To start sending dump() calls to Buggregator, you may set the following configs on the Laravel app:

VAR_DUMPER_FORMAT=server
VAR_DUMPER_SERVER=127.0.0.1:9912
# VAR_DUMPER_SERVER=buggregator:9912 # If you're on Sail

Ray

First, on the Laravel app, require the Ray PHP client:

composer require spatie/laravel-ray --dev

Next, set the following configs:

RAY_HOST=ray@127.0.0.1
# RAY_HOST=ray@buggregator # If you're on Sail
RAY_PORT=8000

SMTP Server

To send emails, you may set the following configs on the Laravel app:

MAIL_MAILER=smtp
MAIL_HOST=127.0.0.1
# MAIL_HOST=buggregator # If you're on Sail
MAIL_PORT=1025

Profiler

Buggregator ships with an XHProf profiler. To use it, first install the xhprof extension via pecl:

pecl install xhprof

Then add the extension=xhprof.so to the php.ini. On Sail, you can do that with:

echo "extension=xhprof.so" >> /etc/php/8.3/cli/php.ini

Then, install the package:

composer require --dev maantje/xhprof-buggregator-laravel

Then, configure the profiler envs:

PROFILER_ENDPOINT=http://profiler@127.0.0.1:8000
# PROFILER_ENDPOINT=http://profiler@buggregator:8000 # If you're on Sail
PROFILER_APP_NAME="${APP_NAME}"
XHPROF_ENABLED=true

Sentry

First, install the package following sentry's docs.

Then, configure the Sentry DNS on the .env of your Laravel app:

SENTRY_LARAVEL_DSN=http://sentry@127.0.0.1:8000/1
# SENTRY_LARAVEL_DSN=http://sentry@buggregator:8000/1 # If you're on sail

These should serve as examples. There's also a nice monolog service, an inspector, and an HTTP dump server.

Notes on Sail

If you're using Takeout in combination with Sail, you can use the network_alias configured as the hostname (which defaults to buggregator) instead of 127.0.0.1. The Laravel app container must be added to the Takeout network. For more info, check out Matt's blog.

mattstauffer commented 5 months ago

Oh, this is hot.