PHPackages                             fuckbug/fuckbug - 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. fuckbug/fuckbug

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

fuckbug/fuckbug
===============

PHP SDK for FuckBug (https://fuckbug.io)

1.0.0(10mo ago)14MITPHPPHP &gt;=7.1CI passing

Since Jul 6Pushed 10mo agoCompare

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

READMEChangelog (1)Dependencies (12)Versions (2)Used By (0)

Official FuckBug SDK for PHP
============================

[](#official-fuckbug-sdk-for-php)

FuckBug is a developer-focused wrapper for all your PHP loggers. It provides a unified, flexible interface to handle logging and error monitoring across different providers, with support for multiple log levels and context enrichment.

🚀 Quick Start
-------------

[](#-quick-start)

### Install

[](#install)

Install the SDK using [Composer](https://getcomposer.org/).

```
composer require fuckbug/fuckbug
```

### Configuration

[](#configuration)

Initialize the SDK as early as possible in your application

```
\FuckBug\FuckBug::init([
    new \FuckBug\Core\ProviderSetup(
        \FuckBug\Providers\FuckBugProvider::create('__PUBLIC_DSN__'),
        true, // enable catching Throwable
        false // disable Debug level logs
    )
]);
```

### Usage

[](#usage)

#### Log exceptions using `wtf()`

[](#log-exceptions-using-wtf)

```
try {
    throw new \Exception('foo bar');
} catch (\Exception $exception) {
    \FuckBug\FuckBug::getInstance()->wtf($exception);
}
```

#### Log messages with severity levels

[](#log-messages-with-severity-levels)

```
\FuckBug\FuckBug::getInstance()->warning('User not found', ['userId' => 8]);
```

⚙️ Custom and Multiple Providers
--------------------------------

[](#️-custom-and-multiple-providers)

#### Create your own Provider

[](#create-your-own-provider)

```
use FuckBug\Core\Provider;
use Psr\Log\LoggerTrait;
use Throwable;

class MyCustomProvider implements Provider
{
    use LoggerTrait;

    public function wtf(Throwable $exception, array $context = []): void
    {
        // Your custom logic for handling exceptions
    }

    public function log($level, $message, array $context = []): void
    {
        // Required by the LoggerTrait
    }
}
```

#### Initialize FuckBug with Multiple Providers

[](#initialize-fuckbug-with-multiple-providers)

```
\FuckBug\FuckBug::init([
    new \FuckBug\Core\ProviderSetup(\FuckBug\Providers\FuckBugProvider::create('__PUBLIC_DSN__')),
    new \FuckBug\Core\ProviderSetup(new MyCustomProvider())
]);
```

🕵️ Request Context
------------------

[](#️-request-context)

FuckBug also supports gathering request-specific context information such as IP address, URL, query/body parameters, headers, and more via `RequestContext`. It is recommended to use this class in your custom implementations of the `Provider` interface to enrich logs with useful request metadata.

#### Example with custom Provider

[](#example-with-custom-provider)

```
use FuckBug\Core\Provider;
use FuckBug\Util\RequestContext;
use Psr\Log\LoggerTrait;
use Throwable;

class MyCustomProvider implements Provider
{
    use LoggerTrait;

    /** @var RequestContext */
    private $context;

    public function __construct()
    {
        $this->context = new RequestContext(['password', 'token']);
    }

    public function wtf(Throwable $exception, array $context = []): void
    {
        $context['ip'] = $this->context->getUserIp();
        $context['url'] = $this->context->getUrl();
        $context['method'] = $this->context->getMethod();

        // Send enriched context to your storage/logs/etc.
        error_log('[MyCustomProvider] ' . $exception->getMessage() . ' ' . json_encode($context));
    }

    public function log($level, $message, array $context = []): void
    {
        // Optional: implement log-level handling
    }
}
```

📄 License
---------

[](#-license)

Licensed under the MIT license, see [LICENSE](LICENSE).

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance54

Moderate activity, may be stable

Popularity5

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity31

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

Unknown

Total

1

Last Release

316d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/12c6f72a02f5b02647391583cbae998a4baf4edc3eb917e816b460ac4f977a4f?d=identicon)[Zaytcevcom](/maintainers/Zaytcevcom)

---

Top Contributors

[![zaytcevcom](https://avatars.githubusercontent.com/u/29754767?v=4)](https://github.com/zaytcevcom "zaytcevcom (2 commits)")

---

Tags

logloggingprofilingtracingerror-handlererror-monitoringcrash-reportingcrash-reportsfuckbug

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[sentry/sentry

PHP SDK for Sentry (http://sentry.io)

1.9k227.1M273](/packages/sentry-sentry)[sentry/sentry-laravel

Laravel SDK for Sentry (https://sentry.io)

1.3k114.3M154](/packages/sentry-sentry-laravel)[sentry/sdk

This is a meta package of sentry/sentry. We recommend using sentry/sentry directly.

328134.8M151](/packages/sentry-sdk)[open-telemetry/sdk

SDK for OpenTelemetry PHP.

2322.9M248](/packages/open-telemetry-sdk)

PHPackages © 2026

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