dkx / google-report-error-exception-writer
This package is abandoned and no longer maintained.
No replacement package was suggested.
Wrapper for Google ErrorReporting library
1.0.0
2019-11-02 13:49 UTC
Requires
- php: >=7.3
- google/cloud-error-reporting: ^0.15.0
- psr/http-message: ^1.0
Requires (Dev)
- mockery/mockery: ^1.2
- phpstan/extension-installer: >=1.0
- phpstan/phpstan: >=0.11
- phpstan/phpstan-strict-rules: >=0.11
This package is auto-updated.
Last update: 2024-01-29 03:41:40 UTC
README
Wrapper for Google ErrorReporting library
Installation
$ composer require dkx/google-report-error-exception-writer
Usage
<?php
namespace MyApp;
use DKX\GoogleReportErrorExceptionWriter\ReportErrorExceptionWriter;
use Google\Cloud\ErrorReporting\V1beta1\ReportErrorsServiceClient;
$googleProjectId = 'google-project-id';
$projectName = 'my-app/production';
$projectVersion = '0.0.1';
$client = new ReportErrorsServiceClient();
$writer = new ReportErrorExceptionWriter($client, $googleProjectId, $projectName, $projectVersion);
try {
buggy_code();
} catch (\Throwable $e) {
$writer->writeException($e);
}
Current HTTP request can be stored in the error context if you use PSR7 for HTTP:
<?php
$responseStatusCode = 500;
$writer->writeException($e, $httpRequest, $responseStatusCode);