PHP code example of errorvault / laravel
1. Go to this page and download the library: Download errorvault/laravel library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
errorvault / laravel example snippets
use ErrorVault\Laravel\Facades\ErrorVault;
// Report a custom error
ErrorVault::reportError('Something went wrong', 'warning', __FILE__, __LINE__);
// Report with additional context
ErrorVault::reportError(
'Payment failed',
'critical',
__FILE__,
__LINE__,
['order_id' => $orderId, 'amount' => $amount]
);
// Manually report an exception
try {
// risky operation
} catch (\Exception $e) {
ErrorVault::report($e, ['custom' => 'context']);
}
use ErrorVault\Laravel\Facades\ErrorVault;
$result = ErrorVault::verify();
if ($result['success']) {
echo "Connected to: " . $result['data']['site_name'];
} else {
echo "Error: " . $result['error'];
}
$stats = ErrorVault::stats();
if ($stats) {
echo "Total errors: " . $stats['total_errors'];
echo "New errors: " . $stats['new_errors'];
}
use ErrorVault\Laravel\Facades\ErrorVault;
// Test connection
$result = ErrorVault::testConnection();
if ($result['success']) {
echo "Connection successful!";
}
// Get connection failures
$failures = ErrorVault::getConnectionFailures();
foreach ($failures as $failure) {
echo $failure['timestamp'] . ': ' . $failure['message'];
}
// Get consecutive failure count
$count = ErrorVault::getConsecutiveFailures();
// Clear failure logs
ErrorVault::clearFailureLog();
// Send heartbeat/ping
ErrorVault::sendPing(); // Non-blocking
ErrorVault::sendPing(true); // Blocking
'ignore' => [
\App\Exceptions\IgnoredException::class,
],
'ignore_patterns' => [
'deprecated',
'cache miss',
],
bash
php artisan vendor:publish --tag=errorvault-config
bash
php artisan errorvault:test-connection
bash
php artisan errorvault:diagnostics
bash
php artisan errorvault:diagnostics --clear-failures
bash
php artisan errorvault:health-report