PHPackages                             cataphract/libarchive - 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. cataphract/libarchive

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

cataphract/libarchive
=====================

PHP extension for reading and writing archives via libarchive

v0.2.0(3mo ago)2121MITPHPPHP ^8.0CI passing

Since Mar 10Pushed 3mo ago2 watchersCompare

[ Source](https://github.com/cataphract/php-libarchive)[ Packagist](https://packagist.org/packages/cataphract/libarchive)[ RSS](/packages/cataphract-libarchive/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

php-libarchive
==============

[](#php-libarchive)

PHP extension for reading archives (tar, zip, 7-zip, cpio, …) via [libarchive](https://libarchive.org/). Supports all compression filters the installed libarchive recognises (gzip, bzip2, xz, zstd, …).

Requirements
------------

[](#requirements)

- PHP 8.0+
- libarchive 3.x

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

[](#installation)

```
pie install cataphract/libarchive
```

Usage
-----

[](#usage)

### Extract an archive to disk

[](#extract-an-archive-to-disk)

```
use libarchive\Archive;
use libarchive\EXTRACT_PERM;
use libarchive\EXTRACT_TIME;

$archive = new Archive('/path/to/archive.tar.gz', EXTRACT_PERM | EXTRACT_TIME);

chdir('/tmp/extract');

foreach ($archive as $entry) {
    echo $entry->pathname . "\n";
    $archive->extractCurrent($entry);
}
```

### Read an entry as a stream

[](#read-an-entry-as-a-stream)

```
use libarchive\Archive;

$archive = new Archive('/path/to/archive.zip');

foreach ($archive as $entry) {
    if ($entry->pathname === 'data.json') {
        $stream = $archive->currentEntryStream();
        $contents = stream_get_contents($stream);
        fclose($stream);
        break;
    }
}
```

API
---

[](#api)

See [`libarchive.stub.php`](libarchive.stub.php) for the full class and constant documentation.

License
-------

[](#license)

MIT

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance80

Actively maintained with recent releases

Popularity9

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity29

Early-stage or recently created project

 Bus Factor1

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

105d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/53b8ce5f39a88fe7d48c853bf017b7913a1b805453b4b5c2319d5b0dd5dfa26f?d=identicon)[cataphract](/maintainers/cataphract)

---

Top Contributors

[![cataphract](https://avatars.githubusercontent.com/u/496394?v=4)](https://github.com/cataphract "cataphract (21 commits)")[![remicollet](https://avatars.githubusercontent.com/u/270445?v=4)](https://github.com/remicollet "remicollet (2 commits)")

---

Tags

libarchivephp

### Embed Badge

![Health badge](/badges/cataphract-libarchive/health.svg)

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

PHPackages © 2026

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