mikailfaruqali / log-viewer
A simple and clean log viewer for Laravel applications. Easily view and manage your log files through a straightforward web interface.
Installs: 12
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
Language:Blade
Requires
- php: >=7.4
- illuminate/contracts: >=5.0
Requires (Dev)
- driftingly/rector-laravel: ^2.0
- laravel/pint: ^1.14
- orchestra/testbench: ^8.22|^9.0
README
A simple and clean log viewer for Laravel applications. Easily view, manage, and delete your log files through a straightforward web interface. This package is designed to be lightweight and easy to integrate into any Laravel project.
(You can add a screenshot here after you have it running)
Features
- Simple Interface: Clean, single-page view for your logs.
- File Selection: Easily switch between different log files.
- File Deletion: Clean up old log files directly from the UI.
- Easy Installation: Get up and running in minutes.
- Configurable: Publish the config file to customize the route and middleware.
- Zero Dependencies: No external CSS or JS frameworks required.
Installation
You can install the package via Composer:
composer require mikailfaruqali/log-viewer
Configuration
The package is designed to work out-of-the-box, but you can publish the configuration file for more control.
Publish the configuration file using the following command:
php artisan vendor:publish --provider="Mikailfaruqali\LogViewer\LogViewerServiceProvider" --tag="config"
This will create a config/log-viewer.php
file in your project where you can customize the package settings:
// config/log-viewer.php return [ // The URI path where the log viewer will be accessible. 'route-path' => 'logs', // The middleware applied to the log viewer routes. // By default, it's protected by 'web' and 'auth' middleware. 'middleware' => ['web', 'auth'], ];
You can also publish the views to customize the UI:
php artisan vendor:publish --provider="Mikailfaruqali\LogViewer\LogViewerServiceProvider" --tag="views"
Usage
Once installed, navigate to the configured route in your browser. By default, this is:
https://your-app.com/logs
You must be authenticated to access this page, as defined by the default auth
middleware in the configuration. You can change this to suit your application's needs (e.g., by creating a specific can:view-logs
middleware).
Security
By default, the log viewer is only accessible to authenticated users. If your application has roles and permissions, it is highly recommended to create a custom authorization policy.
You can do this by creating a custom middleware and adding it to the middleware
array in the config/log-viewer.php
file.
Example: Admin-only middleware
- Create the middleware:
php artisan make:middleware AbortIfNotAdmin
- Implement the logic in the middleware's
handle
method. - Update your
config/log-viewer.php
:'middleware' => ['web', 'auth', 'admin'],
License
The MIT License (MIT). Please see License File for more information.