PHPackages                             raulfraile/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. [File &amp; Storage](/categories/file-storage)
4. /
5. raulfraile/distill

ActiveLibrary[File &amp; Storage](/categories/file-storage)

raulfraile/distill
==================

Smart compressed files extractor

v0.9.10(10y ago)228190.4k—7.2%20[8 issues](https://github.com/raulfraile/distill/issues)9MITPHPPHP &gt;=5.4.0

Since Aug 31Pushed 7y ago7 watchersCompare

[ Source](https://github.com/raulfraile/distill)[ Packagist](https://packagist.org/packages/raulfraile/distill)[ RSS](/packages/raulfraile-distill/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (6)Versions (31)Used By (9)

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": {
        "raulfraile/distill": "@stable"
    }
}
```

**Protip**: you should browse the [raulfraile/distill](https://packagist.org/packages/raulfraile/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/raulfraile/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/raulfraile/distill/contributors)

License
-------

[](#license)

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

###  Health Score

42

—

FairBetter than 90% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity51

Moderate usage in the ecosystem

Community28

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 96.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 ~18 days

Recently: every ~90 days

Total

27

Last Release

3808d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2bcd01016c2803c00217ef46398e0467893e4c04f5d054ac579d6723568a0677?d=identicon)[raulfraile](/maintainers/raulfraile)

---

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)")[![mcuadros](https://avatars.githubusercontent.com/u/1573114?v=4)](https://github.com/mcuadros "mcuadros (3 commits)")[![weaverryan](https://avatars.githubusercontent.com/u/121003?v=4)](https://github.com/weaverryan "weaverryan (2 commits)")[![dmouse](https://avatars.githubusercontent.com/u/198571?v=4)](https://github.com/dmouse "dmouse (1 commits)")[![jeromegamez](https://avatars.githubusercontent.com/u/67554?v=4)](https://github.com/jeromegamez "jeromegamez (1 commits)")

---

Tags

pharcompressionarchivezipextractorbzipunzipgziprarbzip2cab7zipstrategyepubbz2tar.gzxztar.xztgz

### Embed Badge

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

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

###  Alternatives

[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)[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.4M112](/packages/nelexa-zip)[alchemy/zippy

Zippy, the archive manager companion

47522.6M51](/packages/alchemy-zippy)[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)[zanysoft/laravel-zip

laravel-zip is the world's leading zip utility for file compression and backup.

3142.8M15](/packages/zanysoft-laravel-zip)

PHPackages © 2026

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