donald1597 / disk-usage
A package to display and manage disk usage.
Installs: 17
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 1
Forks: 0
Open Issues: 0
Language:Blade
Requires
- php: ^8.0
README
Disk Usage Package is a Laravel package designed to monitor and manage disk usage within your Laravel application. It provides an intuitive interface to view and manage disk usage statistics, making it easier to keep track of your project's storage.
Features
- View the total size of the Laravel project directory.
- Monitor server disk space including total, free, and used space.
- Visualize disk usage with interactive charts.
- Detailed view of directory contents including file size and type.
- Option to delete files and directories directly from the interface.
Installation
-
Add the Package to Your Project
You can install the package via Composer. Run the following command in your Laravel project directory:
composer require donald1597/disk-usage
-
Add the Service Provider to your
config/app.php
:Open your
config/app.php
file and add the following line to theproviders
array:Donald1597\DiskUsage\Http\DiskUsageServiceProvider::class,
-
Publishing the Configuration
php artisan vendor:publish --provider="Donald1597\DiskUsage\Http\DiskUsageServiceProvider" --tag=config
- Make sure to set these variables in your .env file: for example
DISK_USAGE_THRESHOLD_PERCENTAGE=1 DISK_USAGE_THRESHOLD_ABSOLUTE=1048576 DISK_USAGE_NOTIFICATION_EMAIL=user@example.com
- Set Up Queues for Notifications
Notification
When disk usage exceeds the defined thresholds, an email notification will be sent to the address specified in DISK_USAGE_NOTIFICATION_EMAIL.
To handle email notifications asynchronously, you need to configure Laravel queues. Follow these steps:
Configure the Queue Driver
In your .env file, set up the queue driver:
QUEUE_CONNECTION=database
You can also choose other queue drivers like redis or sqs depending on your setup.
Create a Queue Table
If you are using the database queue driver, create the necessary tables by running:
php artisan queue:table php artisan migrate
- Run the Queue Worker
Start the queue worker to process the queued jobs:
php artisan queue:work
Usage
After installation, you can access the disk usage dashboard via the route: disk-usage
Uninstallation
To uninstall the package:
-
Remove the package via Composer:
composer remove donald1597/disk-usage
-
Remove the Service Provider from
config/app.php
:Open your
config/app.php
file and remove the following line from theproviders
array:Donald1597\DiskUsage\Http\DiskUsageServiceProvider::class,
-
Clean up any published assets or configurations if necessary.
Contributing
Feel free to contribute to this package by opening issues or submitting pull requests.
License
This package is licensed under the MIT License.