View on GitHub

CabArchive

CabArchive - reader of cab-archives

CabArchive

CabArchive is reader of CAB (Microsoft Cabinet files).

Total Downloads Latest Stable Version License Latest Unstable Version

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

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

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

getFileNames

array getFileNames()

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

getFileData

object getFileData($filename)

This method returns an object with following fields:

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:

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:

CAB Format