hamza094 / storage-monitor
Package for monitor your storage in laravel application
Fund package maintenance!
hamza094
Requires
- php: ^8.0
- illuminate/contracts: ^8.37
- laravel/legacy-factories: ^1.1
- spatie/laravel-package-tools: ^1.4.3
Requires (Dev)
- brianium/paratest: ^6.2
- nunomaduro/collision: ^5.3
- orchestra/testbench: ^6.15
- phpunit/phpunit: ^9.3
- spatie/laravel-ray: ^1.23
- vimeo/psalm: ^4.8
README
Description
laravel-storage-monitor can monitor the usage of the filesystems configured in Laravel. Currently only the amount of files a local storage contains is monitored.
Support us
We invest a lot of resources into creating. You can support us.We highly appreciate you.
Installation
You can install the package via composer:
composer require hamza094/storage-monitor
You can publish and run the migrations with:
php artisan vendor:publish --provider="Hamza094\StorageMonitor\StorageMonitorServiceProvider" --tag="storage-monitor-migrations" php artisan migrate
You can publish the config file with:
php artisan vendor:publish --provider="Hamza094\StorageMonitor\StorageMonitorServiceProvider" --tag="storage-monitor-config"
You can publish the view file with:
php artisan vendor:publish --provider="Hamza094\StorageMonitor\StorageMonitorServiceProvider" --tag="storage-monitor-views"
This is the contents of the published config file:
return [ /** * the names of the storage disk you want to monitor */ 'storage_names'=> [ 'local' ], ];
Finally, you should schedule the use Hamza094\StorageMonitor\Commands\StorageMonitorCommand to run daily.
// in app/Console/Kernel.php use \Hamza094\StorageMonitor\Commands\StorageMonitorCommand; class Kernel extends ConsoleKernel { protected function schedule(Schedule $schedule) { // ... $schedule->command(StorageMonitorCommand::class)->daily(); } }
Usage
You can view the amount of files each monitored disk has, in the storage_monitors table.
If you want to view the statistics in the browser add this macro to your routes file.
// in a routes files Route::storageMonitor('storage-monitor-url');
Now, you can see all statics when browsing /storage-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.
Contributing
Please see CONTRIBUTING for details.
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.