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

ActiveLibrary[Logging &amp; Monitoring](/categories/logging)

coamw2/phpbrake
===============

Airbrake exception and error notifier for PHP

08PHP

Since Aug 14Pushed 2y agoCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

 [![](https://camo.githubusercontent.com/6dfe5b272b10497e836ccabb53a54299451b0388717be1e1c99275035215f2a5/68747470733a2f2f6169726272616b652d6769746875622d6173736574732e73332e616d617a6f6e6177732e636f6d2f6272616e642f6169726272616b652d66756c6c2d6c6f676f2e706e67)](https://camo.githubusercontent.com/6dfe5b272b10497e836ccabb53a54299451b0388717be1e1c99275035215f2a5/68747470733a2f2f6169726272616b652d6769746875622d6173736574732e73332e616d617a6f6e6177732e636f6d2f6272616e642f6169726272616b652d66756c6c2d6c6f676f2e706e67)

PHPBrake
========

[](#phpbrake)

[![Build Status](https://camo.githubusercontent.com/3d269ff81c043df498a61b7819e4cdff013a07634d880df8a48ecf8f7e33b0b2/68747470733a2f2f7472617669732d63692e6f72672f6169726272616b652f7068706272616b652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/airbrake/phpbrake)

Features
--------

[](#features)

PHPBrake is the official [Airbrake](https://airbrake.io) PHP error notifier. PHPBrake supports PHP 5.4 and higher. PHPBrake includes many useful features that give you control over when and what you send to Airbrake, you can:

- [Send notices from try-catch blocks in your code](https://github.com/airbrake/phpbrake#quickstart)
- [Add custom data to a notice](https://github.com/airbrake/phpbrake#adding-custom-data-to-the-notice)
- [Filter sensitive data from the notice](https://github.com/airbrake/phpbrake#filtering-sensitive-data-from-the-notice)
- [Ignore specific exceptions](https://github.com/airbrake/phpbrake#ignoring-specific-exceptions)
- [Configure an error handler to capture uncaught exceptions](https://github.com/airbrake/phpbrake#error-handler)
- [Integrate with monolog](https://github.com/airbrake/phpbrake#monolog-integration)
- [Integrate with Laravel](https://github.com/TheoKouzelis/laravel-airbrake)
- [Integrate with CakePHP 3.x](https://gist.github.com/mauriciovillalobos/01a97f9ee6179ad70b17d54f37cc5010)
- [Integrate with Symfony](https://github.com/aminin/airbrake-bundle)
- [Integrate with Zend](https://github.com/FrankHouweling/zend-airbrake)
- and more

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

[](#installation)

```
composer require airbrake/phpbrake
```

Quickstart
----------

[](#quickstart)

```
// Create new Notifier instance.
$notifier = new Airbrake\Notifier([
    'projectId' => 12345, // FIX ME
    'projectKey' => 'abcdefg' // FIX ME
]);

// Set global notifier instance.
Airbrake\Instance::set($notifier);

// Register error and exception handlers.
$handler = new Airbrake\ErrorHandler($notifier);
$handler->register();

// Somewhere in the app...
try {
    throw new Exception('hello from phpbrake');
} catch(Exception $e) {
    Airbrake\Instance::notify($e);
}
```

API
---

[](#api)

Notifier API consists of 4 methods:

- `buildNotice` - builds [Airbrake notice](https://airbrake.io/docs/#create-notice-v3).
- `sendNotice` - sends notice to Airbrake.
- `notify` - shortcut for `buildNotice` and `sendNotice`.
- `addFilter` - adds filter that can modify and/or filter notices.

Adding custom data to the notice
--------------------------------

[](#adding-custom-data-to-the-notice)

```
$notifier->addFilter(function ($notice) {
    $notice['context']['environment'] = 'production';
    return $notice;
});
```

Filtering sensitive data from the notice
----------------------------------------

[](#filtering-sensitive-data-from-the-notice)

```
$notifier->addFilter(function ($notice) {
    if (isset($notice['params']['password'])) {
        $notice['params']['password'] = 'FILTERED';
    }
    return $notice;
});
```

Ignoring specific exceptions
----------------------------

[](#ignoring-specific-exceptions)

```
$notifier->addFilter(function ($notice) {
    if ($notice['errors'][0]['type'] == 'MyExceptionClass') {
        // Ignore this exception.
        return null;
    }
    return $notice;
});
```

Add user data to the notice
---------------------------

[](#add-user-data-to-the-notice)

```
$notifier->addFilter(function ($notice) {
    $notice['context']['user']['name'] = 'Avocado Jones';
    $notice['context']['user']['email'] = 'AJones@guacamole.com';
    $notice['context']['user']['id'] = 12345;
    return $notice;
});
```

Setting severity
----------------

[](#setting-severity)

[Severity](https://airbrake.io/docs/airbrake-faq/what-is-severity/) allows categorizing how severe an error is. By default, it's set to `error`. To redefine severity, simply overwrite `context/severity` of a notice object. For example:

```
$notice = $notifier->buildNotice($e);
$notice['context']['severity'] = 'critical';
$notifier->sendNotice($notice);
```

Error handler
-------------

[](#error-handler)

Notifier can handle PHP errors, uncaught exceptions and shutdown. You can register appropriate handlers using following code:

```
$handler = new Airbrake\ErrorHandler($notifier);
$handler->register();
```

Under the hood `$handler->register` does following:

```
set_error_handler([$this, 'onError'], error_reporting());
set_exception_handler([$this, 'onException']);
register_shutdown_function([$this, 'onShutdown']);
```

Laravel integration
-------------------

[](#laravel-integration)

See

Symfony integration
-------------------

[](#symfony-integration)

See

CakePHP 3.x integration
-----------------------

[](#cakephp-3x-integration)

See

Zend Framework integration
--------------------------

[](#zend-framework-integration)

See

Monolog integration
-------------------

[](#monolog-integration)

```
$log = new Monolog\Logger('billing');
$log->pushHandler(new Airbrake\MonologHandler($notifier));

$log->addError('charge failed', ['client_id' => 123]);
```

Extra configuration options
---------------------------

[](#extra-configuration-options)

### appVersion

[](#appversion)

The version of your application that you can pass to differentiate exceptions between multiple versions. It's not set by default.

```
$notifier = new Airbrake\Notifier([
    // ...
    'appVersion' => '1.2.3',
    // ...
]);
```

### host

[](#host)

By default, it is set to `api.airbrake.io`. A `host` is a web address containing a scheme ("http" or "https"), a host and a port. You can omit the port (80 will be assumed) and the scheme ("https" will be assumed).

```
$notifier = new Airbrake\Notifier([
    // ...
    'host' => 'errbit.example.com', // put your errbit host here
    // ...
]);
```

### remoteConfig

[](#remoteconfig)

Configures the remote configuration feature. Every 10 minutes the notifier will make a GET request to Airbrake servers to fetching a JSON document containing configuration settings for your project. The notifier will apply these new settings at runtime. By default, it is enabled.

To disable this feature, configure your notifier with:

```
$notifier = new Airbrake\Notifier([
    // ...
    'remoteConfig' => false,
    // ...
]);
```

Note: it is not recommended to disable this feature. It might negatively impact how your notifier works. Please use this option with caution.

### rootDirectory

[](#rootdirectory)

Configures the root directory of your project. Expects a String or a Pathname, which represents the path to your project. Providing this option helps us to filter out repetitive data from backtrace frames and link to GitHub files from our dashboard.

```
$notifier = new Airbrake\Notifier([
    // ...
    'rootDirectory' => '/var/www/project',
    // ...
]);
```

### environment

[](#environment)

Configures the environment the application is running in. Helps the Airbrake dashboard to distinguish between exceptions occurring in different environments. By default, it's not set.

```
$notifier = new Airbrake\Notifier([
    // ...
    'environment' => 'staging',
    // ...
]);
```

### httpClient

[](#httpclient)

Configures the underlying http client that must implement `GuzzleHttp\ClientInterface`.

```
// Supply your own client.
$client = new Airbrake\Http\GuzzleClient(
    new GuzzleHttp\Client(['timeout' => 3])
);

$notifier = new Airbrake\Notifier([
    // ...
    'httpClient' => $client,
    // ...
]);
```

### Filtering keys

[](#filtering-keys)

With `keysBlocklist` option you can specify list of keys containing sensitive information that must be filtered out, e.g.:

```
$notifier = new Airbrake\Notifier([
    // ...
    'keysBlocklist' => ['/secret/i', '/password/i'],
    // ...
]);
```

Running tests
-------------

[](#running-tests)

```
composer install
vendor/bin/phpunit
```

PHPDoc
------

[](#phpdoc)

```
composer require phpdocumentor/phpdocumentor
vendor/bin/phpdoc -d src
firefox output/index.html
```

Contact
-------

[](#contact)

In case you have a problem, question or a bug report, feel free to:

- [file an issue](https://github.com/airbrake/phpbrake/issues)
- [send us an email](mailto:support@airbrake.io)

License
-------

[](#license)

PHPBrake is licensed under [The MIT License (MIT)](LICENSE).

###  Health Score

15

—

LowBetter than 3% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity21

Early-stage or recently created project

 Bus Factor1

Top contributor holds 71.7% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/1d52c0f4fbfdeb281be35f22f99d19736b8e3a7cddbdf03f9f7627629811075a?d=identicon)[coamw2](/maintainers/coamw2)

---

Top Contributors

[![vmihailenco](https://avatars.githubusercontent.com/u/290976?v=4)](https://github.com/vmihailenco "vmihailenco (129 commits)")[![kyrylo](https://avatars.githubusercontent.com/u/1079123?v=4)](https://github.com/kyrylo "kyrylo (9 commits)")[![aminin](https://avatars.githubusercontent.com/u/329494?v=4)](https://github.com/aminin "aminin (6 commits)")[![andrewwallistoptal](https://avatars.githubusercontent.com/u/105504143?v=4)](https://github.com/andrewwallistoptal "andrewwallistoptal (5 commits)")[![vinkla](https://avatars.githubusercontent.com/u/499192?v=4)](https://github.com/vinkla "vinkla (5 commits)")[![mmcdaris](https://avatars.githubusercontent.com/u/940237?v=4)](https://github.com/mmcdaris "mmcdaris (4 commits)")[![thompiler](https://avatars.githubusercontent.com/u/2172513?v=4)](https://github.com/thompiler "thompiler (4 commits)")[![ethanpooley](https://avatars.githubusercontent.com/u/856884?v=4)](https://github.com/ethanpooley "ethanpooley (3 commits)")[![anmic](https://avatars.githubusercontent.com/u/3912070?v=4)](https://github.com/anmic "anmic (3 commits)")[![nebez](https://avatars.githubusercontent.com/u/4693030?v=4)](https://github.com/nebez "nebez (2 commits)")[![sagikazarmark](https://avatars.githubusercontent.com/u/1226384?v=4)](https://github.com/sagikazarmark "sagikazarmark (2 commits)")[![bcrowe](https://avatars.githubusercontent.com/u/752603?v=4)](https://github.com/bcrowe "bcrowe (1 commits)")[![danielpieper](https://avatars.githubusercontent.com/u/1621848?v=4)](https://github.com/danielpieper "danielpieper (1 commits)")[![stuartmoore1023](https://avatars.githubusercontent.com/u/22456363?v=4)](https://github.com/stuartmoore1023 "stuartmoore1023 (1 commits)")[![themizzi](https://avatars.githubusercontent.com/u/1450775?v=4)](https://github.com/themizzi "themizzi (1 commits)")[![TheoKouzelis](https://avatars.githubusercontent.com/u/4980126?v=4)](https://github.com/TheoKouzelis "TheoKouzelis (1 commits)")[![mauriciovillalobos](https://avatars.githubusercontent.com/u/8905916?v=4)](https://github.com/mauriciovillalobos "mauriciovillalobos (1 commits)")[![ilpaijin](https://avatars.githubusercontent.com/u/1640113?v=4)](https://github.com/ilpaijin "ilpaijin (1 commits)")[![mike-sheppard](https://avatars.githubusercontent.com/u/1690006?v=4)](https://github.com/mike-sheppard "mike-sheppard (1 commits)")

### Embed Badge

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

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

###  Alternatives

[psr/log

Common interface for logging libraries

10.4k1.2B9.2k](/packages/psr-log)[itsgoingd/clockwork

php dev tools in your browser

5.9k27.6M94](/packages/itsgoingd-clockwork)[graylog2/gelf-php

A php implementation to send log-messages to a GELF compatible backend like Graylog2.

41838.2M138](/packages/graylog2-gelf-php)[bugsnag/bugsnag-psr-logger

Official Bugsnag PHP PSR Logger.

32132.5M2](/packages/bugsnag-bugsnag-psr-logger)[consolidation/log

Improved Psr-3 / Psr\\Log logger based on Symfony Console components.

15462.2M7](/packages/consolidation-log)[datadog/php-datadogstatsd

An extremely simple PHP datadogstatsd client

19124.6M15](/packages/datadog-php-datadogstatsd)

PHPackages © 2026

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