The PharData class
Introduction
(PHP 5 >= 5.3.0, PHP 7, PECL phar >= 2.0.0)
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
/* Inherited constants */
/* Methods */
public addEmptyDir ( string $dirname ) : void
public addFile ( string $file [, string $localname ] ) : void
public addFromString ( string $localname , string $contents ) : void
public buildFromDirectory ( string $base_dir [, string $regex ] ) : array
public buildFromIterator ( Iterator $iter [, string $base_directory ] ) : array
public compress ( int $compression [, string $extension ] ) : PharData
public compressFiles ( int $compression ) : void
public __construct ( string $fname [, int $flags [, string $alias [, int $format = Phar::TAR ]]] )
public convertToData ([ int $format [, int $compression [, string $extension ]]] ) : PharData
public convertToExecutable ([ int $format [, int $compression [, string $extension ]]] ) : Phar
public copy ( string $oldfile , string $newfile ) : bool
public decompress ([ string $extension ] ) : PharData
public decompressFiles ( ) : bool
public delMetadata ( ) : bool
public delete ( string $entry ) : bool
public extractTo ( string $pathto [, string|array|null $files = null [, bool $overwrite = false ]] ) : bool
public isWritable ( ) : bool
public offsetSet ( string $offset , string $value ) : void
public offsetUnset ( string $offset ) : bool
public setAlias ( string $alias ) : bool
public setDefaultStub ([ string $index [, string $webindex ]] ) : bool
public setMetadata ( mixed $metadata ) : void
public setSignatureAlgorithm ( int $sigtype ) : void
public setStub ( string $stub [, int $len = -1 ] ) : bool}
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)
- PharData::setMetadata — Sets phar archive meta-data
- PharData::setSignatureAlgorithm — Set the signature algorithm for a phar and apply it
- PharData::setStub — Dummy function (Phar::setStub is not valid for PharData)
© 1997–2020 The PHP Documentation Group
Licensed under the Creative Commons Attribution License v3.0 or later.
https://www.php.net/manual/en/class.phardata.php