PHPackages                             airbrake/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. [HTTP &amp; Networking](/categories/http)
4. /
5. airbrake/phpbrake

ActiveLibrary[HTTP &amp; Networking](/categories/http)

airbrake/phpbrake
=================

Airbrake exception and error notifier for PHP

v1.0.0(2y ago)492.0M↓10.2%34[8 issues](https://github.com/airbrake/phpbrake/issues)[5 PRs](https://github.com/airbrake/phpbrake/pulls)20MITPHPPHP &gt;=8.1

Since Jul 16Pushed 2y ago12 watchersCompare

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

READMEChangelogDependencies (7)Versions (44)Used By (20)

 [![](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 8.2 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)

Run via docker:

```
docker compose run tests

```

Or run locally

```
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

52

—

FairBetter than 96% of packages

Maintenance17

Infrequent updates — may be unmaintained

Popularity55

Moderate usage in the ecosystem

Community41

Growing community involvement

Maturity84

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 70.1% 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 ~82 days

Recently: every ~338 days

Total

38

Last Release

894d ago

Major Versions

v0.8.0 → v1.0.02023-12-07

PHP version history (3 changes)v0.0.7PHP &gt;=5.3.3

v0.0.8PHP &gt;=5.4

v1.0.0PHP &gt;=8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/85b303a76213bdbf786b64e5385bef2e7accd4c44074a05bee06cd14358863ed?d=identicon)[gary\_rafferty](/maintainers/gary_rafferty)

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

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

---

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)")[![mmcdaris](https://avatars.githubusercontent.com/u/940237?v=4)](https://github.com/mmcdaris "mmcdaris (9 commits)")[![aminin](https://avatars.githubusercontent.com/u/329494?v=4)](https://github.com/aminin "aminin (6 commits)")[![vinkla](https://avatars.githubusercontent.com/u/499192?v=4)](https://github.com/vinkla "vinkla (5 commits)")[![thompiler](https://avatars.githubusercontent.com/u/2172513?v=4)](https://github.com/thompiler "thompiler (4 commits)")[![gbirke](https://avatars.githubusercontent.com/u/223326?v=4)](https://github.com/gbirke "gbirke (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)")[![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)")[![danielpieper](https://avatars.githubusercontent.com/u/1621848?v=4)](https://github.com/danielpieper "danielpieper (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)")[![mauriciovillalobos](https://avatars.githubusercontent.com/u/8905916?v=4)](https://github.com/mauriciovillalobos "mauriciovillalobos (1 commits)")[![bcrowe](https://avatars.githubusercontent.com/u/752603?v=4)](https://github.com/bcrowe "bcrowe (1 commits)")

---

Tags

airbrakeerror-reportingguzzlenotifierphploggingexceptionerrornotifierairbrake

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

###  Alternatives

[justbetter/magento2-sentry

Magento 2 Logger for Sentry

1851.5M3](/packages/justbetter-magento2-sentry)[bilfeldt/laravel-http-client-logger

A logger for the Laravel HTTP Client

1531.6M3](/packages/bilfeldt-laravel-http-client-logger)[gmponos/guzzle_logger

A Guzzle middleware to log request and responses automatically

772.2M6](/packages/gmponos-guzzle-logger)[guanguans/laravel-exception-notify

Monitor exception and report to the notification channels(Log、Mail、AnPush、Bark、Chanify、DingTalk、Discord、Gitter、GoogleChat、IGot、Lark、Mattermost、MicrosoftTeams、NowPush、Ntfy、Push、Pushback、PushBullet、PushDeer、PushMe、Pushover、PushPlus、QQ、RocketChat、ServerChan、ShowdocPush、SimplePush、Slack、Telegram、WeWork、WPush、XiZhi、YiFengChuanHua、ZohoCliq、ZohoCliqWebHook、Zulip).

14642.7k1](/packages/guanguans-laravel-exception-notify)[middlewares/error-handler

Middleware to handle http errors

14104.2k13](/packages/middlewares-error-handler)[phptek/sentry

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

15203.5k3](/packages/phptek-sentry)

PHPackages © 2026

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