https://github.com/absszero/laravel-stackdriver-error-reporting
Stackdriver Error Reporting for Laravel
https://github.com/absszero/laravel-stackdriver-error-reporting
error-reporting laravel-5-package laravel-6-package stackdriver
Last synced: 2 months ago
JSON representation
Stackdriver Error Reporting for Laravel
- Host: GitHub
- URL: https://github.com/absszero/laravel-stackdriver-error-reporting
- Owner: absszero
- License: mit
- Created: 2018-08-31T12:34:01.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2025-03-15T05:52:44.000Z (about 1 year ago)
- Last Synced: 2025-10-09T13:53:56.619Z (6 months ago)
- Topics: error-reporting, laravel-5-package, laravel-6-package, stackdriver
- Language: PHP
- Size: 145 KB
- Stars: 9
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# Stackdriver Error Reporting for Laravel

## 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`
```php
[
Absszero\ErrorReportingServiceProvider::class,
```
3. `php artisan vendor:publish --provider="Absszero\ErrorReportingServiceProvider"`
## Configuration
1. Get [service account credentials](https://cloud.google.com/docs/authentication/getting-started)
with the role `logging.logWriter` ([docs](https://cloud.google.com/error-reporting/docs/iam?hl=en#iam_roles))
2. Store the key file in your project directory and refer to it in your `.env` like this:
```
GOOGLE_APPLICATION_CREDENTIALS=/My_Authentication.json
```
3. For Laravel 11 and after versions. Edit `bootstrap/app.php`.
```php
->withExceptions(function (Exceptions $exceptions) {
$exceptions->report(function (\Throwable $e) {
(new \Absszero\ErrorReporting)->report($e);
});
```
3. For Laravel 10 and before versions. Edit `app/Exceptions/Handler.php`.
For Laravel 9 and after versions.
```php
reportable(function (Throwable $e) {
(new \Absszero\ErrorReporting)->report($e);
});
}
```
For PHP version before 7, replace `\Throwable` with `\Exception`.
```php
shouldReport($exception)) {
(new \Absszero\ErrorReporting)->report($exception);
}
}
```
## 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](LICENSE) file for details