hedii/artisan-log-cleaner

An artisan command to clear laravel log files

Maintainers

👁 hedii

Package info

github.com/hedii/artisan-log-cleaner

pkg:composer/hedii/artisan-log-cleaner

Statistics

Installs: 65 356

Dependents: 0

Suggesters: 0

Stars: 41

Open Issues: 0

8.0.0 2025-03-18 09:59 UTC

Requires

Requires (Dev)

Suggests

None

Provides

None

Conflicts

None

Replaces

None

MIT 6a26d3837d549f7e7116ee49b7b483f973c5ef64

  • hedii <contact.woop@hedichaibi.com>

logphplaravelartisanhediiartisan-log-cleaner

This package is auto-updated.

Last update: 2026-06-18 12:51:14 UTC


README

👁 Build Status
👁 Total Downloads
👁 License
👁 Latest Stable Version

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

Clear all log files except specified file names

Run this command to clear all log files except the specified files in the option. Specify file name without extension. Can be combined with --keep-last option.

php artisan log:clear --keep="keptLog"

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.