This is a single PHP file that captures errors, warnings, and fatal crashes from your application and sends them to this dashboard.
Prefer to build your own integration? See the API documentation for the raw endpoint spec.
Each project gets a unique key. You can also do this from the dashboard.
Open errorcapture.php and set the two constants at the top of the file:
define('ERRORCAPTURE_ENDPOINT', 'https://errorcapture.com/api.php');
define('ERRORCAPTURE_HASH', 'your-key-here');
Add a single line at the top of your PHP application entry point:
require_once __DIR__ . '/errorcapture.php';
Drop errorcapture.php into your theme or plugin directory and require it early. For best coverage, add it to wp-config.php before the WordPress bootstrap:
require_once ABSPATH . 'errorcapture.php'; /** Sets up WordPress vars and included files. */ require_once ABSPATH . 'wp-settings.php';
Add to the very top of public/index.php, before the autoloader:
require_once __DIR__ . '/../errorcapture.php'; require __DIR__.'/../vendor/autoload.php';
Just require it at the top:
<?php require_once 'errorcapture.php'; // your code here...
You can also send your own messages to the dashboard using the errorcapture_log() function. These appear with the custom level.
errorcapture_log('User signed up: user@example.com');
errorcapture_log('Payment processed for order #1234');
errorcapture_log('Cache cleared manually');
The file and line number where the function was called are captured automatically.
Head to the dashboard, enter your key, and errors will appear in real-time as they occur.
errorcapture_log()Each error report includes:
{
"hash": "your-project-key",
"level": "Warning",
"message": "Undefined variable $foo",
"file": "/var/www/app/index.php",
"line": 42,
"hostname": "dev-machine",
"request": {
"method": "GET",
"url": "http://localhost/page?id=5",
"get": { "id": "5" },
"post": null
}
}