Download the PHP package jiordiviera/laravel-log-cleaner without Composer
On this page you can find all versions of the php package jiordiviera/laravel-log-cleaner. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download jiordiviera/laravel-log-cleaner
More information about jiordiviera/laravel-log-cleaner
Files in jiordiviera/laravel-log-cleaner
Package laravel-log-cleaner
Short Description A Laravel package to easily clean the log files.
License MIT
Informations about the package laravel-log-cleaner
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:
Compatibility
Version 2.x (Current)
PHP Requirements:
- PHP 8.1+
- PHP 8.2+
- PHP 8.3+
Laravel Support:
- Laravel 9.x
- Laravel 10.x
- Laravel 11.x
- Laravel 12.x
Version 1.x (Legacy)
For older PHP versions, use version 1.x:
- PHP 7.0+ to 8.2
- Laravel 7.x to 11.x
Usage
After installation, an Artisan command is available to clear the Laravel log file with advanced options:
Basic Usage
-
Clear all logs:
- Clear logs older than specific days:
Advanced Features (v2.0+)
🔒 Safe Operations
🎯 Targeted Cleaning
📦 Compression & Memory
🚀 Combined Options
Available Options
Option | Description | Example |
---|---|---|
--days=N |
Keep logs from last N days | --days=30 |
--backup |
Create backup before cleaning | --backup |
--dry-run |
Preview changes without applying | --dry-run |
--level=LEVEL |
Filter by log level (ERROR, WARNING, INFO, DEBUG) | --level=ERROR |
--pattern=REGEX |
Custom date pattern matching | --pattern="/^(\d{4}-\d{2}-\d{2})/" |
--compress |
Compress old logs instead of deleting | --compress |
--memory-efficient |
Force memory-efficient processing | --memory-efficient |
Examples
-
Clear all logs:
-
Clear logs older than 30 days:
-
Preview changes (dry run):
- Create backup and compress:
Configuration
No additional configuration is necessary. The log:clear
command is immediately available upon package installation.
What's New in v2.0
🚀 Performance & Memory Optimizations
- Memory-efficient processing for large log files (>50MB)
- Automatic memory threshold detection prevents out-of-memory errors
- Stream processing handles multi-GB log files without memory issues
- Regex pattern caching improves performance on repeated operations
🔒 Enhanced Safety & Robustness
- Pre-flight permission validation prevents runtime errors
- Backup creation with timestamp for data recovery
- Dry-run mode for safe preview of operations
- Enhanced error handling with detailed reporting
🎯 Advanced Filtering
- Log level filtering (ERROR, WARNING, INFO, DEBUG, etc.)
- Custom date patterns for non-standard log formats
- Flexible date range selection with improved accuracy
📦 Archive & Compression
- Compression support for old logs instead of deletion
- Automatic cleanup of temporary files
- Space-efficient archiving with gzip compression
🔧 Breaking Changes
- Minimum PHP version: 8.1+ (dropped PHP 7.x support)
- Minimum Laravel version: 9.x+ (dropped Laravel 7.x-8.x support)
- Enhanced command signature with new options
📊 Performance Benchmarks
- Handles 1GB+ log files without memory issues
- 50%+ performance improvement on large file operations
- Zero memory leaks with proper resource management
- Concurrent processing support for multiple log files
Running Tests
This package uses Pest for testing. You can run tests with the following command:
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:
-
Install dependencies:
- Run tests:
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.
All versions of laravel-log-cleaner with dependencies
illuminate/support Version ^9.0|^10.0|^11.0|^12.0
illuminate/console Version ^9.0|^10.0|^11.0|^12.0