PHPackages                             bugban/php-sdk - 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/php-sdk

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

bugban/php-sdk
==============

Bugban error &amp; monitoring SDK — framework-agnostic PHP core (captures exceptions, requests, auth &amp; session).

v1.5.3(1mo ago)066↓71.7%4MITPHPPHP &gt;=7.0

Since Jul 15Pushed 1mo agoCompare

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

READMEChangelogDependencies (2)Versions (13)Used By (4)

Bugban PHP SDK
==============

[](#bugban-php-sdk)

Error &amp; monitoring SDK for **any** PHP project — captures **exceptions, requests, auth user &amp; session** and ships them to your Bugban platform.

- ✅ Framework-agnostic core (pure PHP, CodeIgniter, Symfony, WordPress, Slim…)
- ✅ First-class **Laravel** integration (auto exception + request + auth/session capture)
- ✅ **PHP 7.0 → 8.x** compatible (works on legacy hosts)
- ✅ **Manual, Composer-free install** for old projects
- ✅ Fire-and-forget transport — never breaks or slows the host app

Install
-------

[](#install)

### A) Composer (recommended)

[](#a-composer-recommended)

```
composer require bugban/php-sdk
```

From a private/VCS repo (before Packagist), add to the host project's `composer.json`:

```
{
  "repositories": [
    { "type": "vcs", "url": "https://github.com/Umid-ismayilov/bugban.git" }
  ]
}
```

then `composer require bugban/php-sdk`.

### B) Manual (legacy projects, no Composer)

[](#b-manual-legacy-projects-no-composer)

Copy the `bugban-php-sdk` folder into your project and:

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

Usage
-----

[](#usage)

### Pure PHP / any framework

[](#pure-php--any-framework)

```
\Bugban\Sdk\Bugban::init([
    'api_key'     => 'bb_xxxxxxxx',          // from Bugban panel → Projects
    'host'        => 'https://bugban.online',
    'environment' => 'production',
    'release'     => '1.4.2',
]);

// Automatic capture of errors, uncaught exceptions and fatals:
\Bugban\Sdk\Bugban::registerHandlers();

// Manual:
try {
    risky();
} catch (\Throwable $e) {
    \Bugban\Sdk\Bugban::capture($e);
}

// Procedural helpers (legacy code):
bugban_capture($e);
bugban_message('Cache miss', 'warning');
```

### Laravel

[](#laravel)

```
composer require bugban/php-sdk
php artisan vendor:publish --tag=bugban-config   # optional
```

`.env`:

```
BUGBAN_API_KEY=bb_xxxxxxxx
BUGBAN_HOST=https://bugban.online
BUGBAN_CAPTURE_REQUESTS=true

```

That's it — the service provider auto-registers and captures every reported exception together with the authenticated user, session and request. Zero code changes.

### CodeIgniter / old MVC

[](#codeigniter--old-mvc)

In `index.php` (front controller), after the autoloader:

```
require APPPATH . '../libs/bugban-php-sdk/autoload.php';
\Bugban\Sdk\Bugban::init(['api_key' => 'bb_xxx', 'host' => 'https://bugban.online']);
\Bugban\Sdk\Bugban::registerHandlers();
```

Configuration
-------------

[](#configuration)

KeyDefaultMeaning`api_key``''`Public project key (required)`host``https://bugban.online`Bugban platform URL`environment``production`Environment tag`release``null`Version / release string`enabled``true`Master switch`timeout``3`Transport timeout (s)`sample_rate``1.0`0–1 fraction of events to send`capture_requests``false`Push per-request performance logs`capture_logs``false`Forward `Bugban::recordLog()` records (Log::error+, caught-and-logged) as events`log_level``error`Minimum PSR level forwarded when `capture_logs` is on`capture_queries``true`Slow-query (performance) monitoring master switch`slow_query_ms``1000`Only queries slower than this (ms) are reported`redact`common secretsKeys scrubbed before sending`before_send``null``fn(array $payload): ?array` filter/mutate`code_context_lines``5`Fallback source window (± lines) around each frame`code_full_function``true`Capture the ENTIRE enclosing function/method body per frame (falls back to the ± window when unresolvable)Slow query monitoring
---------------------

[](#slow-query-monitoring)

Works with **any** database (MySQL, PostgreSQL, SQLite, ...) — the SDK just reports SQL text + duration. Queries faster than `slow_query_ms` are dropped; slow ones are batched into a single non-blocking POST at shutdown (max 25 per request).

**Manual — any framework, any DB layer** (report the duration in milliseconds):

```
$start = microtime(true);
$rows = $db->fetchAll($sql, $params);
\Bugban\Sdk\Bugban::recordQuery($sql, (microtime(true) - $start) * 1000, array(
    'connection' => 'mysql',        // optional
    'bindings'   => $params,        // optional
));
```

**Automatic — pure PHP with PDO**: use the drop-in `TracedPdo` (times `query()`, `exec()` and prepared `execute()` automatically):

```
$pdo = new \Bugban\Sdk\Support\TracedPdo('mysql:host=localhost;dbname=app', $user, $pass);
// use exactly like \PDO
```

The caller file/line (first frame outside `vendor/`), request URL + method, and redacted/capped bindings are attached automatically. Framework adapters (`bugban/laravel`, `bugban/codeigniter`, `bugban/yii2`) wire this up automatically.

Log capture
-----------

[](#log-capture)

Errors that are logged but never thrown — `Log::error(...)`, `try { ... } catch ($e) { log_it($e); }` — only reach your log file by default. Enable `capture_logs` and forward them to Bugban with `recordLog()`:

```
\Bugban\Sdk\Bugban::init(array(
    'api_key'      => 'bb_xxxxxxxx',
    'host'         => 'https://bugban.online',
    'capture_logs' => true,
    'log_level'    => 'error',   // debug|info|notice|warning|error|critical|alert|emergency
));

// Pure message:
\Bugban\Sdk\Bugban::recordLog('error', 'Payment reconciliation mismatch', array('order_id' => 123));

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

Records below `log_level` are dropped. Context is redacted (password/token/secret/authorization/...) and the raw `exception` object is reduced to its class+message. `recordLog()` never throws and is a silent no-op without an api\_key. The **Laravel** adapter wires this automatically (`BUGBAN_CAPTURE_LOGS=true`); other frameworks call `recordLog()` from their log pipeline (e.g. a Monolog handler) or directly.

What gets sent
--------------

[](#what-gets-sent)

`POST {host}/api/ingest/events` with header `X-Bugban-Key: {api_key}` — exception class, message, file/line, stacktrace, request, auth user, session, breadcrumbs, context. Request logs go to `POST {host}/api/ingest/requests`. Slow queries go to `POST {host}/api/ingest/queries` (SQL text, duration ms, connection, caller file/line, url).

API key &amp; plans
-------------------

[](#api-key--plans)

Your API key is issued from the Bugban panel per project and is tied to your plan/subscription. Higher plans raise ingest rate limits and retention.

###  Health Score

39

—

LowBetter than 84% of packages

Maintenance92

Actively maintained with recent releases

Popularity11

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity36

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

12

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

---

Tags

monitoringexceptionserror-trackingbugban

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[rollbar/rollbar

Monitors errors and exceptions and reports them to Rollbar

34425.6M92](/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)
