The Example in the introduction does not work:
$p->begin() and $p->commit()
must be changed to
$p->startBuffering() and $p->stopBuffering
see also: http://pecl.php.net/package-changelog.php?package=phar at version 1.0.0
![]() |
|
||||||||||
|
CXX. Phar archive stream and classesВведениеThe phar extension provides the phar stream wrapper and the Phar class for manipulating self-contained PHP Archive (phar) files. The Phar class can be used to create and to extract contents of phar files as well as iterating over their contents. PHP Archive files (Phars) are special collections of files that can be transparently run right out of the file, similar to Java's jar archive files. Using a phar archive, it is possible to distribute a complete PHP application in a single file that will run out of the file without modification or extraction. Phar archives can also be used to store files for extraction similar to tar or zip archive files. Phars support compression using gzip if the zlib extension is present, and using bzip2 if the bz2 extension is present. In addition, iteration and other features are available if the SPL extension is available. Phar signature verification using md5 or sha1 is natively supported if the hash extension is available. The original implementation for Phar archives was in the PEAR package PHP_Archive, and the implementation details are very similar. ТребованияPhar requires PHP 5.2.0 or newer. Additional features require the SPL extension in order to take advantage of iteration and array access to a Phar's file contents. The phar stream does not require any additional extensions to function. You may optionally wish to enable the zlib and bzip2 extensions to take advantage of compressed phar support. In addition, the hash extension can be used for signing phars and verifying integrity. УстановкаWindows binaries may be found at http://snaps.php.net/. To install, download php_phar.dll to the folder specified by your php.ini file's extension_dir directive. Enable it by adding extension=php_phar.dll to your php.ini and restarting your webserver.
Linux, BSD, and other *nix variants can be compiled using the following steps:
Дополнительная информация, такая как новый версии, скачивание, исходные файлы, информация о разработчике и CHANGELOG, могут быть найдены здесь: http://pecl.php.net/package/phar. Настройка во время выполненияПоведение этих функций зависит от установок в php.ini.
Таблица 1. Filesystem and Streams Configuration Options
Краткое разъяснение конфигурационных директив.
Типы ресурсовThe Phar extension provides the phar stream, which allows accessing files contained within a phar transparently. The file format of a Phar is described here Предопределенные классы
Phar file formatAll Phar files contain three to four sections:
Phar file stubA Phar's stub is a simple PHP file. The smallest possible stub follows:
A stub must contain as a minimum, the __HALT_COMPILER(); token at its conclusion. Typically, a stub will contain loader functionality like so:
There are no restrictions on the contents of a Phar stub, except for the requirement that it conclude with __HALT_COMPILER();. The closing PHP tag ?> may be included or omitted, but there can be no more than 1 space between the ; and the close tag ?> or the phar extension will be unable to process the Phar archive. Phar Manifest FormatThe Phar manifest is a highly optimized format that allows per-file specification of file compression, file permissions, and even user-defined meta-data such as user or group. All values greater than 1 byte are stored in little-endian byte order, with the exception of the API version, which for historical reasons is stored as 3 nibbles in big-endian order. All unused flags are reserved for future use, and must not be used to store custom information. Use the per-file meta-data facility to store customized information about particular files. The basic file format of a Phar archive manifest is as follows:
Таблица 2. Global Phar manifest format
Global Phar bitmapped flagsHere are the bitmapped flags currently recognized by the Phar extension for the global Phar flat bitmap:
Таблица 3. Bitmap values recognized
Phar manifest file entry definitionEach file in the manifest contains the following information:
Таблица 4. Phar Manifest file entry
The File-specific bitmap values recognized are:
Таблица 5. Bitmap values recognized
Phar Signature formatPhars containing a signature always have the signature
Таблица 6. Signature format
Phar archive stream and classes
mannheimer11 at gmx dot de
29-Oct-2007 02:28
The Example in the introduction does not work:
judas dot iscariote at gmail dot comnospam
08-May-2007 04:12
Binary packages of the Phar extension for SUSE/openSUSE are available here: |