PHPackages                             phine/phar-compact - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. phine/phar-compact

AbandonedArchivedLibrary[Utility &amp; Helpers](/categories/utility)

phine/phar-compact
==================

Integrates the compact library with the phar library.

1.0.0(12y ago)0551MITPHPPHP &gt;=5.3.3

Since Jan 8Pushed 12y agoCompare

[ Source](https://github.com/kherge-archive/lib-phar-compact)[ Packagist](https://packagist.org/packages/phine/phar-compact)[ Docs](https://github.com/phine/lib-phar-compact)[ RSS](/packages/phine-phar-compact/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependencies (7)Versions (2)Used By (0)

Phar Compact
============

[](#phar-compact)

[![Build Status](https://camo.githubusercontent.com/eab2372cafcac7a203be8637d5c8b7701562a913af56ccd1c8ad0fe348bf8b2e/68747470733a2f2f7472617669732d63692e6f72672f7068696e652f6c69622d706861722d636f6d706163742e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/phine/lib-phar-compact)[![Coverage Status](https://camo.githubusercontent.com/5d968eb0043e4088a8bfdec04273fcbcca051aef3719043c79497635b7be080c/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f7068696e652f6c69622d706861722d636f6d706163742f62616467652e706e67)](https://coveralls.io/r/phine/lib-phar-compact)[![Latest Stable Version](https://camo.githubusercontent.com/87801227ba0225fdc1050198810eb300665c0bc1c81d173ca1d6c3454ca6d76f/68747470733a2f2f706f7365722e707567782e6f72672f7068696e652f706861722d636f6d706163742f762f737461626c652e706e67)](https://packagist.org/packages/phine/phar-compact)[![Total Downloads](https://camo.githubusercontent.com/ee8782613fad20ae1c4b72960d6a37d82bca7a28e382e027ccabe31889d9e7f1/68747470733a2f2f706f7365722e707567782e6f72672f7068696e652f706861722d636f6d706163742f646f776e6c6f6164732e706e67)](https://packagist.org/packages/phine/phar-compact)

Integrates the compact library with the phar library.

Requirement
-----------

[](#requirement)

- PHP &gt;= 5.3.3
- [Phine Compact](https://github.com/phine/lib-compact) &gt;= 1.1
- [Phine Exception](https://github.com/phine/lib-exception) &gt;= 1.0.0
- [Phine Observer](https://github.com/phine/lib-observer) &gt;= 2.0
- [Phine Phar](https://github.com/phine/lib-phar) &gt;= 1.0.0

Installation
------------

[](#installation)

Via [Composer](http://getcomposer.org/):

```
$ composer require "phine/phar-compact=~1.0"

```

Usage
-----

[](#usage)

The library provides a single subject observer for lib-phar. This observer can be registered to the following subjects in order to compact file contents as they are being added to the archive:

- `Builder::ADD_FILE`
- `Builder::ADD_STRING`

To create an observer, you will need a new instance of `CompactObserver`.

```
use Phine\Compact;
use Phine\Compact\Collection;
use Phine\Phar\Builder;
use Phine\Phar\Compact\CompactObserver;

// create the archive builder
$builder = Builder::create('example.phar');

// create the collection of compactors
$collection = new Collection();
$collection->addCompactor(new Compact\Json());
$collection->addCompactor(new Compact\Php());
$collection->addCompactor(new Compact\Xml());

// create the compactor observer
$observer = new CompactObserver($collection);

// register it with the builder subjects
$builder->observe(Builder::ADD_FILE, $observer);
$builder->observe(Builder::ADD_STRING, $observer);
```

With the observer registered, any time a file is added to the archive via the `addFile()` or `addFromString()` methods, the contents of the supported file types will be automatically compacted before being added to the archive.

Documentation
-------------

[](#documentation)

You can find the API [documentation here](http://phine.github.io/lib-phar-compact).

License
-------

[](#license)

This library is available under the [MIT license](LICENSE).

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity58

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

4509d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/9122157?v=4)[Kevin Herrera](/maintainers/kherge)[@kherge](https://github.com/kherge)

---

Top Contributors

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

---

Tags

pharcompact

### Embed Badge

![Health badge](/badges/phine-phar-compact/health.svg)

```
[![Health](https://phpackages.com/badges/phine-phar-compact/health.svg)](https://phpackages.com/packages/phine-phar-compact)
```

###  Alternatives

[seld/phar-utils

PHAR file format utilities, for when PHP phars you up

875180.0M32](/packages/seld-phar-utils)[clue/phar-composer

Simple phar creation for any project managed via Composer

862881.6k29](/packages/clue-phar-composer)[tm/tooly-composer-script

Simple composer script to manage phar files.

103280.1k32](/packages/tm-tooly-composer-script)[laravel-zero/phar-updater

A thing to make PHAR self-updating easy and secure.

162.1M92](/packages/laravel-zero-phar-updater)[phar-io/composer-distributor

Base Code for a composer plugin that installs PHAR-files

13581.1k6](/packages/phar-io-composer-distributor)[mmoreram/extractor

Extractor project for php

21132.0k8](/packages/mmoreram-extractor)

PHPackages © 2026

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