PHPackages                             biller/yii2-phpbrake - 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. biller/yii2-phpbrake

ActiveYii2-extension[Logging &amp; Monitoring](/categories/logging)

biller/yii2-phpbrake
====================

Yii2 PHPBrake integration

v1.4.0(2y ago)0336.5k↓22.2%1[2 PRs](https://github.com/biller/yii2-phpbrake/pulls)MITPHPPHP ^7.0 || ^8.0

Since Oct 23Pushed 1y ago1 watchersCompare

[ Source](https://github.com/biller/yii2-phpbrake)[ Packagist](https://packagist.org/packages/biller/yii2-phpbrake)[ Docs](https://github.com/biller/yii2-phpbrake)[ RSS](/packages/biller-yii2-phpbrake/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (2)Versions (16)Used By (0)

yii2-airbrake
=============

[](#yii2-airbrake)

Airbrake integration for Yii2, which wraps around official [Airbrake PHP library (airbrake/phpbrake)](https://github.com/airbrake/phpbrake).

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

[](#installation)

```
composer require biller/yii2-airbrake

```

Usage
-----

[](#usage)

While it is not explicitly required, it is recommended to configure the `AirbrakeService`as a component in environment (or even common) configuration, so it is easily accessible from the whole application ( using i.e. `Yii::$app->get('airbrakeService')`).

```
return [
    // ...
    'components' => [
        // ...
        'airbrakeService' => [
            'class' => biller\phpbrake\AirbrakeService::class,

            'enabled' => true, // default TRUE

            'projectId' => 'YOUR_PROJECT_ID',
            'projectKey' => 'YOUR_PROJECT_KEY',

            'environment' => YII_ENV, // default NULL
            'appVersion' => [your-app-version], // default NULL
            'rootDirectory' => [source-root-directory], // default NULL
            'host' => [api-endpoint-host], // default "api.airbrake.io"
            'httpClient' => [http-client-type], // default "default"

            'setGlobalInstance' => [boolean], // default TRUE
            'setErrorHandler' => [boolean], // default FALSE

            'filters' => [ // default NULL
                // 'PHPSESSID' and '_csrf' parameters should not be transferred to airbrake
                [
                    'class' => biller\phpbrake\ParamsFilter::class,
                    'params' => ['PHPSESSID', '_csrf'],
                ],
            ],
        ],
    ],
];
```

*Configuration options marked with asterisk are required, all other options are optional.*

- `rootDirectory`: should be set to your sources root to allow shortening of file paths
- `httpClient`: specifies type of HTTP client to use and can be configured as:
    - `AirbrakeService::CLIENT_DEFAULT`
    - `AirbrakeService::CLIENT_GUZZLE`
    - `AirbrakeService::CLIENT_CURL`
- `setGlobalInstance`: if set to `true`, current instance will be set as global instance
- `setErrorHandler`: if set to `true`, current instance will be set as PHP run-time unhandled exception handler
- `filters`: array of callables providing notice pre-processing

*For additional information about the API, please consult official Airbrake PHP library documentation.*

### AirbrakeFilterFactory

[](#airbrakefilterfactory)

Factory class that can be used to create various filtering rules.

#### `AirbrakeFilterFactory::createParamsFilter(array $params, $replacement = 'FILTERED')`

[](#airbrakefilterfactorycreateparamsfilterarray-params-replacement--filtered)

Method will create filtering callable that filters parameters, specified by `$params` and replaces it with specified `$replacement`. Example usage is available above.

Console Support
---------------

[](#console-support)

Integration can be added to Yii console, where it currently provides a command to track deployment (new feature in Airbrake API 4 that allows to mark error timeline with deployments).

### Usage

[](#usage-1)

To use `ConsoleController`, `AirbrakeService` should be configured as component.

```
import enscope\Yii2\Ext\Airbrake\ConsoleController;

return [
    // ...
    'controllerMap' => [
        // ...
        'airbrake' => [
            'class' => ConsoleController::class,
            'airbrakeService' => [component-name], // default "airbrakeService"
        ],
    ],
];

```

While parameters can be hard-coded in configuration, console controller supports `inferParameters`, `username`, `revision` and `repository`parameters to be set by arguments on command line.

- `airbrakeService`: name of the component or initialized instance
- `inferParameters`: if TRUE, `repository` and `revision` are discovered using `exec()` calls
- `revision`: identifier of the revision, discovered by `git rev-parse HEAD` if infer allowed
- `repository`: identifier of the repository, discovered by `git remote get-url origin` if infer allowed
- `username`: name of the user tracking deploy (default "system")

Logging Target
--------------

[](#logging-target)

You can configure Yii2 logger to log errors automatically to Airbrake Service.

### Usage

[](#usage-2)

To use `ConsoleController`, `AirbrakeService` should be configured as component.

```
return [
    'components' => [
        'log' => [
            'targets' => [
                [
                    'class' => biller\phpbrake\AirbrakeTarget::class,
                    'levels' => ['error'],
                ],
            ],
        ],
    ],
];
```

The target currently does not expose any other configuration options other then those exposed by `yii\log\Target`, except the service component:

- `airbrakeService`: name of the component or initialized instance

License
-------

[](#license)

Yii2 Airbrake integration is licensed under [The MIT License (MIT)](https://github.com/biller/yii2-airbrake/blob/master/LICENSE)as is the original PHP Airbrake library and follows the versioning of that library.

###  Health Score

43

—

FairBetter than 91% of packages

Maintenance28

Infrequent updates — may be unmaintained

Popularity35

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity76

Established project with proven stability

 Bus Factor1

Top contributor holds 61.3% of commits — single point of failure

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

Recently: every ~273 days

Total

13

Last Release

732d ago

Major Versions

v0.2.3 → v1.0.02018-11-30

PHP version history (2 changes)v1.1.1PHP ^7.0

v1.1.2PHP ^7.0 || ^8.0

### Community

Maintainers

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

---

Top Contributors

[![juanisorondo](https://avatars.githubusercontent.com/u/9666184?v=4)](https://github.com/juanisorondo "juanisorondo (19 commits)")[![mx0r](https://avatars.githubusercontent.com/u/54171515?v=4)](https://github.com/mx0r "mx0r (6 commits)")[![zufra](https://avatars.githubusercontent.com/u/42717122?v=4)](https://github.com/zufra "zufra (2 commits)")[![tachirodriguez](https://avatars.githubusercontent.com/u/25849492?v=4)](https://github.com/tachirodriguez "tachirodriguez (1 commits)")[![maxalegre](https://avatars.githubusercontent.com/u/8438705?v=4)](https://github.com/maxalegre "maxalegre (1 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")[![AleMercadal](https://avatars.githubusercontent.com/u/91342660?v=4)](https://github.com/AleMercadal "AleMercadal (1 commits)")

---

Tags

loggingerrorreportingyii2extensionairbrake

### Embed Badge

![Health badge](/badges/biller-yii2-phpbrake/health.svg)

```
[![Health](https://phpackages.com/badges/biller-yii2-phpbrake/health.svg)](https://phpackages.com/packages/biller-yii2-phpbrake)
```

###  Alternatives

[mito/yii2-sentry

Yii 2 extension for Sentry

92377.7k](/packages/mito-yii2-sentry)[sammaye/yii2-audittrail

A port of audit trail

39408.2k](/packages/sammaye-yii2-audittrail)[mero/yii2-monolog

The Monolog integration for the Yii framework.

42186.1k](/packages/mero-yii2-monolog)

PHPackages © 2026

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