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.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-log-pruner

Parvion Laravel Log Pruner

PHP Version Laravel Artisan Command

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.php and .env.


Table of Contents

  1. Features
  2. How It Works — The 5 Phases
  3. Requirements
  4. Installation
  5. Configuration
  6. Usage
  7. Scheduling
  8. Email Report Example
  9. Backup Info Table Example
  10. .env Quick Reference
  11. Disabling Features
  12. 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.php edit 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/Kolkata timing internally via ->dailyAt() and ->timezone(). Never put the logs:rotate-and-prune command directly in cron — you would bypass withoutOverlapping() 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 SAFE until your configured --days threshold 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

PHP Build Version
Package Version
Requires php Version ^8.0
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
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package parvion/laravel-log-pruner contains the following files

Loading the files please wait ...