jiordiviera / laravel-log-cleaner
A Laravel package to easily clean the log files.
Requires
- php: ^8.0
- 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: ^7.46
- pestphp/pest: ^1.23
- pestphp/pest-plugin-laravel: ^1.4
This package is auto-updated.
Last update: 2024-10-19 11:58:40 UTC
README
Laravel Log Cleaner is a simple package that allows you to clear the content of the laravel.log
file using an
Artisan command. This package is compatible with Laravel versions 7, 8, 9, 10, and 11.
Installation
Install the package via Composer by running:
composer require jiordiviera/laravel-log-cleaner
Compatibility
- Laravel 7.x
- Laravel 8.x
- Laravel 9.x
- Laravel 10.x
- Laravel 11.x
Usage
This package adds an Artisan command to clear the content of the laravel.log
file. There are two ways to use this
command:
- To clear all logs:
php artisan log:clear
- To clear logs older than a specified number of days:
php artisan log:clear --days=30
Replace 30
with the number of days you want to keep. This will remove all log entries older than the specified number
of 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 required. Once the package is installed, the log:clear
command is ready to use.
Running Tests
This package uses Pest for testing. To run the tests, use:
./vendor/bin/pest
Ensure your tests are correctly defined in the tests/
directory.
Contributing
Contributions are welcome! Feel free to submit Issues or Pull Requests via GitHub.
Development Workflow
If you want to contribute:
-
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 developed to simplify log file management in Laravel projects. Instead of manually clearing the logs, you can now achieve it with a single command, with the option to selectively remove older logs.
License
The Laravel Log Cleaner package is open-source software licensed under the MIT License.
Note: Although this package was initially developed with Laravel 11, it is also compatible with earlier versions of Laravel (7, 8, 9, and 10).
For more information, visit the GitHub repository.