PHPackages                             lazev/phplogpacker - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Logging &amp; Monitoring](/categories/logging)
4. /
5. lazev/phplogpacker

ActiveProject[Logging &amp; Monitoring](/categories/logging)

lazev/phplogpacker
==================

A PHP tool for log packing and rotation

v1.0.0(11mo ago)118MITPHPPHP ^7.4 || ^8.0

Since Jun 17Pushed 11mo ago1 watchersCompare

[ Source](https://github.com/lazev/phplogpacker)[ Packagist](https://packagist.org/packages/lazev/phplogpacker)[ RSS](/packages/lazev-phplogpacker/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

PHPLogPacker
============

[](#phplogpacker)

A lightweight PHP utility to automatically compress and archive files when they reach a defined size threshold.

✨ Features
----------

[](#-features)

- ✅ Compresses files &gt;50MB (default) using 7Zip or fallback to Zip
- ✅ Recursive directory scanning (includes subfolders)
- ✅ Configurable retention policy and compression settings
- ✅ Zero dependencies – pure PHP CLI tool

🚀 Usage
-------

[](#-usage)

### Basic Command

[](#basic-command)

```
php logpacker.php /target/directory/
```

### How It Works

[](#how-it-works)

- Scans `/target/directory/` and all subfolders
- Compresses files exceeding `max_file_size_MB` (default: 50MB)
- Maintains `num_files_archived` versions (default: 5)
- Oldest archives are automatically deleted

⚙️ Configuration (optional)
---------------------------

[](#️-configuration-optional)

To customize, create a `logpacker.ini` file in the script's root directory:

```
; logpacker.ini
num_files_archived = 5   ; Number of archived versions to keep
max_file_size_MB   = 50  ; Minimum file size to trigger compression (in MB)
days_last_change   = 0   ; [TODO] Archive files modified X days ago
days_from_creation = 0   ; [TODO] Archive files created X days ago
archive_extension  = 7z  ; Compression format (7z or zip)
```

🔄 Archive Rotation Example
--------------------------

[](#-archive-rotation-example)

### Original structure:

[](#original-structure)

```
error.log (60MB)

```

### After first run:

[](#after-first-run)

```
error.log.1.7z (compressed)

```

### After subsequent runs:

[](#after-subsequent-runs)

```
error.log.1.7z → error.log.2.7z
error.log.2.7z → error.log.3.7z
...
error.log.5.7z → deleted (oldest archive)

```

📦 Compression Methods
---------------------

[](#-compression-methods)

- **7Zip** (default, if installed on system)
- **Zip** (fallback if 7Zip unavailable)

📜 License
---------

[](#-license)

Open-source under the **MIT License**.

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance52

Moderate activity, may be stable

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

335d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/376c0c0587579e4fe9877a726d16e665d119fa257c5ffc3ac86743214db3cac7?d=identicon)[lazev](/maintainers/lazev)

---

Top Contributors

[![lazev](https://avatars.githubusercontent.com/u/166401?v=4)](https://github.com/lazev "lazev (6 commits)")

### Embed Badge

![Health badge](/badges/lazev-phplogpacker/health.svg)

```
[![Health](https://phpackages.com/badges/lazev-phplogpacker/health.svg)](https://phpackages.com/packages/lazev-phplogpacker)
```

###  Alternatives

[psr/log

Common interface for logging libraries

10.4k1.2B9.2k](/packages/psr-log)[itsgoingd/clockwork

php dev tools in your browser

5.9k27.6M94](/packages/itsgoingd-clockwork)[graylog2/gelf-php

A php implementation to send log-messages to a GELF compatible backend like Graylog2.

41838.2M138](/packages/graylog2-gelf-php)[bugsnag/bugsnag-psr-logger

Official Bugsnag PHP PSR Logger.

32132.5M2](/packages/bugsnag-bugsnag-psr-logger)[consolidation/log

Improved Psr-3 / Psr\\Log logger based on Symfony Console components.

15462.2M7](/packages/consolidation-log)[datadog/php-datadogstatsd

An extremely simple PHP datadogstatsd client

19124.6M15](/packages/datadog-php-datadogstatsd)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
