Installation - Symfony

2 min read Updated: 11.09.2026

On this page Requirements
  1. Requirements
  2. Installing the package
  3. Configuration
  4. Add NotFoundHttpException right away
  5. The first test

Before you start, create a project in the DockRay panel. Its settings hold the project token - the public identifier that goes into the ingest URL - and the API keys tab is where you generate a private key. The key is shown once, when it is generated: DockRay stores only its hash. If you do not have a project yet, start with Getting Started.

Requirements

  • Symfony 6.4 or newer,
  • PHP 8.2 or newer,
  • Composer 2.

Installing the package

bash
composer require dockcodes/dock-ray-symfony

With Symfony Flex the bundle registers itself. Without Flex, add it by hand in config/bundles.php:

php
return [
    // ...
    Dock\Ray\Symfony\RayBundle::class => ['all' => true],
];

Configuration

Create config/packages/ray.yaml. Every key is optional; without a token and a private key the bundle loads and sends nothing.

yaml
ray:
    token: '%env(RAY_TOKEN)%'
    private_key: '%env(RAY_PRIVATE_KEY)%'
    traces_sample_rate: 0.2
    ignore_exceptions:
        - Symfony\Component\HttpKernel\Exception\NotFoundHttpException

Keep the credentials in .env.local or in Symfony secrets, not in the configuration file:

bash
RAY_TOKEN=project-token
RAY_PRIVATE_KEY=project-private-key

Add NotFoundHttpException right away

In Symfony a 404 response is an exception, so without that one entry in ignore_exceptions monitoring fills up with reports from scanners and mistyped URLs. It is the single most commonly missed step in a first configuration.

The first test

The hub is a public service, so the console is the easiest route - the call travels the same path as reporting from the application:

bash
php bin/console debug:container ray.hub

If the service is there, call captureMessage() from any command or controller and check the panel.

Keep reading

DockRay newsletter

Application security in your inbox

Important vulnerabilities, actionable guidance and practical advice for your applications. Choose your technologies and follow what matters to your project.

  • A daily digest of new vulnerabilities, critical ones included.
  • Notifications about important updates.
  • Practical advice on application security and monitoring.

Leave empty to receive updates for every technology.

Free to subscribe. Unsubscribe with one click in any email.