项目作者: absszero

项目描述 :
Stackdriver Error Reporting for Laravel
高级语言: PHP
项目地址: git://github.com/absszero/laravel-stackdriver-error-reporting.git
创建时间: 2018-08-31T12:34:01Z
项目社区:https://github.com/absszero/laravel-stackdriver-error-reporting

开源协议:MIT License

下载


Stackdriver Error Reporting for Laravel

actions/workflows/run-tests.yaml

Requirements

Laravel 5.1 ~ 12.x

Installation

  1. composer require absszero/laravel-stackdriver-error-reporting

    (For PHP7 and before version. please install v1.8.0)

  2. This package provides Package Auto-Discovery.

    For Laravel versions before 5.5, you need to add the ServiceProvider in config/app.php

    1. <?php
    2. ...
    3. 'providers' => [
    4. Absszero\ErrorReportingServiceProvider::class,
  3. php artisan vendor:publish --provider="Absszero\ErrorReportingServiceProvider"

Configuration

  1. Get service account credentials
    with the role logging.logWriter (docs)

  2. Store the key file in your project directory and refer to it in your .env like this:

    1. GOOGLE_APPLICATION_CREDENTIALS=/My_Authentication.json
  3. For Laravel 11 and after versions. Edit bootstrap/app.php.

    1. ->withExceptions(function (Exceptions $exceptions) {
    2. $exceptions->report(function (\Throwable $e) {
    3. (new \Absszero\ErrorReporting)->report($e);
    4. });
  1. For Laravel 10 and before versions. Edit app/Exceptions/Handler.php.

    For Laravel 9 and after versions.

    1. <?php
    2. public function register()
    3. {
    4. $this->reportable(function (Throwable $e) {
    5. (new \Absszero\ErrorReporting)->report($e);
    6. });
    7. }

    For PHP version before 7, replace \Throwable with \Exception.

    1. <?php
    2. public function report(\Throwable $exception)
    3. {
    4. parent::report($exception);
    5. if ($this->shouldReport($exception)) {
    6. (new \Absszero\ErrorReporting)->report($exception);
    7. }
    8. }

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

Credits

TODO: Write credits

License

This project is licensed under the MIT License - see the LICENSE file for details