Server SDK

Error monitoring for PHP

A framework-agnostic core for Symfony, Slim, or plain PHP. It installs exception and error handlers so otherwise-unreported failures still reach errorgap. On Laravel, use the dedicated package.

Frameworks Symfony · Slim · plain PHPRequires PHP 8.1+Package errorgap/errorgapSource ↗Package ↗Agent guide ↗
Install

Install

sh
composer require errorgap/errorgap

On Laravel use errorgap/laravel; on WordPress use the errorgap plugin.

Configure

Configure

Call Errorgap::init(...) in your bootstrap — Symfony's src/Kernel.php, Slim's public/index.php, or a plain front controller:

php
use Errorgap\Errorgap;

Errorgap::init([
    'endpoint'    => $_ENV['ERRORGAP_ENDPOINT'],
    'projectSlug' => $_ENV['ERRORGAP_PROJECT_SLUG'],
    'apiKey'      => $_ENV['ERRORGAP_API_KEY'],
]);

By default init registers set_exception_handler and set_error_handler to catch otherwise-unreported errors.

Keep the key in an environment variable (or your framework's secret store) — never commit it to source control.
Trigger a test error

Trigger a test error

Add a temporary route that throws:

php
$app->get('/errorgap-test', function () {
    throw new \Exception('Errorgap test error');
});
Verify

Verify the connection

Confirm your key and endpoint reach errorgap before wiring anything else — send one event straight to the ingestion API:

bash
curl -sS -X POST "$ERRORGAP_ENDPOINT/api/projects/$ERRORGAP_PROJECT_SLUG/notices" \
  -H "content-type: application/json" \
  -H "x-errorgap-project-key: $ERRORGAP_API_KEY" \
  -d '{"errors":[{"type":"ErrorgapInstallTest","message":"Errorgap install verification"}]}'

A 201 with a group_id means ingestion works (202 = received but sampled; 401 = wrong key). Then trigger the test error above through the SDK. Your onboarding screen's Verify step checks the stack off automatically once the first event lands — it polls every three seconds.

Next: the full ingestion API, or browse every SDK.