Search by

allstak / sdk-symfony

AllStak

Official AllStak Symfony bundle — drop-in, fully automatic observability for Symfony 6.4 and 7.x. One install plus an API key auto-captures errors, inbound and outbound HTTP, DB queries, logs, traces and spans, breadcrumbs, console commands, and messenger messages. Every integration is on by default

Package info

github.com/AllStak/allstak-symfony

Homepage

Documentation

Type:symfony-bundle

pkg:composer/allstak/sdk-symfony

Statistics

Installs: 3

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v0.1.0 2026-05-30 00:46 UTC

This package is auto-updated.

Last update: 2026-10-25 17:31:16 UTC


README

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.

Install

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],
];

Configure

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.

What gets captured automatically

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

Manual API (bonus)

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.

Outbound HTTP & trace propagation

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
}

Doctrine DBAL

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.

Messenger

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.

Local development against the core SDK

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"
    }
}

Requirements

  • PHP >= 8.1
  • Symfony 6.4 or 7.x
  • allstak/sdk-php ^1.3

License

MIT