Skip to main content
There is no Squasher SDK for PHP. Use OpenTelemetry, the Sentry SDK for PHP, or the HTTP API. This page is tested with the OpenTelemetry PHP SDK 1.15 and sentry/sentry 4.32 on PHP 8.5.

Send errors with the HTTP API

This function posts one error to the ingest endpoint with the curl extension:
src/squasher.php
stack is shown as the stack trace on the issue page. To get your ingest key and project ID, see Create an ingest key. See the HTTP API for all fields.

Report every Laravel exception

In Laravel 11 and later, call the function from the exception handler in bootstrap/app.php:
bootstrap/app.php
To load src/squasher.php, add it to the autoload section of composer.json, and run composer dump-autoload:
composer.json
The call waits for Squasher for up to 5 seconds, in the request that failed.

Send errors with OpenTelemetry

1

Install the packages

The exporter needs an HTTP client; php-http/guzzle7-adapter adds one. This guide uses OTLP/HTTP. The gRPC transport is also supported at the Collector URL on port 443.
2

Set the exporter variables

With OTEL_PHP_AUTOLOAD_ENABLED, the SDK configures itself from these variables when Composer loads it. OTLP requests do not need the project ID.
3

Record errors on spans

A span with the error status becomes an issue, titled with the status description, and the issue page shows the stack trace of the recorded exception. recordException on a span without the error status also makes an issue, titled with the exception message. The SDK sends the spans when the PHP script ends.
For spans from Laravel or Symfony without code changes, the OpenTelemetry project also has auto-instrumentation packages, such as open-telemetry/opentelemetry-auto-laravel. They need the opentelemetry PHP extension. This page does not cover that setup. Automatic AI triage runs only on issues from the production environment.

Use the Sentry SDK for PHP

If your app already uses sentry/sentry, point its DSN at Squasher. Squasher reads the gzip envelopes that the SDK sends.
The DSN is https://<ingest key>@ingest.squasher.ai/1. The ingest key selects the project; the SDK needs a number at the end. Squasher keeps errors, traces, logs, metrics, and sessions from the SDK, so you can keep tracing on. See Sentry for what each item becomes.

Send a test error

Run this once with the same environment variables:
Then select Issues in the sidebar of your project. If the error does not appear, see Troubleshooting.

Give the setup to a coding agent

Copy this prompt into your coding agent to set up PHP the same way:

Next steps

HTTP API

See every field of the ingest endpoint.

OpenTelemetry

See which OTLP data Squasher accepts.

Move from Sentry

Move an app from Sentry to Squasher.

Troubleshooting

Find out why an event does not appear.