Skip to content
bliptracedocs

Install an SDK

CodeIgniter 4

Report uncaught CodeIgniter 4 exceptions with a global handler that chains to the framework's own, built on bliptrace/php.

On this page

bliptrace/codeigniter installs a global exception handler that reports to Bliptrace and then hands over to CodeIgniter, so the normal error page still renders. PHP 8.2+.

Install from GitHub. This package is not on Packagist yet. Source: github.com/bliptrace/bliptrace-codeigniter.

Install

composer config repositories.bliptrace-codeigniter vcs https://github.com/bliptrace/bliptrace-codeigniter
composer require bliptrace/codeigniter:dev-main

Configure

Create app/Config/G8Scope.php:

<?php

namespace Config;

use G8Scope\CodeIgniter\Config\G8Scope as BaseConfig;

class G8Scope extends BaseConfig
{
    public bool $enabled = true;
    public ?string $key = null; // set from .env
    public string $endpoint = 'https://ingest.bliptrace.com';
    public string $environment = 'production';
}

Then set the values in .env (CodeIgniter’s dotted style):

bliptrace.enabled     = true
bliptrace.key         = blip_your_key_here
bliptrace.endpoint    = https://ingest.bliptrace.com
bliptrace.environment = production
bliptrace.release     = 1.4.2
bliptrace.timeout     = 3

The base path defaults to ROOTPATH, which marks your own frames as in-app.

Wire it up

// app/Config/Events.php
use CodeIgniter\Events\Events;
use G8Scope\CodeIgniter\G8ScopeHandler;

Events::on('pre_system', static function (): void {
    G8ScopeHandler::register();
});

Using a custom exception handler instead? Call G8ScopeHandler::report($exception, $request); inside its handle() method.

Report a handled exception

use G8Scope\CodeIgniter\G8ScopeHandler;

try {
    risky();
} catch (\Throwable $e) {
    G8ScopeHandler::report($e, service('request'));
}

The authorization, cookie and set-cookie headers are always removed before sending.

Documentation