Sentry 2.0 / PHP Integrations

Hello,

I’m trying to integrate sentry to an old php project without framework but with composer.

It looks like calling Sentry\init() isn’t enaugh to catch exception or errors automatically.

I’ve seen something about integrations on the doc but i don’t know how to add them. Or maybe the problem is somewhere else ?

Can you help me please ?

Hey, I just tried it with this basic PHP Script and it works just fine:

<?php

require 'vendor/autoload.php';

Sentry\init([
    'dsn' => 'YOUR DSN',
]);

Sentry\configureScope(function (Sentry\State\Scope $scope): void {
    $scope->setUser(['email' => 'hello@sentry.io']);
});

Sentry\addBreadcrumb(new Sentry\Breadcrumb(
    Sentry\Breadcrumb::LEVEL_ERROR,
    Sentry\Breadcrumb::TYPE_ERROR,
    'error_reporting',
    'foo bar'
  ));

throw new \Exception('bar foo4');

see: