1. Go to this page and download the library: Download amirkateb/laralogger 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/ */
'notification' => [
'enabled' => true,
'channels' => ['telegram', 'email'], // or ['custom']
'queue' => true,
'queue_name' => 'notifications',
// Optional: use your own notification class
'custom_notifier' => \App\Notifications\CustomErrorNotifier::class,
],
use Laralogger\Models\ErrorLog;
use Laralogger\Services\NotificationManager;
$log = ErrorLog::latest()->first();
NotificationManager::notify($log);
'ai' => [
'enabled' => true,
'provider' => 'openai',
'api_key' => env('LARALOGGER_AI_API_KEY'),
'model' => 'gpt-4', // or 'gpt-3.5-turbo'
'prompt' => "You are an expert Laravel backend developer. Given this error, explain the root cause and suggest a fix:\n\n{{error}}",
'queue' => true, // Run analysis via queue
'queue_name' => 'ai-analysis',
],