PHP code example of holidaypirates / bugsnag-lumen
1. Go to this page and download the library: Download holidaypirates/bugsnag-lumen library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
holidaypirates / bugsnag-lumen example snippets
# Copy config/bugsnag.php from package to project config, change vaules and register config file in `bootstrap/app.php`
$app->configure('bugsnag');
# Add `BugsnagLumenServiceProvider` to the `bootstrap/app.php`
$app->register('HolidayPirates\BugsnagLumen\BugsnagLumenServiceProvider')
# DELETE this line
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
# ADD this line instead
use HolidayPirates\BugsnagLumen\BugsnagExceptionHandler as ExceptionHandler
namespace App\Exceptions;
use Exception;
use HolidayPirates\BugsnagLumen\BugsnagExceptionHandler as ExceptionHandler;
class Handler extends ExceptionHandler {
...
}
app('bugsnag')->setBeforeNotifyFunction("before_bugsnag_notify");
function before_bugsnag_notify($error) {
// Do any custom error handling here
// Also add some meta data to each error
$error->setMetaData(array(
"user" => array(
"name" => "James",
"email" => "[email protected]"
)
));
}
app('bugsnag')->notifyException(new Exception("Something bad happened"));
app('bugsnag')->notifyError("ErrorType", "Something bad happened here too");