Skip to content

Instantly share code, notes, and snippets.

@soderlind
Last active March 14, 2025 22:53
Show Gist options
  • Select an option

  • Save soderlind/9b95fa498a4ba1c563cc3d30b03260ab to your computer and use it in GitHub Desktop.

Select an option

Save soderlind/9b95fa498a4ba1c563cc3d30b03260ab to your computer and use it in GitHub Desktop.
Buggregator for local WordPress development

Buggregator

  1. (You need docker)
  2. Save the docker-compose.yml file.
  3. Run docker-compose up in the same folder as the docker-compose.yml file.
  4. Buggregator is at http://127.0.0.1:8000/#/

Learn more at https://docs.buggregator.dev/

WordPress

Make sure WP_ENVIRONMENT_TYPEis set to local. Local (by WPEngine) does that by default.

Log errors using WP Sentry

  1. Install WP Sentry. You don't have to activate it. We will load it early, to catch errors early.
  2. In wp-config.php add:
// NOTE: WP_ENVIRONMENT_TYPE must be defined and set to 'local'.

if (defined('WP_ENVIRONMENT_TYPE') && 'local' === WP_ENVIRONMENT_TYPE) {
	define( 'WP_SENTRY_PHP_DSN', 'http://[email protected]:8000/1' );
	define( 'WP_SENTRY_ERROR_TYPES', E_ALL & ~E_NOTICE & ~E_USER_NOTICE );
	require_once __DIR__ . '/wp-content/plugins/wp-sentry-integration/wp-sentry.php';
}

Example exeception:

sentry

Dump stuff using ray

  1. Install ray in your project using composer: composer --dev require spatie/ray
  2. Copy ray.php to the root of your WordPress site
  3. Now you can dump to buggregator, from your project, using \ray( $var );

Example varible dump:

ray
services:
buggregator:
image: ghcr.io/buggregator/server:latest
depends_on:
buggregator-database:
condition: service_healthy
ports:
- 127.0.0.1:8000:8000
environment:
PERSISTENCE_DRIVER: database
DB_DRIVER: pgsql
DB_DATABASE: buggregator
DB_HOST: buggregator-database
DB_PORT: 5432
DB_USERNAME: buggregator
DB_PASSWORD: buggregator
buggregator-database:
image: postgres:latest
healthcheck:
test: [ "CMD-SHELL", "pg_isready --username=buggregator --dbname=buggregator" ]
interval: 3s
timeout: 3s
retries: 1
environment:
POSTGRES_DB: buggregator
POSTGRES_USER: buggregator
POSTGRES_PASSWORD: buggregator
<?php
if ( ! defined( 'WP_ENVIRONMENT_TYPE' ) || 'local' !== WP_ENVIRONMENT_TYPE ) {
return;
}
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,
];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment