PHPackages                             labor-digital/sentry-php - 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. [Logging &amp; Monitoring](/categories/logging)
4. /
5. labor-digital/sentry-php

ActiveComposer-plugin[Logging &amp; Monitoring](/categories/logging)

labor-digital/sentry-php
========================

Sentry.io PHP wrapper with easy integration in build pipelines

2.0.5(3y ago)0723↓50%Apache-2.0PHP

Since May 3Pushed 3y ago1 watchersCompare

[ Source](https://github.com/labor-digital/sentry-php)[ Packagist](https://packagist.org/packages/labor-digital/sentry-php)[ Docs](https://www.labor.digital)[ RSS](/packages/labor-digital-sentry-php/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (4)Versions (8)Used By (0)

LABOR - Sentry.io wrapper
=========================

[](#labor---sentryio-wrapper)

This package is a wrapper for the sentry.io.

It will also provide support for our [sentry-release pipeline](https://github.com/labor-digital/bitbucket-pipeline-images#sentry-release) script to automatically. It will inherit all required information, like the dsn or the release from a shared config file.

Requirements
------------

[](#requirements)

- PHP 7.3+
- Composer v1 or v2 should work

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

[](#installation)

Install this package using composer:

```
composer require labor-digital/sentry-php

```

Usage
-----

[](#usage)

You can use this library, like you would use the sentry PHP sdk, however it will check if it is actually needed by your environment. It uses either the SENTRY\_ACTIVE &gt; 0 or PROJECT\_ENV === "prod" environment variables to detect if sentry logging should be enabled. If you want to force the state, you can always use the `Sentry::manualActivation()` method to set it manually.

Before you start your logging, you need to provide the configuration through `Sentry::setSentryConfig()`. Additionally, the sentry configuration can be provided as "config.json" inside the package's vendor directory. (e.g /project/vendor/labor-digital/sentry-php/config.json) Note: You need to wrap the config in the "sdk" key in the JSON object. Note2: Keep in mind, this is the internal bridge used by the [sentry-release pipeline](https://github.com/labor-digital/bitbucket-pipeline-images#sentry-release).

### Available methods

[](#available-methods)

- Sentry::captureMessage() | Captures a generic message and sends it to Sentry.
- Sentry::captureException() | Captures an exception event and sends it to Sentry.
- Sentry::captureEvent() | Captures a generic event using the provided data.
- Sentry::captureLastError() | Logs the most recent error (obtained with error\_get\_last).
- Sentry::addBreadcrumb() | Records a new breadcrumb which will be attached to future events.
- Sentry::configureScope() | Calls the given callback passing to it the current scope so that any operation can be run within its context.
- Sentry::withScope() | Creates a new scope with and executes the given operation within.
- Sentry::manualActivation() | Manually activates the sentry logging, if it was not auto-enabled through the environment variables
- Sentry::setSentryConfig() | Either for manual configuration, or to enhance the auto-config provided by the pipeline integration
- Sentry::registerGlobalHandler() | Registers a global error and exception handler that is used to catch all not-cached exceptions
- Sentry::restoreGlobalHandler() | Restores the global error and exception handlers
- Sentry::isActivated() | Checks if the sentry logging is activated, by validating if the class was correctly initialized
- Sentry::setHub() | Sets the sentry hub, used to transport the messages
- Sentry::getHub() | Returns the sentry hub, used to transport messages or null if logging is not activated

### Global errors

[](#global-errors)

The default PHP implementation of sentry will automatically listen to global exceptions and errors. This package **disables** the automatic global exception handling. You can activate it using the `Sentry::registerGlobalHandler()` method.

### Pipeline integration

[](#pipeline-integration)

As mentioned multiple times above, the wrapper integrates seamlessly with our [sentry-release pipeline](https://github.com/labor-digital/bitbucket-pipeline-images#sentry-release). This means, the provided composer plugin will automatically detect the `sentry-configuration-file.json` in your build artifacts and create a `config.json` for the wrapper to read at runtime. The plugin can be configured through environment variables:

- BITBUCKET\_CLONE\_DIR (This is normally set by bitbucket, but you can adjust it for other pipelines as well (gitlab: $CI\_PROJECT\_DIR | github: $GITHUB\_WORKSPACE))
- SENTRY\_CONFIG\_FILE\_LOCATION (*DEFAULT: "${BITBUCKET\_CLONE\_DIR}/sentry-configuration-file.json"*, holds the compiled information for other build steps to use)

Postcardware
------------

[](#postcardware)

You're free to use this package, but if it makes it to your production environment we highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using.

Our address is: LABOR.digital - Fischtorplatz 21 - 55116 Mainz, Germany

We publish all received postcards on our [company website](https://labor.digital).

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community5

Small or concentrated contributor base

Maturity53

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 ~4 days

Total

6

Last Release

1452d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0eb1c26fb5a535cd7a656faffbae7929009558b2bfa6156b2be7b636d689e13a?d=identicon)[labor-digital](/maintainers/labor-digital)

![](https://www.gravatar.com/avatar/c0356afb258572c8908df3132ea59545b7642a6b77fd90bc54215e506c42bfb7?d=identicon)[neunerlei](/maintainers/neunerlei)

### Embed Badge

![Health badge](/badges/labor-digital-sentry-php/health.svg)

```
[![Health](https://phpackages.com/badges/labor-digital-sentry-php/health.svg)](https://phpackages.com/packages/labor-digital-sentry-php)
```

###  Alternatives

[symfony/monolog-bundle

Symfony MonologBundle

2.9k249.1M1.6k](/packages/symfony-monolog-bundle)[vaimo/composer-patches

Applies a patch from a local or remote file to any package that is part of a given composer project. Patches can be defined both on project and on package level. Optional support for patch versioning, sequencing, custom patch applier configuration and patch command for testing/troubleshooting added patches.

2994.3M16](/packages/vaimo-composer-patches)[notamedia/yii2-sentry

Yii2 logger for Sentry

1272.0M2](/packages/notamedia-yii2-sentry)[phptek/sentry

Sentry.io integration for SilverStripe. Binds Sentry.io to SilverStripe's error &amp; exception handling subsystem.

15203.5k3](/packages/phptek-sentry)[helhum/sentry-typo3

Sentry Integration for TYPO3

1833.5k](/packages/helhum-sentry-typo3)[minbaby/hyperf-sentry

1926.7k](/packages/minbaby-hyperf-sentry)

PHPackages © 2026

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