New:Introducing Socket Scanning for VS Code Marketplace Extensions.Learn more →
Get Started

dkx/google-report-error-exception-writer

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dkx/google-report-error-exception-writer

Wrapper for Google ErrorReporting library

Source
Packagist
This package is abandoned and is no longer maintained.
The author recommends using true instead.
This version has been yanked by its maintainers and should not be used.
Version
1.0.0
Version published
Total downloads
491
Maintainers
1
Created
Source

DKX\GoogleReportErrorExceptionWriter

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);

FAQs

Package last updated on 02 Nov 2019

Related posts