PHPackages                             bugban/codeigniter - 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/codeigniter

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

bugban/codeigniter
==================

Bugban error &amp; monitoring SDK — CodeIgniter 3 &amp; 4 adapter.

v1.5.3(1mo ago)010↓75%MITPHPPHP &gt;=7.0

Since Jul 15Pushed 1mo agoCompare

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

READMEChangelogDependencies (2)Versions (11)Used By (0)

bugban/codeigniter
==================

[](#bugbancodeigniter)

CodeIgniter adapter for the [Bugban](https://bugban.online) error &amp; monitoring SDK. Works with **CodeIgniter 3 and CodeIgniter 4**, and even in composer-free legacy projects. PHP **7.0+**.

Install (Composer)
------------------

[](#install-composer)

```
composer require bugban/codeigniter
```

Set your credentials as environment variables (in `.env` or the server env):

```
BUGBAN_API_KEY=bb_xxxxxxxxxxxxxxxx
BUGBAN_HOST=https://bugban.online
```

---

CodeIgniter 3
-------------

[](#codeigniter-3)

### Option A — hooks (recommended)

[](#option-a--hooks-recommended)

1. Enable hooks in `application/config/config.php`:

    ```
    $config['enable_hooks'] = TRUE;
    ```
2. Register the hook in `application/config/hooks.php` on `pre_system`:

    ```
    $hook['pre_system'] = array(
        'class'    => 'Bugban\\CodeIgniter\\Hooks\\BugbanHook',
        'function' => '__construct',
        'filename' => '', // loaded via Composer autoloader
        'filepath' => '',
    );
    ```

    The hook reads `BUGBAN_API_KEY` and `BUGBAN_HOST` from the environment and boots the SDK (init + register global handlers) automatically.

### Option B — composer-free (legacy)

[](#option-b--composer-free-legacy)

If you cannot run Composer, require the core SDK's manual autoloader directly in `index.php` (before CodeIgniter bootstraps):

```
require __DIR__ . '/path/to/bugban-php-sdk/autoload.php';

\Bugban\Sdk\Bugban::init([
    'api_key' => getenv('BUGBAN_API_KEY') ?: 'bb_xxxxxxxxxxxxxxxx',
    'host'    => 'https://bugban.online',
]);
\Bugban\Sdk\Bugban::registerHandlers();
```

> ⚠️ **CI3 caveat:** CodeIgniter 3 calls `set_exception_handler()` during its own bootstrap, which *replaces* the handler you register in `index.php`. So the `index.php` approach alone captures **manual** `Bugban::capture($e)` calls but **not uncaught exceptions**. For automatic capture of uncaught exceptions in CI3, use **Option A (the `pre_system` hook)** — it runs *after* CI3 installs its handler and re-registers Bugban's, so Bugban wins.

---

CodeIgniter 4
-------------

[](#codeigniter-4)

Register a `pre_system` event in `app/Config/Events.php`:

```
Events::on('pre_system', static function () {
    \Bugban\CodeIgniter\BugbanCI::boot([
        'api_key' => getenv('BUGBAN_API_KEY'),
        'host'    => getenv('BUGBAN_HOST'),
    ]);
});
```

`BugbanCI::boot()` initializes the SDK and registers global error, exception and shutdown handlers.

---

Slow query monitoring
---------------------

[](#slow-query-monitoring)

Queries slower than `slow_query_ms` (default 1000 ms, pass it in the `boot()`config array) are batched and sent non-blocking at shutdown. Disable with `'capture_queries' => false`.

- **CodeIgniter 4** — automatic: `boot()` subscribes to the framework's `DBQuery` event. Works with any DB driver (MySQLi, Postgre, SQLite3, ...).
- **CodeIgniter 3** — no query event exists, so call this once late in the request (e.g. a `post_system` hook). It reads the driver's built-in query log (`save_queries` must stay enabled — it is by default):

    ```
    \Bugban\CodeIgniter\BugbanCI::flushCi3Queries();
    ```

    Or record individual queries manually from anywhere:

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

---

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

[](#manual-capture)

Anywhere in your app:

```
use Bugban\CodeIgniter\BugbanCI;

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

Or via the core facade:

```
\Bugban\Sdk\Bugban::captureMessage('Payment gateway timeout', '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()`:

```
\Bugban\Sdk\Bugban::init([
    'api_key'      => 'bb_xxxxxxxx',
    'host'         => 'https://bugban.online',
    'capture_logs' => true,
    'log_level'    => 'error', // minimum PSR level forwarded
]);

// Anywhere you'd log an error:
\Bugban\Sdk\Bugban::recordLog('error', 'Payment gateway timeout', ['order_id' => 123]);

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

36

—

LowBetter than 79% of packages

Maintenance92

Actively maintained with recent releases

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity35

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

Total

10

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 (10 commits)")

---

Tags

monitoringcodeigniterexceptionserror-trackingbugban

### Embed Badge

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

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

###  Alternatives

[rollbar/rollbar

Monitors errors and exceptions and reports them to Rollbar

34425.6M91](/packages/rollbar-rollbar)[honeybadger-io/honeybadger-laravel

Honeybadger Laravel integration

431.4M](/packages/honeybadger-io-honeybadger-laravel)[honeybadger-io/honeybadger-php

Honeybadger PHP library

381.7M5](/packages/honeybadger-io-honeybadger-php)[lordsimal/cakephp-sentry

Sentry plugin for CakePHP

12355.2k](/packages/lordsimal-cakephp-sentry)[inspector-apm/inspector-symfony

Code Execution Monitoring for Symfony applications.

2845.3k11](/packages/inspector-apm-inspector-symfony)

PHPackages © 2026

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