| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
parent directory.. | ||||
This directory contains samples for setting up and using Stackdriver Error Reporting for PHP.
quickstart.php and src/report_error.php are simple command-line programs to demonstrate logging exceptions, errors, and PHP fatal errors to Stackdriver Error Reporting.
composer installpecl install grpcexport GOOGLE_APPLICATION_CREDENTIALS=/path/to/service_account_credentials.jsonOpen quickstart.php in a text editor and replace the text YOUR_PROJECT_ID with your Project ID.
Run the samples:
php quickstart.php
Throwing a test exception. You can view the message at https://console.cloud.google.com/errors.This example registers the Stackdriver exception handler using PHP exception handlers. View Stackdriver Error Reporting in the Cloud Console to see the logged exception.
This sample shows how to report an error by creating a ReportedErrorEvent. The ReportedErrorEvent object gives you more control over how the error appears and the details associated with it.
Run the sample:
$ php src/report_error.php YOUR_PROJECT_ID "This is a test message"
Reported an exception to StackdriverView Stackdriver Error Reporting in the Cloud Console to see the logged exception.
| Back | FazBrowse Home | New Git URL |