PHPackages                             phpnomad/sentry-integration - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. phpnomad/sentry-integration

ActiveLibrary

phpnomad/sentry-integration
===========================

Sentry error monitoring integration for PHPNomad

1.0.2(2mo ago)0331↓50%MITPHPPHP &gt;=8.2

Since Feb 19Pushed 2mo agoCompare

[ Source](https://github.com/phpnomad/sentry-integration)[ Packagist](https://packagist.org/packages/phpnomad/sentry-integration)[ RSS](/packages/phpnomad-sentry-integration/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (7)Versions (4)Used By (0)

PHPNomad Sentry Integration
===========================

[](#phpnomad-sentry-integration)

Sentry error monitoring integration for PHPNomad applications. Transparently captures errors and exceptions via the PHPNomad logging system — no code changes needed in your application.

Installation
------------

[](#installation)

```
composer require phpnomad/sentry-integration
```

Setup
-----

[](#setup)

### 1. Implement `SentryDsnProvider`

[](#1-implement-sentrydsnprovider)

Create a class that returns your Sentry DSN:

```
use PHPNomad\Sentry\Interfaces\SentryDsnProvider;

class MySentryDsnProvider implements SentryDsnProvider
{
    public function getDsn(): string
    {
        return $_ENV['SENTRY_DSN'] ?? '';
    }
}
```

### 2. Register initializers

[](#2-register-initializers)

Add the Sentry initializer and your DSN provider binding to your application boot:

```
use PHPNomad\Sentry\SentryInitializer;

// In your initializer chain:
new SentryInitializer(),
new MyDsnProviderInitializer(), // binds MySentryDsnProvider => SentryDsnProvider
```

### 3. Done

[](#3-done)

Any `$logger->error()`, `$logger->critical()`, etc. calls will now be captured in Sentry. Lower-severity logs (debug, info, notice) are added as breadcrumbs that appear as context on the next error.

How It Works
------------

[](#how-it-works)

- Listens to `ItemLogged` events broadcast by PHPNomad's logger
- WARNING and above: captured as Sentry events
- Below WARNING: added as Sentry breadcrumbs
- If `$context['exception']` contains a `Throwable`, uses `captureException()` for full stack traces
- Lazy initialization: Sentry SDK is only initialized on the first log event
- Empty DSN gracefully no-ops (no errors if Sentry isn't configured)
- All Sentry calls wrapped in try/catch — monitoring never crashes your app

Customizing the Capture Gate
----------------------------

[](#customizing-the-capture-gate)

Override `SentryCaptureGate` to control what gets captured vs breadcrumbed:

```
use PHPNomad\Core\Events\ItemLogged;
use PHPNomad\Sentry\Interfaces\SentryCaptureGate;

class MyCaptureGate implements SentryCaptureGate
{
    public function shouldCapture(ItemLogged $event): bool
    {
        // Only capture ERROR and above (skip warnings)
        return $event->severityIs('>=', ItemLogged::ERROR);
    }
}
```

Bind it in a later initializer to override the default:

```
return [MyCaptureGate::class => SentryCaptureGate::class];
```

Severity Mapping
----------------

[](#severity-mapping)

PHPNomad LevelSentry SeverityDEBUGdebugINFOinfoNOTICEinfoWARNINGwarningERRORerrorCRITICALfatalALERTfatalEMERGENCYfatalLicense
-------

[](#license)

MIT

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance83

Actively maintained with recent releases

Popularity17

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

3

Last Release

88d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9e6206223bd6f2a57b8ac80605b1b5c3521faaec18ad3f20f25fb728a9a13784?d=identicon)[tstandiford](/maintainers/tstandiford)

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/phpnomad-sentry-integration/health.svg)

```
[![Health](https://phpackages.com/badges/phpnomad-sentry-integration/health.svg)](https://phpackages.com/packages/phpnomad-sentry-integration)
```

###  Alternatives

[sentry/sentry-laravel

Laravel SDK for Sentry (https://sentry.io)

1.3k114.3M154](/packages/sentry-sentry-laravel)[sentry/sentry-symfony

Symfony integration for Sentry (http://getsentry.com)

73761.4M66](/packages/sentry-sentry-symfony)[sentry/sdk

This is a meta package of sentry/sentry. We recommend using sentry/sentry directly.

327134.8M151](/packages/sentry-sdk)[justbetter/magento2-sentry

Magento 2 Logger for Sentry

1851.5M3](/packages/justbetter-magento2-sentry)[stayallive/wp-sentry

A (unofficial) WordPress plugin to report PHP and JavaScript errors to Sentry.

379197.9k](/packages/stayallive-wp-sentry)[bgalati/monolog-sentry-handler

Sentry handler for PHP SDK v2/v3

60837.4k4](/packages/bgalati-monolog-sentry-handler)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
