ldubois/cake-bugsnag

bugsnag plugin for CakePHP4

Installs: 3 652

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 1

Open Issues: 0

Type:cakephp-plugin

1.1.0 2022-06-20 14:49 UTC

This package is auto-updated.

Last update: 2024-03-20 18:55:11 UTC


README

CakePHP integration for Bugsnag.

Requirements

  • PHP 7.1+
  • CakePHP 4.0+
  • and Bugsnag account

Installation

With composer install.

composer require ldubois/cake-bugsnag

Usage

Set config files.

Write your Bugsnag account info.

// in `config/app.php`
return [
  'Bugsnag' => [
    'apiKey' => YOUR_Bugsnag_apiKey,
    'userId' => YOUR_SESSION_USER_ID,//default => Auth.User.id in Session
    'userName' => YOUR_SESSION_USER_NAME //default => Auth.User.name in Session
  ]
];

Loading plugin.

In Application.php

public function bootstrap()
{
    parent::bootstrap();

    $this->addPlugin(\ldubois\Bugsnag\Plugin::class);
}

Or use cake command.

bin/cake plugin load ldubois/Bugsnag --bootstrap

That's all! 🎉

Advanced Usage

Ignore noisy exceptions

You can filter out exceptions that make a fuss and harder to determine the issues to address(like PageNotFoundException) Set exceptions not to log in Error.skipLog.

ex)

// in `config/app.php`
'Error' => [
    'skipLog' => [
        NotFoundException::class,
        MissingRouteException::class,
        MissingControllerException::class,
    ],
]

ref: CakePHP Cookbook
https://book.cakephp.org/4/en/development/errors.html#error-exception-configuration