hamza094/storage-monitor

Package for monitor your storage in laravel application

1.0.2 2021-07-28 13:44 UTC

This package is auto-updated.

Last update: 2024-12-28 22:12:47 UTC


README

Latest Stable Version GitHub Tests Action Status GitHub Code Style Action Status Total Downloads License

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.