PHPackages                             gbeushausen/distill - 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. gbeushausen/distill

ActiveLibrary

gbeushausen/distill
===================

Smart compressed files extractor

0.9.11(6y ago)0979MITPHPPHP &gt;=7.2.0

Since Aug 31Pushed 6y agoCompare

[ Source](https://github.com/GBeushausen/distill)[ Packagist](https://packagist.org/packages/gbeushausen/distill)[ RSS](/packages/gbeushausen-distill/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (1)Dependencies (6)Versions (32)Used By (0)

Distill: Smart compressed files extractor for PHP
=================================================

[](#distill-smart-compressed-files-extractor-for-php)

[![Build Status](https://camo.githubusercontent.com/3f95f4d9fc187ab65509b7fd0bf1da4df2c719cb7517f53018359afeeb8378be/68747470733a2f2f7365637572652e7472617669732d63692e6f72672f7261756c667261696c652f64697374696c6c2e706e67)](http://travis-ci.org/raulfraile/distill)[![Latest Stable Version](https://camo.githubusercontent.com/0b7ec189dbcaf6e6082e5bfd459a1181169fe1ffcf8c003eb26d937ff254aeda/68747470733a2f2f706f7365722e707567782e6f72672f7261756c667261696c652f64697374696c6c2f762f737461626c652e706e67)](https://packagist.org/packages/raulfraile/distill)[![Total Downloads](https://camo.githubusercontent.com/520ee9eda2416ad98fbf0b134764a4760e9c81bdaf63a4c2de109b92b6c19abe/68747470733a2f2f706f7365722e707567782e6f72672f7261756c667261696c652f64697374696c6c2f646f776e6c6f6164732e706e67)](https://packagist.org/packages/raulfraile/distill)[![Latest Unstable Version](https://camo.githubusercontent.com/d587768ee53fd03f9c9b5cca1beeb0f298cc7ff566d88482da2cb12811b32659/68747470733a2f2f706f7365722e707567782e6f72672f7261756c667261696c652f64697374696c6c2f762f756e737461626c652e706e67)](https://packagist.org/packages/raulfraile/distill)

Distill extracts files from compressed archives.

Features:

- Extract files from `ar`, `bz2`, `cab`, `chm`, `cpio`, `deb`, `dmg`, `epub`, `gz`, `phar`, `rar`, `shar`, `tar`, `tar.bz2`, `tar.gz`, `tar.xz`, `wim`, `7z`, `xz`, `Z` and `zip` archives.
- Different decompression methods under the hood: PHP extensions, command line binaries, third-party libraries and even fallback methods in plain PHP.
- Strategy to choose the right file in case there are more than one available format. Strategies can be based on minimizing bandwidth or optimizing decompression speed.

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

[](#installation)

The recommended way to install Distill is through [Composer](http://packagist.org/about-composer). Require the `raulfraile/distill` package into your `composer.json` file:

[![Latest Stable Version](https://camo.githubusercontent.com/0b7ec189dbcaf6e6082e5bfd459a1181169fe1ffcf8c003eb26d937ff254aeda/68747470733a2f2f706f7365722e707567782e6f72672f7261756c667261696c652f64697374696c6c2f762f737461626c652e706e67)](https://packagist.org/packages/raulfraile/distill)[![Latest Unstable Version](https://camo.githubusercontent.com/d587768ee53fd03f9c9b5cca1beeb0f298cc7ff566d88482da2cb12811b32659/68747470733a2f2f706f7365722e707567782e6f72672f7261756c667261696c652f64697374696c6c2f762f756e737461626c652e706e67)](https://packagist.org/packages/raulfraile/distill)

```
{
    "require": {
        "gbeushausen/distill": "@stable"
    }
}
```

**Protip**: you should browse the [gbeushausen/distill](https://packagist.org/packages/gbeushausen/distill) page to choose a stable version to use, avoid the `@stable` meta constraint.

Otherwise, install the library and setup the autoloader yourself.

Example
-------

[](#example)

```
use Distill\Distill;

$distill = new Distill();
$distill->extract(__DIR__ . '/../tests/files/file_ok.zip', __DIR__ . '/extract');
```

Formats
-------

[](#formats)

Strategies
----------

[](#strategies)

Distill allows to choose one format in case there are many available. For example, it can be useful for installers that want to reduce the bandwidth usage trying to choose compression formats with higher compression ratio and available in the client machine.

The library provides three strategies (more can be added):

- Minimum size (default): Choose files with higher compression ratio.
- Uncompression speed: Choose files which are faster to uncompress.
- Random: Gets a random file which can be uncompressed by the system.

```
use Distill\Distill;

$distill = new Distill();

$preferredFile = $distill
    ->getChooser()
    ->setStrategy(new \Distill\Strategy\MinimumSize())
    ->addFile('http://get.symfony.com/Symfony_Standard_Vendors_2.5.3.zip')
    ->addFile('http://get.symfony.com/Symfony_Standard_Vendors_2.5.3.tgz')
    ->getPreferredFile();

echo $preferredFile; // http://get.symfony.com/Symfony_Standard_Vendors_2.5.3.tgz
```

```
use Distill\Distill;

$distill = new Distill();

$preferredFile = $distill
    ->getChooser()
    ->setStrategy(new \Distill\Strategy\UncompressionSpeed())
    ->addFile('test.phar')
    ->addFile('test.zip')
    ->getPreferredFile();

echo $preferredFile; // test.zip
```

Command line tool
-----------------

[](#command-line-tool)

If you are looking for a command line tool to extract compressed files check out [distill-cli](https://github.com/raulfraile/distill-cli), which uses this library:

```
$ distill-cli extract archive.tar.gz path/

```

Contributing
------------

[](#contributing)

See [CONTRIBUTING](https://github.com/GBeushausen/distill/blob/master/CONTRIBUTING.md) file.

Running the Tests
-----------------

[](#running-the-tests)

Install the [Composer](http://getcomposer.org/) `dev` dependencies:

```
$ composer install --dev

```

Then, run the test suite using [PHPUnit](http://phpunit.de/):

```
$ phpunit

```

Credits
-------

[](#credits)

- Raul Fraile ([@raulfraile](https://twitter.com/raulfraile))
- [All contributors](https://github.com/GBeushausen/distill/graphs/contributors)

License
-------

[](#license)

Distill is released under the MIT License. See the bundled [LICENSE](https://github.com/GBeushausen/distill/blob/master/LICENSE) file for details.

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 94.4% 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

Every ~70 days

Recently: every ~445 days

Total

28

Last Release

2372d ago

PHP version history (2 changes)v0.1PHP &gt;=5.4.0

0.9.11PHP &gt;=7.2.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/c224ade9f6824712457a7f8e94f8767cab18adbfb177bf1a3f98794ff0548271?d=identicon)[GBeushausen](/maintainers/GBeushausen)

---

Top Contributors

[![raulfraile](https://avatars.githubusercontent.com/u/595160?v=4)](https://github.com/raulfraile "raulfraile (318 commits)")[![xabbuh](https://avatars.githubusercontent.com/u/1957048?v=4)](https://github.com/xabbuh "xabbuh (5 commits)")[![GBeushausen](https://avatars.githubusercontent.com/u/7177165?v=4)](https://github.com/GBeushausen "GBeushausen (5 commits)")[![mcuadros](https://avatars.githubusercontent.com/u/1573114?v=4)](https://github.com/mcuadros "mcuadros (3 commits)")[![andreybolonin](https://avatars.githubusercontent.com/u/2576509?v=4)](https://github.com/andreybolonin "andreybolonin (2 commits)")[![weaverryan](https://avatars.githubusercontent.com/u/121003?v=4)](https://github.com/weaverryan "weaverryan (2 commits)")[![jeromegamez](https://avatars.githubusercontent.com/u/67554?v=4)](https://github.com/jeromegamez "jeromegamez (1 commits)")[![dmouse](https://avatars.githubusercontent.com/u/198571?v=4)](https://github.com/dmouse "dmouse (1 commits)")

---

Tags

pharcompressionarchivezipextractorbzipunzipgziprarbzip2cab7zipstrategyepubbz2tar.gzxztar.xztgz

### Embed Badge

![Health badge](/badges/gbeushausen-distill/health.svg)

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

###  Alternatives

[raulfraile/distill

Smart compressed files extractor

228190.4k9](/packages/raulfraile-distill)[wapmorgan/unified-archive

UnifiedArchive - an archive manager with unified interface of working with all popular archive formats (zip/7z/rar/gz/bz2/xz/cab/tar/tar.gz/tar.bz2/tar.x/tar.Z/...) for PHP with ability for listing, reading, extracting and creation + built-in console archive manager.

2791.6M7](/packages/wapmorgan-unified-archive)[alchemy/zippy

Zippy, the archive manager companion

47522.6M51](/packages/alchemy-zippy)[nelexa/zip

PhpZip is a php-library for extended work with ZIP-archives. Open, create, update, delete, extract and get info tool. Supports appending to existing ZIP files, WinZip AES encryption, Traditional PKWARE Encryption, BZIP2 compression, external file attributes and ZIP64 extensions. Alternative ZipArchive. It does not require php-zip extension.

4967.4M111](/packages/nelexa-zip)[splitbrain/php-archive

Pure-PHP implementation to read and write TAR and ZIP archives

1061.4M20](/packages/splitbrain-php-archive)[phpzip/phpzip

Package to create and stream archives of compressed files in ZIP format with PHP 5.3+

124840.7k9](/packages/phpzip-phpzip)

PHPackages © 2026

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