Download the PHP package parvion/laravel-log-pruner without Composer
On this page you can find all versions of the php package parvion/laravel-log-pruner. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package laravel-log-pruner
Parvion Laravel Log Pruner
A robust, enterprise-ready Laravel package for atomic log rotation, dynamic database table pruning, queue worker restart, and multi-recipient email reporting — all from one Artisan command, fully controlled from your
config/log-pruner.phpand.env.
Table of Contents
- Features
- How It Works — The 5 Phases
- Requirements
- Installation
- Configuration
- Usage
- Scheduling
- Email Report Example
- Backup Info Table Example
- .env Quick Reference
- Disabling Features
- License
Features
| Feature | Details |
|---|---|
| 🔄 Atomic log rotation | Uses OS-level rename() — zero window where log is missing |
| 📋 Backup info table | Shows every backup: size, age, expiry date, and SAFE/EXPIRED status |
| 🗑️ Backup file pruning | Auto-deletes backups older than your configured retention period |
| 🔧 Queue worker restart | Gracefully signals workers to release old file handles |
| 🗃️ Dynamic DB pruning | Safely prunes any database table with schema existence checks |
| 📧 Multi-recipient email | Plain-text report via Mail::raw() — works with ZeptoMail, Postmark, Mailgun |
| 🛡️ Schema safety checks | Verifies table + created_at column exist before any DELETE |
| ⚙️ Fully config-driven | Every feature toggled from config/log-pruner.php and .env |
| 🎛️ CLI overrides config | Pass --days, --tables, --email to override config on the fly |
How It Works — The 5 Phases
Each phase can be individually enabled or disabled in the config.
Requirements
| Dependency | Version |
|---|---|
| PHP | ^8.0 (8.0, 8.1, 8.2, 8.3+) |
| Laravel | 10.x, 11.x, 12.x, 13.x |
| Carbon | Included with Laravel |
Installation
Step 1 — Add the package
Laravel's auto-discovery registers the service provider automatically. No manual
config/app.phpedit required.
Step 2 — Publish the config
This copies the config to your app at config/log-pruner.php.
You can now customise every setting without touching the package source.
Step 3 — Set your .env values
Open your .env and add:
Step 4 — Verify the command is registered
Step 5 — Run it manually to test
Configuration
After publishing, edit config/log-pruner.php. Every key maps to a .env variable:
Usage
Basic — uses all config defaults
Override retention period
Override which tables to prune
Override email recipients
Full override example
Priority: CLI option → config/log-pruner.php → built-in default
Scheduling
Laravel 11+ (routes/console.php)
With explicit overrides (optional):
Laravel 10 (app/Console/Kernel.php)
Server Cron Entry
Add this to your server (crontab -e) — this is the only cron entry you need:
The cron runs every minute. Laravel's scheduler handles the
02:00 Asia/Kolkatatiming internally via->dailyAt()and->timezone(). Never put thelogs:rotate-and-prunecommand directly in cron — you would bypasswithoutOverlapping()and timezone support.
Email Report Example
Backup Info Table Example
When LOG_PRUNER_BACKUP_SHOW_INFO=true, Phase 2 prints this in the console:
[!IMPORTANT] Important Note on Backup File Deletion (Metadata vs. Filename) This package calculates a backup file's age based on the operating system's Last Modified Date (
filemtime) metadata, not the date printed in the filename.If you open an older backup log in a text editor and accidentally save it, your OS will instantly update its "Last Modified" date to today. This will reset its retention countdown back to 0 days, and the package will mark it as
SAFEuntil your configured--daysthreshold passes again.
.env Quick Reference
Disabling Features
| What you want to stop | .env setting |
|---|---|
| Stop everything (maintenance) | LOG_PRUNER_ENABLED=false |
| Stop rotating the log file | LOG_PRUNER_FEATURE_ROTATION=false |
| Stop deleting old backup files | LOG_PRUNER_FEATURE_BACKUP_PRUNING=false |
| Skip queue worker restart | LOG_PRUNER_FEATURE_QUEUE_RESTART=false |
| Stop deleting old DB rows | LOG_PRUNER_FEATURE_DB_PRUNING=false |
| Stop sending email reports | LOG_PRUNER_MAIL_ENABLED=false |
| Disable email feature entirely | LOG_PRUNER_FEATURE_EMAIL=false |
Mail Driver Compatibility
The package uses Mail::raw() which works with any mail driver — no Blade
templates are required:
| Driver | Compatible |
|---|---|
| SMTP | ✅ |
| ZeptoMail | ✅ |
| Mailgun | ✅ |
| Postmark | ✅ |
| Resend | ✅ |
| Amazon SES | ✅ |
| Log (local dev) | ✅ |
License
MIT — © LICENSE
Contributing
Bug reports, feature requests, and pull requests are welcome!
Please read CONTRIBUTING.md before submitting a PR.
Changelog
All notable changes between versions are documented in CHANGELOG.md.
This project follows Semantic Versioning and Keep a Changelog.
All versions of laravel-log-pruner with dependencies
illuminate/console Version ^10.0|^11.0|^12.0|^13.0
illuminate/support Version ^10.0|^11.0|^12.0|^13.0
illuminate/database Version ^10.0|^11.0|^12.0|^13.0
illuminate/mail Version ^10.0|^11.0|^12.0|^13.0
illuminate/validation Version ^10.0|^11.0|^12.0|^13.0