PHP code example of irabbi360 / laravel-debugmate

1. Go to this page and download the library: Download irabbi360/laravel-debugmate 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/ */

    

irabbi360 / laravel-debugmate example snippets


// bootstrap/app.php
->withExceptions(function (Exceptions $exceptions) {
    \Irabbi360\LaravelDebugMate\Services\ExceptionHandler::handles($exceptions);
})->create();

use DebugMate\SDK\Facades\DebugMate;

try {
    // Your code
} catch (Exception $e) {
    DebugMate::reportError($e, [
        'user_id' => auth()->id(),
        'route' => request()->path(),
        'custom_data' => 'any value'
    ]);
}

use DebugMate\SDK\Facades\DebugMate;

DebugMate::startMonitoring('database_query');
// ... your code ...
DebugMate::stopMonitoring('database_query', ['query' => 'SELECT...']);

use DebugMate\SDK\Facades\DebugMate;

// Automatic - logs are streamed in real-time
// Or manually push logs
DebugMate::log('Channel', 'Log message', 'info', ['context_data']);

return [
    'enabled' => env('DEBUGMATE_ENABLED', true),
    'api_url' => env('DEBUGMATE_API_URL'),
    'api_token' => env('DEBUGMATE_API_TOKEN'),
    'project_key' => env('DEBUGMATE_PROJECT_KEY'),
    
    // What to track
    'track_errors' => true,
    'track_logs' => true,
    'track_performance' => true,
    'track_queries' => false,
    
    // Queue configuration
    'queue' => env('QUEUE_CONNECTION', 'sync'),
    'async_reporting' => true,
    
    // Filtering
    'ignore_paths' => ['health', 'ping'],
    'ignore_exceptions' => [],
    'sample_rate' => 1.0, // 0-1, percentage of requests to track
];