Skip to content

Latest commit

 

History

History
63 lines (53 loc) · 2.04 KB

README.md

File metadata and controls

63 lines (53 loc) · 2.04 KB

errorstream-laravel

Laravel integration with Errorstream.

#Installation Instructions

First, run the following command on the terminal to download and install the package

composer require errorstream/errorstream-laravel 1.*

Next, register the service provider in the config/app.php file.

'providers' => [
     // ...
     ErrorStream\ErrorStream\ErrorStreamServiceProvider::class,
]

Then hook into the App/Exceptions/Handler.php file to send errors to our service.

public function report(Exception $e)
{
     if ($this->shouldReport($e)) {
           app('errorstream')->reportException($e);
     }
     parent::report($e);
}

Add the following two configuration entries into .env. You can find your API key and project token on the project settings page for the project you wish to integrate.

ERROR_STREAM_API_TOKEN=YOUR_API_TOKEN
ERROR_STREAM_PROJECT_TOKEN=YOUR_PROJECT_TOKEN

Finally, Add the errorstream config entries in your config/services.php

'errorstream' => [
    'api_token'    => env('ERROR_STREAM_API_TOKEN'),
    'project_token' => env('ERROR_STREAM_PROJECT_TOKEN'),
],

#Tagging Anywhere within your application you can append tags on to the reports that you generate and send to errorstream.com. Tags are great for grouping code together. You can make a call to add a tag anywhere by calling addTag(). A great place to do this would be to extend your Handler class modifications. For example:

public function report(Exception $e)
{
     if ($this->shouldReport($e)) {
          app('errorstream')->addTag('v1.0.2');
          app('errorstream')->reportException($e);
     }
     parent::report($e);
}

#Adding Context Sometimes you'll need additional information in order to diagnose issues. Context is great for adding more information to errors. Maybe you want to send a build number, user id, or anything else. You can use this in anywhere in your laravel application

app('errorstream')->addContext('some more details about variables that are set');