hedii / artisan-log-cleaner by hedii

An artisan command to clear laravel log files
44,030
40
1
Package Data
Maintainer Username: hedii
Maintainer Contact: contact@hedichaibi.com (hedii)
Package Create Date: 2016-09-08
Package Last Update: 2024-03-22
Language: PHP
License: MIT
Last Refreshed: 2024-04-23 03:14:14
Package Statistics
Total Downloads: 44,030
Monthly Downloads: 996
Daily Downloads: 34
Total Stars: 40
Total Watchers: 1
Total Forks: 12
Total Open Issues: 0

Build Status

Artisan Log Cleaner

An artisan command to clear laravel log files

Table of contents

Installation

Install via composer

composer require hedii/artisan-log-cleaner

Add it to your providers array in config/app.php:

Hedii\ArtisanLogCleaner\ArtisanLogCleanerServiceProvider::class

Usage

Clear all log files

Run this command to clear all log files in the log directory (storage/logs):

php artisan log:clear

Clear all log files except the last one

Run this command to clear all log files except the last one in the log directory (storage/logs):

php artisan log:clear --keep-last

Automated cleanup of log files

Add this to the App\Console\Kernel schedule method to ensure daily cleanup of old log files

$schedule->command('log:clear --keep-last')->daily();

Testing

composer test

License

hedii/artisan-log-cleaner is released under the MIT Licence. See the bundled LICENSE file for details.