Introduction

Introduction – The PHP_Archive package allows creation of self-contained cross-platform PHP libraries or applications, similar to Java jar files.

Description

PHP_Archive provides the PHP_Archive class, and the phar:// stream wrapper. Using PHP_Archive, it is possible to create self-contained cross-platform PHP libraries and applications. The file format and principles are identical to the Phar extension, which is documented in the PHP manual. PHP_Archive is used to create go-pear.phar and install-pear-nozlib.phar, distributed with PHP since PHP version 5.1.0, and used to install the PEAR Installer itself.

The PHP_Archive class differs in approach from the Phar class in that it does not support the ArrayAccess interface for accessing internal files, and does not support iteration over contents using foreach(). However, full support for the phar:// stream wrapper, support of Phar-specific metadata setting and retrieval using PHP_Archive::getPharMetaData() and file-specific metadata using PHP_Archive::getFileMetaData(), zlib and bzip2 compression of individual files, and archive-wide SHA1/MD5 signature makes PHP_Archive just as powerful as the Phar extension for distributing phars.

The advanced Phar creation features of PHP_Archive are not yet documented, but information is available at the API documentation, and an example usage is in cvs at make-gopear-phar.php.

External Documentation