PHP code example of fqathf / loglytics
1. Go to this page and download the library: Download fqathf/loglytics 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/ */
fqathf / loglytics example snippets
// config/loglytics.php
'route' => [
'prefix' => 'log-viewer', // Change URL prefix
'middleware' => ['web', 'auth'], // Add your middleware
'domain' => null, // e.g. 'logs.example.com'
],
// app/Providers/AuthServiceProvider.php
public function boot()
{
Gate::define('viewLogViewer', function ($user) {
return $user->isAdmin();
});
}
// config/loglytics.php
'authorization' => [
'enabled' => true,
'gate' => 'viewLogViewer',
],
'authorization' => [
'enabled' => true,
'allow_only' => [1, 2, 3], // User IDs
],
'database' => [
'user_model' => \App\Models\User::class,
'user_primary_key_type' => 'uuid',
],
'log_path' => '/var/log/my-app', // Absolute path
'cache' => [
'enabled' => true,
'prefix' => 'loglytics',
'ttl' => 60, // seconds
],
// config/loglytics.php
return [
'route' => [
'prefix' => 'admin/logs',
'middleware' => ['web', 'auth', 'admin'],
],
'authorization' => [
'enabled' => true,
'gate' => 'viewLogViewer',
],
'cache' => [
'enabled' => true,
'ttl' => 120,
],
];
bash
php artisan migrate
bash
php artisan vendor:publish --tag=loglytics-views
# Edit resources/views/vendor/loglytics/*.blade.php
fqathf/loglytics/
├── config/loglytics.php
├── database/migrations/
├── resources/views/
├── routes/web.php
├── src/
│ ├── Http/Controllers/LogViewerController.php
│ ├── Models/LogBugStatus.php
│ ├── Services/LogViewerService.php
│ └── LogViewerServiceProvider.php
├── CHANGELOG.md
├── CONTRIBUTING.md
└── README.md