PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » File Formats » File_Cabinet » Manual

Microsoft Cabinet file extraction using either cabextract or expand

Introduction

Introduction – Extraction of Microsoft Cabinet files

Synopsis

<?php
require_once 'File/Cabinet.php';

// optional step: specify the command static property
File_Cabinet::$command = '/usr/local/bin/cabextract';

$cabinet = new File_Cabinet('cabinet.cab');

// Extract the contents of 1 file
$file_contents = $cabinet->extract('a_file.txt');

// Extract the contents of multiple files (returns an array)
$file_contents = $cabinet->extract(array('a_file.txt', 'another_file.txt'));

// Extract using a glob (returns a concatenated string)
$file_contents = $cabinet->extract('*.txt');

// Extract to a directory
$cabinet->extract('a_file.txt', '/path/to/extraction/dir');
?>