PHPackages                             wapmorgan/cab-archive - 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. wapmorgan/cab-archive

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

wapmorgan/cab-archive
=====================

Reading and extraction of .cab-files

0.0.7(7y ago)313.2k↓50%1MITPHP

Since Jan 17Pushed 6y ago3 watchersCompare

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

READMEChangelog (7)Dependencies (1)Versions (7)Used By (0)

CabArchive
==========

[](#cabarchive)

**CabArchive** is reader of CAB (Microsoft Cabinet files).

[![Total Downloads](https://camo.githubusercontent.com/f8fe607127130c46a721d007f4e65c87fc0cfa8b760685eb50ee9256ba7c745f/68747470733a2f2f706f7365722e707567782e6f72672f7761706d6f7267616e2f6361622d617263686976652f646f776e6c6f616473)](https://packagist.org/packages/wapmorgan/cab-archive)[![Latest Stable Version](https://camo.githubusercontent.com/635945844300bbbc15f5a81f4add93db33f5aadb6b2eb9326f278bf32fdb2b75/68747470733a2f2f706f7365722e707567782e6f72672f7761706d6f7267616e2f6361622d617263686976652f762f737461626c65)](https://packagist.org/packages/wapmorgan/cab-archive)[![License](https://camo.githubusercontent.com/85f3119e5592a3521a41b8c87426236d0e4cbc4bcefb296192b8d245e69b94c9/68747470733a2f2f706f7365722e707567782e6f72672f7761706d6f7267616e2f6361622d617263686976652f6c6963656e7365)](https://packagist.org/packages/wapmorgan/cab-archive)[![Latest Unstable Version](https://camo.githubusercontent.com/fda70477ab8cbb0b87d1dae53c5ff22c7590ee37150f099d5f694dee4c86a562/68747470733a2f2f706f7365722e707567782e6f72672f7761706d6f7267616e2f6361622d617263686976652f762f756e737461626c65)](https://packagist.org/packages/wapmorgan/cab-archive)

**Precaution!** Right now library provide functionality to extract files only on PHP 7.0.22+, 7.1.8+, 7.2.0 due to bug in previous versions.

Usage
=====

[](#usage)

Firstly, you need to create CabArchive instance:

```
$cab = new CabArchive('123.cab');
```

After that you can get list of files in archive:

```
var_dump($cab->getFileNames());
```

After that you can get all information about one file in archive:

```
var_dump($cab->getFileData('README.md'));
```

CabArchive API
--------------

[](#cabarchive-api)

All list of properties and methods of `CabArchive` is listed below.

- `$filesCount` - number of files in Cab-archive
- `__construct($filename)` - creates new instance from file, stream or socket
- `getCabHeader()` - returns header of Cab-archive as array
- `hasPreviousCab()` - checks that this cab has previous Cab in set
- `getPreviousCab()` - returns name of previous Cab
- `hasNextCab()` - checks that this cab has next Cab in set
- `getNextCab()` - returns name of next Cab
- `getSetId()` - returns set id (identical for all cab-archives from one set)
- `getInSetNumber()` - returns number of cab in set
- `getFileNames(): array` - retrives list of files from archive
- `getFileData($filename): object` - returns additional info of file as object.
- `getFileAttributes($filename): array` - returns list of file attributes. All available attributes:
    - `CabArchive::ATTRIB_READONLY`
    - `CabArchive::ATTRIB_HIDDEN`
    - `CabArchive::ATTRIB_SYSTEM`
    - `CabArchive::ATTRIB_EXEC`
- `getFileContent($filename): string` - returns raw content of file.
- `extract($output, array $files = []): bool|int` - extracts file or files to specific folder.

### getFileNames

[](#getfilenames)

```
array getFileNames()
```

This method returns an array of file names compressed in cab.

### getFileData

[](#getfiledata)

```
object getFileData($filename)
```

This method returns an object with following fields:

- **size** - uncompressed size in bytes
- **packedSize** - compressed size in bytes
- **unixtime** - date&amp;time of modification in unixtime format
- **isCompressed** - is file compressed as *boolean*

### getFileContent

[](#getfilecontent)

```
string getFileContent($filename)
```

This method returns raw file content of `$filename`. Supports extracting from cab's without compression and with MSZip compression. LZX compression is not supported.

Works correctly only on PHP:

- 7.0.22+
- 7.1.8+
- 7.2.0

### extract

[](#extract)

```
int|bool extract($outputDirectory, array $files = [])
```

This method extracts passed files or the whole cab to `$outputDirectory`.

Supports extracting from cab's without compression and with MSZip compression. LZX compression is not supported.

Works correctly only on PHP:

- 7.0.22+
- 7.1.8+
- 7.2.0

CAB Format
----------

[](#cab-format)

- .CAB-files format is described at
- MSZIP compression (based on Deflate) is described at [http://interoperability.blob.core.windows.net/files/MS-MCI/\[MS-MCI\].pdf](http://interoperability.blob.core.windows.net/files/MS-MCI/%5BMS-MCI%5D.pdf)

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity28

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity57

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

Every ~120 days

Recently: every ~150 days

Total

6

Last Release

2797d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/6000618?v=4)[Sergey](/maintainers/wapmorgan)[@wapmorgan](https://github.com/wapmorgan)

---

Top Contributors

[![wapmorgan](https://avatars.githubusercontent.com/u/6000618?v=4)](https://github.com/wapmorgan "wapmorgan (37 commits)")

---

Tags

archivescabextractarchivecabcabinet

### Embed Badge

![Health badge](/badges/wapmorgan-cab-archive/health.svg)

```
[![Health](https://phpackages.com/badges/wapmorgan-cab-archive/health.svg)](https://phpackages.com/packages/wapmorgan-cab-archive)
```

###  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)[raulfraile/distill

Smart compressed files extractor

228190.4k9](/packages/raulfraile-distill)[pear/archive_tar

Tar file management class with compression support (gzip, bzip2, lzma2)

7561.0M72](/packages/pear-archive-tar)[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)
