Backend: Error Monitoring
Backend: Logging
Go
JS
Python
Ruby
Java
Rust
Hosting Providers
Backend: Tracing
Native OpenTelemetry
Fullstack Frameworks
Overview
Self Host & Local Dev
Menu
Using highlight.io with PHP Frameworks
Learn how to set up highlight.io on your PHP backend.
1
Install the Highlight PHP SDK via Composer.
Run the following command to install the Highlight SDK for PHP:
composer require highlight/php-sdk
2
Initialize the Highlight PHP SDK.
To initialize the Highlight backend SDK, use one of the initializer methods:
use Highlight\SDK\Common\HighlightOptions;
use Highlight\SDK\Highlight;
$projectId = '<YOUR_PROJECT_ID>';
// Use only a projectId to bootstrap Highlight
if (!Highlight::isInitialized()) {
Highlight::init($projectId);
}
// Use a HighlightOptions instance to bootstrap Highlight
$options = HighlightOptions::builder($projectId)->build();
if (!Highlight::isInitialized()) {
Highlight::initWithOptions($options);
}
// Use a HighlightOptions instance prepped with a serviceName to bootstrap Highlight
$options = HighlightOptions::builder($projectId)->serviceName('test-service-01')->build();
if (!Highlight::isInitialized()) {
Highlight::initWithOptions($options);
}
3
Verify your errors are being recorded.
Now that you've set up the Middleware, verify that the backend error handling works by consuming an error from traced code.
4
Record custom errors. (optional)
If you want to explicitly send an error to Highlight, you can use the Highlight::captureException()
method.
use Highlight\SDK\Highlight;
Highlight::captureException(new \Exception('This is a test exception'));
5
Set up logging.
Start sending logs to Highlight! Follow the logging setup guide to get started.