This is the client library for integrating apps with the ⚡ Honeybadger Exception Notifier for PHP.
- Laravel - honeybadger-io/honeybadger-laravel
You can install the package via composer:
composer require honeybadger-io/honeybadger-php
$honeybadger = Honeybadger::new([
'api_key' => 'abc123'
]);
try {
throw new Exception('Whoops!');
} catch (Exception $e) {
// You can optionally include your own
// \Symfony\Component\HttpFoundation\Request::class request.
$honeybadger->notify($e, $app->request());
}
See the Honeybadger API documentation. All fields except the notifier
are valid.
$honeybadger = Honeybadger::new([
'api_key' => 'abc123'
]);
$honeybadger->customNotification([
'title' => 'Special Error',
'message' => 'Special Error: a special error has occurred',
]);
$honeybadger->context('foo', 'bar');
$honeybadger = Honeybadger::new([
'api_key' => 'abc123'
]);
$honeybadger->checkin('1234');
Default values are listed below.
[
// Honeybadger API Key
'api_key' => null,
'environment' => [
// Environment keys to filter before the payload sent to Honeybadger (see Environment Whitelist)
'filter' => [],
// Additional environment keys to include (see Environment Whitelist)
'include' => [],
],
'request' => [
// Request keys to filter before the payload sent to Honeybadger
'filter' => [
'password',
'password_confirmation'
],
],
// Application version
'version' => '',
// System hostname
'hostname' => gethostname(),
// Project root (/var/www)
'project_root' => '',
// Application environment name
'environment_name' => 'production',
'handlers' => [
// Enable global exception handler
'exception' => true,
// Enable global error handler
'error' => true,
],
'client' => [
// Request timeout length (default: indefinite)
'timeout' => 0,
// Request proxy settings
'proxy' => [
// Use this proxy with 'http' (tcp://username:password@localhost:8125)
'http' => '',
// Use this proxy with 'https' (tcp://username:password@localhost:8125)
'https' => '',
],
],
// Exclude exceptions from being reported
'excluded_exceptions' => [],
]
Note: All HTTP_*
keys are included by default.
All whitelisted keys
'PHP_SELF'
'argv'
'argc'
'GATEWAY_INTERFACE'
'SERVER_ADDR'
'SERVER_NAME'
'SERVER_SOFTWARE'
'SERVER_PROTOCOL'
'REQUEST_METHOD'
'REQUEST_TIME'
'REQUEST_TIME_FLOAT'
'QUERY_STRING'
'DOCUMENT_ROOT'
'HTTPS'
'REMOTE_ADDR'
'REMOTE_HOST'
'REMOTE_PORT'
'REMOTE_USER'
'REDIRECT_REMOTE_USER'
'SCRIPT_FILENAME'
'SERVER_ADMIN'
'SERVER_PORT'
'SERVER_SIGNATURE'
'PATH_TRANSLATED'
'SCRIPT_NAME'
'REQUEST_URI'
'PHP_AUTH_DIGEST'
'PHP_AUTH_USER'
'PHP_AUTH_PW'
'AUTH_TYPE'
'PATH_INFO'
'ORIG_PATH_INFO'
'APP_ENV'
If there is an error contacting Honeybadger a \Honeybadger\Exceptions\ServiceException::class
will be thrown with a relevant exception message.
composer test
In addition to the php-cs-fixer rules, StyleCI will apply the Laravel preset.
composer styles:lint
composer styles:fix
Please see CHANGELOG for more information what has changed recently.
Please see CONTRIBUTING for details.
If you discover any security related issues, please email oss@tjmiller.co instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.