Matomo Decompress

A PHP library of unified adapters for extracting Zip, Gzip, Bzip, and Tar archives.

Library
Composer
v3.0.0
12stars
LGPL-3.0

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
28/100Needs Attention
Development Activity0
Maintenance20
Community20
Maturity60
Momentum12

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
68/100Good
Architecture74
Code Quality68
Innovation52
Learning Curve78

Matomo Decompress is a small PHP component, split out of the Matomo analytics platform, that provides a single consistent interface for extracting the common archive and compression formats used when distributing plugins, updates, and data files. Instead of learning each PHP extension or bundled library separately, you pick the adapter that matches your archive and call the same decompress method.

It supports Zip, Gzip, Bzip, and Tar (gzip or bzip) through adapters that wrap PHP’s native functions, the Zip extension, the bundled PclZip library, and PEAR’s Archive_Tar, so it works across environments regardless of which extensions are available.

What You Get

  • A single DecompressInterface shared by every format adapter
  • Adapters for Zip (ZipArchive and PclZip), Gzip, Bzip, and Tar archives
  • A bundled PclZip fallback for environments without the Zip extension
  • Tar support backed by PEAR’s Archive_Tar library
  • Consistent extraction and error reporting across all formats

Common Use Cases

  • Extracting downloaded plugin or update archives during installation
  • Unpacking Gzip or Bzip compressed data files for processing
  • Handling Zip uploads without depending on a specific PHP extension being present
  • Extracting Tar archives created by other tooling

Under The Hood

Architecture - Every adapter (ZipArchive, PclZip, Gzip, Bzip, Tar) implements the shared DecompressInterface in src/, so callers depend on the interface and select an implementation by format. The ZipArchive and PclZip adapters give a native/pure-PHP pair for zip extraction, letting the caller fall back when the Zip extension is unavailable; Tar delegates to Archive_Tar and the classmapped PclZip library under libs/.

Tech Stack - Pure PHP (>=7.2) with PSR-4 autoloading for Matomo\Decompress\ plus a classmap for the bundled PclZip. It requires pear/archive_tar (^1.4.3) for tar handling and otherwise leans on PHP’s native gzip/bzip functions and the optional Zip extension.

Code Quality - The component is intentionally tiny and focused, with one class per format and a tests/ directory using PHPUnit. The interface-per-format design keeps each adapter self-contained and easy to reason about, though the project is now maintenance-only.

API Design - Adapters share the same small method surface, so extracting a Zip and extracting a Tar look identical from the caller’s side. Choosing the right adapter is the only real decision, which keeps integration boilerplate low.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search