LaravelPackages.net
Acme Inc.
Toggle sidebar
crashub-com/crashub-laravel

Crashub client for your Laravel project

528
0
v0.3.0
About crashub-com/crashub-laravel

crashub-com/crashub-laravel is a Laravel package for crashub client for your laravel project. It currently has 0 GitHub stars and 528 downloads on Packagist (latest version v0.3.0). Install it with composer require crashub-com/crashub-laravel. Discover more Laravel packages by crashub-com or browse all Laravel packages to compare alternatives.

Last updated

Crashub client for your Laravel project

Use this library to start reporting exceptions to Crashub.

Install

Install the crashub-laravel package via composer:

composer require crashub-com/crashub-laravel

Add Crashub reporting to app/Exceptions/Handler.php (Laravel version 8/9):

public function register()
{
    $this->reportable(function (\Throwable $e) {
        if (app()->bound('crashub')) {
            app('crashub')->report($e);
        }
    });
}

Run the crashub:install artisan command:

php artisan crashub:install <project key>

Your application should now report uncaught errors to Crashub.

Add context to errors

You can add custom context to the errors in the form of key/value pairs.

To add global context, use the $crashub->context() method:

$crashub->context('key', $value);

You can add multiple items:

$crashub->context([
    'key1' => $value1,
    'key2' => $value2,
]);

To add context to a particular error notification, pass an associative array to $crashub->report():

$crashub->report($e, ['key' => $value]);
Comments