jiordiviera / laravel-log-cleaner
A Laravel package to easily clean the log files.
Requires
- php: ^7.0|^8.0|^8.1|^8.2
- illuminate/console: ^7.0|^8.0|^9.0|^10.0|^11.0
- illuminate/support: ^7.0|^8.0|^9.0|^10.0|^11.0
Requires (Dev)
- orchestra/testbench: ^5.0|^6.0|^7.0|^8.0|^9.0
- pestphp/pest: ^1.23|^2.0
- pestphp/pest-plugin-laravel: ^1.4|^2.0
README
██╗ █████╗ ██████╗ █████╗ ██╗ ██╗███████╗██╗
██║ ██╔══██╗██╔══██╗██╔══██╗██║ ██║██╔════╝██║
██║ ███████║██████╔╝███████║██║ ██║█████╗ ██║
██║ ██╔══██║██╔══██╗██╔══██║╚██╗ ██╔╝██╔══╝ ██║
███████╗██║ ██║██║ ██║██║ ██║ ╚████╔╝ ███████╗███████╗
╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═══╝ ╚══════╝╚══════╝
██╗ ██████╗ ██████╗
██║ ██╔═══██╗██╔════╝
██║ ██║ ██║██║ ███╗
██║ ██║ ██║██║ ██║
███████╗╚██████╔╝╚██████╔╝
╚══════╝ ╚═════╝ ╚═════╝
██████╗██╗ ███████╗ █████╗ ███╗ ██╗███████╗██████╗
██╔════╝██║ ██╔════╝██╔══██╗████╗ ██║██╔════╝██╔══██╗
██║ ██║ █████╗ ███████║██╔██╗ ██║█████╗ ██████╔╝
██║ ██║ ██╔══╝ ██╔══██║██║╚██╗██║██╔══╝ ██╔══██╗
╚██████╗███████╗███████╗██║ ██║██║ ╚████║███████╗██║ ██║
╚═════╝╚══════╝╚══════╝╚═╝ ╚═╝╚═╝ ╚═══╝╚══════╝╚═╝ ╚═╝
Laravel Log Cleaner is a utility package designed for the efficient management of Laravel log files. It allows developers to quickly clear log data using an Artisan command, enhancing application performance and management. This tool is compatible with Laravel versions 7, 8, 9, 10, and 11.
Installation
You can install the package via Composer by executing the following command:
composer require jiordiviera/laravel-log-cleaner
Compatibility
This package supports the following Laravel versions:
- Laravel 7.x
- Laravel 8.x
- Laravel 9.x
- Laravel 10.x
- Laravel 11.x
Usage
After installation, an Artisan command is available to clear the Laravel log file. You can use this command in two ways:
-
To clear all logs:
php artisan log:clear
-
To clear logs older than a specific number of days:
php artisan log:clear --days=30
Replace
30
with desired days. This will delete all log entries older than the specified days.
Examples
-
Clear all logs:
$ php artisan log:clear Log file cleared successfully.
-
Clear logs older than 30 days:
$ php artisan log:clear --days=30 Logs older than 30 days have been removed.
Configuration
No additional configuration is necessary. The log:clear
command is immediately available upon package installation.
Running Tests
This package uses Pest for testing. You can run tests with the following command:
./vendor/bin/pest
Ensure your tests are organized correctly within the tests/
directory.
Contributing
Contributions are welcomed! Feel free to submit Issues or Pull Requests on GitHub.
Development Workflow
For contributors:
-
Clone the repository:
git clone https://github.com/jiordiviera/laravel-log-cleaner.git
-
Install dependencies:
composer install
-
Run tests:
./vendor/bin/pest
About
This package was created to streamline the management of log files in Laravel applications. Instead of manually clearing the log files, you can achieve this efficiently with a single command, with the option to selectively remove older logs.
License
The Laravel Log Cleaner is open-source software licensed under the MIT License.
Note: Initially developed for Laravel 11, this package remains compatible with earlier versions (7, 8, 9, 10).
For further information, visit the GitHub repository.