idfx / laravel-disk-monitor
Monitor metrics of Laravel disk
Fund package maintenance!
dj-idfx
Requires
- php: ^8.3
- illuminate/contracts: ^10.0||^11.0||^12.0
- spatie/laravel-package-tools: ^1.16
Requires (Dev)
- larastan/larastan: ^2.9||^3.0
- laravel/pint: ^1.14
- nunomaduro/collision: ^8.1.1||^7.10.0
- orchestra/testbench: ^10.0.0||^9.0.0||^8.22.0
- pestphp/pest: ^3.0
- pestphp/pest-plugin-arch: ^3.0
- pestphp/pest-plugin-laravel: ^3.0
- phpstan/extension-installer: ^1.3||^2.0
- phpstan/phpstan-deprecation-rules: ^1.1||^2.0
- phpstan/phpstan-phpunit: ^1.3||^2.0
- spatie/laravel-ray: ^1.35
This package is auto-updated.
Last update: 2025-03-12 18:31:49 UTC
README
Monitors the metrics of disks used by Laravel - Spatie package training.
Installation
You can install the package via composer:
composer require idfx/laravel-disk-monitor
You can publish and run the migrations with:
php artisan vendor:publish --tag="disk-monitor-migrations"
php artisan migrate
You can publish the config file with:
php artisan vendor:publish --tag="disk-monitor-config"
This is the contents of the published config file:
return [ /** * Name of the disk you want to monitor. */ 'disk_names' => [ 'local', ], ];
Finally, you should schedule the Spatie\DiskMonitor\Commands\RecordsDiskMetricsCommand to run daily.
// in app/Console/Kernel.php use \Spatie\DiskMonitor\Commands\RecordsDiskMetricsCommand; class Kernel extends ConsoleKernel { protected function schedule(Schedule $schedule) { // ... $schedule->command(RecordsDiskMetricsCommand::class)->daily(); } }
Optionally, you can publish the views using
php artisan vendor:publish --tag="disk-monitor-views"
Usage
You can view the amount of files each monitored disk has, in the disk_monitor_entries table.
If you want to view the statistics in the browser add this macro to your routes file.
// in a routes files Route::diskMonitor('my-disk-monitor-url');
Now, you can see all statics when browsing /my-disk-monitor-url. Of course, you can use any url you want when using the diskMonitor route macro. We highly recommand using the auth middleware for this route, so guests can't see any data regarding your disks.
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.