PHP code example of absszero / laravel-stackdriver-error-reporting

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

    

absszero / laravel-stackdriver-error-reporting example snippets


    
    ...
    'providers' => [
        Absszero\ErrorReportingServiceProvider::class,
    

        ->withExceptions(function (Exceptions $exceptions) {
            $exceptions->report(function (\Throwable $e) {
                (new \Absszero\ErrorReporting)->report($e);
            });
    

    
        public function register()
        {
            $this->reportable(function (Throwable $e) {
                (new \Absszero\ErrorReporting)->report($e);
            });
        }
    

    
        public function report(\Throwable $exception)
        {
            parent::report($exception);
            if ($this->shouldReport($exception)) {
                (new \Absszero\ErrorReporting)->report($exception);
            }
        }