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

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

bugban/yii2
===========

Bugban error &amp; monitoring SDK — Yii2 extension that auto-captures exceptions.

v1.5.3(1mo ago)02MITPHPPHP &gt;=7.0

Since Jul 15Pushed 1mo agoCompare

[ Source](https://github.com/Umid-ismayilov/bugban-yii2)[ Packagist](https://packagist.org/packages/bugban/yii2)[ RSS](/packages/bugban-yii2/feed)WikiDiscussions main Synced 1w ago

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

bugban/yii2
===========

[](#bugbanyii2)

Yii2 extension for the [Bugban](https://bugban.online) error &amp; monitoring SDK. It auto-captures unhandled exceptions by swapping in a Bugban-aware `errorHandler` component and initializes the framework-agnostic `bugban/php-sdk` core for you.

Compatible with `yiisoft/yii2` **&gt;=2.0** and PHP **7.0+**.

Install
-------

[](#install)

```
composer require bugban/yii2
```

Configure — web app (`config/web.php`)
--------------------------------------

[](#configure--web-app-configwebphp)

Register the bootstrap and swap the `errorHandler` component:

```
return [
    // ...
    'bootstrap' => ['bugban'],
    'components' => [
        'bugban' => ['class' => \Bugban\Yii2\Bootstrap::class],
        'errorHandler' => ['class' => \Bugban\Yii2\WebErrorHandler::class],
    ],
    'params' => [
        'bugban' => [
            'api_key' => 'bb_xxx',
            'host' => 'https://bugban.online',
            'environment' => 'production',
            // 'capture_queries' => true,   // slow-query monitoring (default: on)
            // 'slow_query_ms' => 1000,     // report queries slower than this (ms)
        ],
    ],
];
```

**Slow query monitoring** — automatic: at the end of each request the extension reads Yii's built-in DB profiling (`yii\db\Command::query` / `::execute`, enabled by default via `Connection::$enableProfiling`) and reports queries slower than `slow_query_ms` to Bugban in one non-blocking batch. Works with any Yii2 DB driver (MySQL, PostgreSQL, SQLite, ...). You can also record manually:

```
\Bugban\Sdk\Bugban::recordQuery($sql, $durationMs, ['connection' => 'mysql']);
```

Configure — console app (`config/console.php`)
----------------------------------------------

[](#configure--console-app-configconsolephp)

```
return [
    // ...
    'bootstrap' => ['bugban'],
    'components' => [
        'bugban' => ['class' => \Bugban\Yii2\Bootstrap::class],
        'errorHandler' => ['class' => \Bugban\Yii2\ConsoleErrorHandler::class],
    ],
    'params' => [
        'bugban' => [
            'api_key' => 'bb_xxx',
            'host' => 'https://bugban.online',
            'environment' => 'production',
        ],
    ],
];
```

That's it — unhandled exceptions are now reported to Bugban automatically. The `bugban` component reads its config from `params['bugban']`; it no-ops if `api_key` is empty.

Manual capture
--------------

[](#manual-capture)

You can also report manually anywhere in your app:

```
use Bugban\Sdk\Bugban;

try {
    // ...
} catch (\Throwable $e) {
    Bugban::capture($e);
}

// Or a message:
Bugban::captureMessage('Something noteworthy happened', 'warning');
```

Configuration reference
-----------------------

[](#configuration-reference)

KeyTypeDefault`api_key`string`''``host`string`https://bugban.online``environment`string`production``release`string`null``enabled`bool`true``capture_requests`bool`false``capture_queries`bool`true``slow_query_ms`int`1000``sample_rate`float`1.0``redact`array`[]``capture_logs`bool`false``log_level`string`error`Log capture (errors logged but not thrown)
------------------------------------------

[](#log-capture-errors-logged-but-not-thrown)

Errors you catch and log without re-throwing only reach the log file. Enable `capture_logs` and forward them to Bugban with `recordLog()`:

```
// In the component config (see above), add:
//   'capture_logs' => true,
//   'log_level'    => 'error',

// Anywhere you'd log an error (e.g. a Yii::error wrapper or directly):
\Bugban\Sdk\Bugban::recordLog('error', 'Queue job failed', ['job' => $id]);

// Caught-and-logged throwable (attach it for a full stacktrace):
try { risky(); } catch (\Throwable $e) {
    \Bugban\Sdk\Bugban::recordLog('error', $e->getMessage(), ['exception' => $e]);
}
```

Records below `log_level` are dropped; context is redacted; `recordLog()` never throws.

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance92

Actively maintained with recent releases

Popularity2

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity34

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% 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 ~1 days

Total

9

Last Release

38d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/49947736?v=4)[Umid Ismayilov](/maintainers/Umid-ismayilov)[@Umid-ismayilov](https://github.com/Umid-ismayilov)

---

Top Contributors

[![Umid-ismayilov](https://avatars.githubusercontent.com/u/49947736?v=4)](https://github.com/Umid-ismayilov "Umid-ismayilov (9 commits)")

---

Tags

monitoringexceptionsyii2yiierror-trackingbugban

### Embed Badge

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

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

###  Alternatives

[craftcms/cms

Craft CMS

3.6k3.7M3.5k](/packages/craftcms-cms)[skeeks/cms

SkeekS CMS — control panel and tools based on php framework Yii2

13926.0k66](/packages/skeeks-cms)[baibaratsky/yii2-rollbar

Rollbar for Yii2

35135.2k](/packages/baibaratsky-yii2-rollbar)

PHPackages © 2026

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