PHP code example of errorstream / errorstream-laravel

1. Go to this page and download the library: Download errorstream/errorstream-laravel 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/ */

    

errorstream / errorstream-laravel example snippets


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

'aliases' => [
    // ...
    'ErrorStream' => ErrorStream\ErrorStream\Facades\ErrorStream::class,
]

public function report(Exception $e)
{
    if ($this->shouldReport($exception) && config('services.errorstream.enabled')) {
        ErrorStream::reportException($exception);
    }
     parent::report($e);
}

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

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

ErrorStream::addContext('some more details about variables that are set');
bash
ERROR_STREAM_API_TOKEN=YOUR_API_TOKEN
ERROR_STREAM_PROJECT_TOKEN=YOUR_PROJECT_TOKEN
ERROR_STREAM_ENABLED=1