Phar::webPhar
PharData::addEmptyDir
Phar
PHP Manual

# The PharData class

## Introduction

The PharData class provides a high-level interface to accessing and creating non-executable tar and zip archives. Because these archives do not contain a stub and cannot be executed by the phar extension, it is possible to create and manipulate regular zip and tar files using the PharData class even if phar.readonly php.ini setting is 1.

## Class synopsis

PharData
PharData extends Phar {
/* Properties */
/* Methods */
bool PharData::addEmptyDir ( string `$dirname` )
void Phar::addFile ( string `$file` [, string `$localname` ] )
bool PharData::addFromString ( string `$localname` , string `$contents` )
array Phar::buildFromDirectory ( string `$base_dir` [, string `$regex` ] )
array PharData::buildFromIterator ( Iterator `$iter` [, string `$base_directory` ] )
object PharData::compress ( int `$compression` , string `$extension` )
bool PharData::compressFiles ( int `$compression` )
void PharData::__construct ( string `$fname` [, int `$flags` ] )
PharData PharData::convertToData ([ int `$format` [, int `$compression` [, string `$extension` ]]] )
Phar PharData::convertToExecutable ([ int `$format` [, int `$compression` [, string `$extension` ]]] )
bool PharData::copy ( string `$oldfile` , string `$newfile` )
object PharData::decompress ([ string `$extension` ] )
bool PharData::decompressFiles ( void )
int PharData::delMetadata ( void )
int PharData::delete ( string `$entry` )
int PharData::extractTo ( string `$pathto` [, string|array `$files` [, bool `$overwrite` ]] )
bool PharData::isWritable ( void )
void PharData::offsetSet ( string `$offset` , string `$value` )
bool PharData::offsetUnset ( string `$offset` )
bool PharData::setAlias ( string `$alias` )
void PharData::setDefaultStub ([ string `$index` [, string `$webindex` ]] )
void Phar::setMetadata ( mixed `$metadata` )
void Phar::setSignatureAlgorithm ( int `$sigtype` )
void PharData::setStub ( string `$stub` )
/* Inherited methods */
void Phar::addEmptyDir ( string `$dirname` )
void Phar::addFile ( string `$file` [, string `$localname` ] )
void Phar::addFromString ( string `$localname` , string `$contents` )
string Phar::apiVersion ( void )
array Phar::buildFromDirectory ( string `$base_dir` [, string `$regex` ] )
array Phar::buildFromIterator ( Iterator `$iter` [, string `$base_directory` ] )
bool Phar::canCompress ([ int `$type` ] )
bool Phar::canWrite ( void )
object Phar::compress ( int `$compression` [, string `$extension` ] )
bool Phar::compressAllFilesBZIP2 ( void )
bool Phar::compressAllFilesGZ ( void )
void Phar::compressFiles ( int `$compression` )
void Phar::__construct ( string `$fname` [, int `$flags` [, string `$alias` ]] )
PharData Phar::convertToData ([ int `$format` [, int `$compression` [, string `$extension` ]]] )
Phar Phar::convertToExecutable ([ int `$format` [, int `$compression` [, string `$extension` ]]] )
bool Phar::copy ( string `$oldfile` , string `$newfile` )
int Phar::count ( void )
string Phar::createDefaultStub ([ string `$indexfile` [, string `$webindexfile` ]] )
object Phar::decompress ([ string `$extension` ] )
bool Phar::decompressFiles ( void )
bool Phar::delMetadata ( void )
bool Phar::delete ( string `$entry` )
bool Phar::extractTo ( string `$pathto` [, string|array `$files` [, bool `$overwrite` ]] )
mixed Phar::getMetaData ( void )
bool Phar::getModified ( void )
array Phar::getSignature ( void )
string Phar::getStub ( void )
array Phar::getSupportedCompression ( void )
array Phar::getSupportedSignatures ( void )
string Phar::getVersion ( void )
bool Phar::hasMetadata ( void )
void Phar::interceptFileFuncs ( void )
bool Phar::isBuffering ( void )
mixed Phar::isCompressed ( void )
bool Phar::isFileFormat ( int `$format` )
bool Phar::isValidPharFilename ( string `$filename` [, bool `$executable` ] )
bool Phar::isWritable ( void )
bool Phar::loadPhar ( string `$filename` [, string `$alias` ] )
bool Phar::mapPhar ([ string `$alias` [, int `$dataoffset` ]] )
void Phar::mount ( string `$pharpath` , string `$externalpath` )
void Phar::mungServer ( array `$munglist` )
bool Phar::offsetExists ( string `$offset` )
int Phar::offsetGet ( string `$offset` )
void Phar::offsetSet ( string `$offset` , string `$value` )
bool Phar::offsetUnset ( string `$offset` )
string Phar::running ([ bool `$retphar` ] )
bool Phar::setAlias ( string `$alias` )
bool Phar::setDefaultStub ([ string `$index` [, string `$webindex` ]] )
void Phar::setMetadata ( mixed `$metadata` )
void Phar::setSignatureAlgorithm ( int `$sigtype` [, string `$privatekey` ] )
bool Phar::setStub ( string `$stub` )
void Phar::startBuffering ( void )
void Phar::stopBuffering ( void )
bool Phar::uncompressAllFiles ( void )
bool Phar::unlinkArchive ( string `$archive` )
void Phar::webPhar ([ string `$alias` [, string `$index` [, string `$f404` [, array `$mimetypes` [, array `$rewrites` ]]]]] )
}

## Table of Contents

- PharData::addEmptyDir — Add an empty directory to the tar/zip archive
- PharData::addFile — Add a file from the filesystem to the tar/zip archive
- PharData::addFromString — Add a file from the filesystem to the tar/zip archive
- PharData::buildFromDirectory — Construct a tar/zip archive from the files within a directory.
- PharData::buildFromIterator — Construct a tar or zip archive from an iterator.
- PharData::compress — Compresses the entire tar/zip archive using Gzip or Bzip2 compression
- PharData::compressFiles — Compresses all files in the current tar/zip archive
- PharData::__construct — Construct a non-executable tar or zip archive object
- PharData::convertToData — Convert a phar archive to a non-executable tar or zip file
- PharData::convertToExecutable — Convert a non-executable tar/zip archive to an executable phar archive
- PharData::copy — Copy a file internal to the phar archive to another new file within the phar
- PharData::decompress — Decompresses the entire Phar archive
- PharData::decompressFiles — Decompresses all files in the current zip archive
- PharData::delMetadata — Deletes the global metadata of a zip archive
- PharData::delete — Delete a file within a tar/zip archive
- PharData::extractTo — Extract the contents of a tar/zip archive to a directory
- PharData::isWritable — Returns true if the tar/zip archive can be modified
- PharData::offsetSet — set the contents of a file within the tar/zip to those of an external file or string
- PharData::offsetUnset — remove a file from a tar/zip archive
- PharData::setAlias — dummy function (Phar::setAlias is not valid for PharData)
- PharData::setDefaultStub — dummy function (Phar::setDefaultStub is not valid for PharData)
- Phar::setMetadata — Sets phar archive meta-data
- Phar::setSignatureAlgorithm — set the signature algorithm for a phar and apply it. The
- PharData::setStub — dummy function (Phar::setStub is not valid for PharData)

Phar::webPhar
PharData::addEmptyDir
Phar
PHP Manual