1. Go to this page and download the library: Download achyutn/filament-log-viewer 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/ */
achyutn / filament-log-viewer example snippets
use AchyutN\FilamentLogViewer\FilamentLogViewer;
return $panel
->plugins([
FilamentLogViewer::make(),
]);
return [
// Set max file size to 20 MB
'max_log_file_size' => env('LOG_MAX_SIZE_KB', 20480),
// Disable deleting logs from the UI
'enable_delete' => env('LOG_ENABLE_DELETE', false),
// Truncate log contents on clear (false to delete the files entirely)
'truncate_on_clear' => env('LOG_TRUNCATE_ON_CLEAR', true),
// Disable copying logs as markdown
'enable_copy_markdown' => env('LOG_ENABLE_COPY_MARKDOWN', true),
// Show copy button for these log levels (comma-separated)
'copy_markdown_levels' => explode(',', env('LOG_COPY_MARKDOWN_LEVELS', 'error')),
// Skip caching parsed log rows between requests
'disable_cache' => env('LOG_DISABLE_CACHE', false),
];
FilamentLogViewer::make()
->authorize(true);
// or
FilamentLogViewer::make()
->authorize(fn (): bool => auth()->user()->is_admin);