1. Go to this page and download the library: Download pgtruesdell/laravel-logsnag 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/ */
pgtruesdell / laravel-logsnag example snippets
return [
// Your LogSnag project slug
'project' => env('LOGSNAG_PROJECT', 'my-laravel-app'),
// Default channel for the Monolog driver
'channel' => env('LOGSNAG_CHANNEL', 'app-events'),
// Your LogSnag API token
'token' => env('LOGSNAG_TOKEN', ''),
// Icon mapping for the Monolog driver (keyed by Monolog level name)
'icons' => [
'Debug' => 'ℹ️',
'Info' => 'ℹ️',
'Notice' => '📌',
'Warning' => '⚠️',
'Error' => '⚠️',
'Critical' => '🔥',
'Alert' => '🔔️',
'Emergency' => '💀',
],
];
use PGT\Logsnag\Facades\Logsnag;
// Minimal
Logsnag::log(channel: 'waitlist', event: 'User Signed Up');
// With all options
Logsnag::log(
channel: 'billing',
event: 'Subscription Renewed',
description: 'Pro plan renewed for another year.',
icon: '💳',
notify: true,
tags: ['plan' => 'pro', 'cycle' => 'yearly'],
parser: \PGT\Logsnag\Enums\Parser::Markdown,
userId: 'user-123',
timestamp: now()->subMinutes(5)->timestamp,
);
logsnag(
channel: 'waitlist',
event: 'User Signed Up',
description: 'A new user joined the waitlist.',
icon: '🎉',
);