Official AllStak bundle for Symfony 6.4 and 7.x. Drop-in, fully automatic observability with near-zero configuration: install, set your API key, and the bundle auto-captures errors, inbound and outbound HTTP, database queries, logs, traces and spans, breadcrumbs, console commands, and Messenger messages.
Built on top of the allstak/sdk-php
core client — this bundle does not reimplement transport, it wires the core SDK
into the Symfony container and event system.
composer require allstak/sdk-symfony
With Symfony Flex the bundle is registered automatically. Without Flex, add it
to config/bundles.php:
return [
// ...
AllStak\SymfonyBundle\AllStakBundle::class => ['all' => true],
];
The only thing you need is an API key. Set it in the environment:
# .env
ALLSTAK_API_KEY=allstak_live_xxxxxxxx
That is the entire zero-config path. The bundle reads ALLSTAK_API_KEY on boot
and turns every integration ON. For more control, add
config/packages/allstak.yaml:
allstak:
api_key: '%env(ALLSTAK_API_KEY)%'
environment: '%kernel.environment%'
release: '%env(default::ALLSTAK_RELEASE)%'
service: 'my-symfony-app'
send_default_pii: false # default: false (auto-collected PII is scrubbed)
sample_rate: 1.0 # fraction of exceptions to forward
enable_offline_queue: true # persist + replay undelivered telemetry; set false on read-only/serverless FS
integrations:
kernel: true # request span, request context, inbound HTTP, exception capture
console: true # command spans + error capture on failure
messenger: true # span per handled message + error capture
doctrine: true # DB query records via a DBAL driver middleware
http_client: true # outbound HTTP records + spans + trace propagation
monolog: true # ship logs; promote ERROR+ with an exception to capture
Every integration is ON by default and individually toggleable. Optional framework pieces (console, messenger, Doctrine DBAL, HTTP client, Monolog) self-disable gracefully when their package is not installed.
| Area | Mechanism |
|---|---|
| Unhandled errors | kernel.exception capture with full request context |
| Inbound HTTP | kernel.response http-request record (method, path, host, status, time) |
| Request spans | kernel.request -> kernel.response server span, joined to inbound trace |
| Breadcrumbs | controller resolution, console commands, messages, logs |
| Outbound HTTP | decorated HttpClientInterface: record + span + trace-propagation header |
| Database queries | Doctrine DBAL driver middleware: normalized query, duration, status |
| Logs | Monolog handler: ships logs, ERROR+ with an exception becomes a capture |
| Console commands | ConsoleEvents span + error capture on non-zero exit |
| Messenger | middleware span per handled message + error capture on handler failure |
| Buffer flush | kernel.terminate / console terminate drains buffers after the response |
Auto-instrumentation is the primary path. When you want explicit control, the core SDK service is autowirable:
use AllStak\AllStak;
final class CheckoutController
{
public function __construct(private AllStak $allstak) {}
public function pay(): Response
{
$this->allstak->addBreadcrumb('default', 'payment started');
try {
// ...
} catch (\Throwable $e) {
$this->allstak->captureError($e);
throw $e;
}
}
}
You can also use the static facade AllStak\Facade anywhere after boot.
The bundle decorates the framework http_client service, so any autowired
HttpClientInterface call is recorded and carries a trace-propagation
baggage header automatically. No code changes are needed:
public function __construct(private \Symfony\Contracts\HttpClient\HttpClientInterface $client) {}
public function fetch(): array
{
return $this->client->request('GET', 'https://example.com/api')->toArray();
// recorded as an outbound http-request + client span on this request's trace
}
When doctrine/dbal is installed, the bundle registers a DBAL driver
middleware (the modern, non-deprecated instrumentation seam). DoctrineBundle
picks it up via the doctrine.middleware tag and applies it to every
connection, so queries are recorded with zero changes to your repositories.
The bundle prepends its middleware onto the default message bus, so handled
messages are instrumented automatically. If you define custom buses, add
allstak.messenger_middleware to that bus's middleware list.
For local builds before the package is published, add a path repository so the core client resolves from your checkout:
{
"repositories": [
{ "type": "path", "url": "../allstak-php-sdk" }
]
}
The release require uses the published package:
{
"require": {
"allstak/sdk-php": "^1.3"
}
}
allstak/sdk-php ^1.3MIT
How can I help you explore Laravel packages today?