Global variable for sentry error logging

I am trying to setup sentry error logging.
The docs say: Legacy SDK for PHP | Sentry Documentation

The most important part is the creation of the raven client. Create it once and reference it from anywhere you want to interface with Sentry. Once you have the client you can either use it manually or enable the automatic error and exception capturing which is recommended:

$client = new Raven_Client('https://<key><project>');
$error_handler = new Raven_ErrorHandler($client);

So I tried to put this in a plugin site/plugins/sentry/index.php

But when I try to use this in ex. a controller I get:

Undefined variable: client

Where should I put the code or how can I hook into kirbys error handling, so that an error is sent to sentry when a exception in kirby occurs?

you could add a site method to your plugin returning the raven client variable.

Or just a function…