dockcodes / dock-ray-symfony
Symfony bundle for the DockRay PHP SDK
Package info
github.com/dockcodes/dock-ray-symfony
Type:symfony-bundle
pkg:composer/dockcodes/dock-ray-symfony
Requires
- php: ^8.2
- dockcodes/dock-ray: ^1.4
- symfony/config: ^6.4|^7.0
- symfony/console: ^6.4|^7.0
- symfony/dependency-injection: ^6.4|^7.0
- symfony/event-dispatcher: ^6.4|^7.0
- symfony/http-kernel: ^6.4|^7.0
Requires (Dev)
- phpunit/phpunit: ^11.0
- symfony/framework-bundle: ^6.4|^7.0
- symfony/messenger: ^6.4|^7.0
- symfony/scheduler: ^6.4|^7.0
- symfony/security-core: ^6.4|^7.0
Suggests
- symfony/messenger: Consume the automatic DockRay inventory schedule
- symfony/scheduler: Automatic hourly inventory schedule (requires a running Messenger worker)
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-10-11 14:50:14 UTC
README
Reports Symfony exceptions, console errors and HTTP transactions to DockRay.
Installation
composer require dockcodes/dock-ray-symfony
Without Symfony Flex, register the bundle in config/bundles.php:
return [ // ... Dock\Ray\Symfony\RayBundle::class => ['all' => true], ];
Configuration
config/packages/ray.yaml:
ray: token: '%env(RAY_TOKEN)%' private_key: '%env(RAY_PRIVATE_KEY)%' url: '%env(default::RAY_URL)%' traces_sample_rate: 0.2 ignore_exceptions: - Symfony\Component\HttpKernel\Exception\NotFoundHttpException
Every key is optional. Without a token and a private key the bundle loads but sends nothing.
| Key | Default | Meaning |
|---|---|---|
url |
https://dockray.io |
DockRay instance |
environment |
%kernel.environment% |
environment column in the panel |
release |
null |
deployed version |
sample_rate |
1.0 |
share of error events sent |
traces_sample_rate |
0.0 |
share of transactions sent; 0 disables tracing |
send_default_pii |
false |
attach IP address and user agent |
send_default_user |
true |
attach the authenticated user |
ignore_exceptions |
[] |
classes never reported |
ignore_transactions |
['/_wdt', '/_profiler'] |
path prefixes never measured |
options |
{} |
passed straight to the SDK |
What the bundle registers
| Listener | Event | Does |
|---|---|---|
ExceptionListener |
kernel.exception (-128) |
reports the throwable the request actually died on |
TracingListener |
kernel.request / kernel.terminate |
one transaction per main request |
UserListener |
kernel.controller |
attaches the authenticated user |
ConsoleErrorListener |
console.error |
reports failing commands, tagged with the command name |
The last two register only when symfony/security-core and
symfony/console are installed.
404 responses are exceptions in Symfony, so add NotFoundHttpException to
ignore_exceptions unless you want them in the panel.
Reporting by hand
The hub is available as Dock\Ray\State\HubInterface and as the public
ray.hub service:
public function __construct(private HubInterface $ray) {} public function import(): void { try { $this->run(); } catch (\Throwable $exception) { $this->ray->captureException($exception); } }
The SDK's global functions work too — the bundle installs its hub as the current one while the container boots.
Messenger and long-running processes
The hub is a container singleton, so a worker keeps one client for its whole
life. Failing messages are reported through console.error when the worker
itself dies; for per-message reporting add your own Messenger middleware around
captureException().
License
MIT.