Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

phar.extractto(3) [php man page]

PHAR.EXTRACTTO(3)							 1							 PHAR.EXTRACTTO(3)

Phar::extractTo - Extract the contents of a phar archive to a directory

SYNOPSIS
public bool Phar::extractTo (string $pathto, [string|array $files], [bool $overwrite = false]) DESCRIPTION
Note This method requires the php.ini setting phar.readonly to be set to 0 in order to work for Phar objects. Otherwise, a PharException will be thrown. Extract all files within a phar archive to disk. Extracted files and directories preserve permissions as stored in the archive. The optional parameters allow optional control over which files are extracted, and whether existing files on disk can be overwritten. The sec- ond parameter files can be either the name of a file or directory to extract, or an array of names of files and directories to extract. By default, this method will not overwrite existing files, the third parameter can be set to true to enable overwriting of files. This method is similar to ZipArchive.extractTo(3). PARAMETERS
o $pathto - Path within an archive to the file to delete. o $files - The name of a file or directory to extract, or an array of files/directories to extract o $overwrite - Set to TRUE to enable overwriting existing files RETURN VALUES
returns TRUE on success, but it is better to check for thrown exception, and assume success if none is thrown. ERRORS
/EXCEPTIONS Throws PharException if errors occur while flushing changes to disk. EXAMPLES
Example #1 A Phar.extractTo(3) example <?php try { $phar = new Phar('myphar.phar'); $phar->extractTo('/full/path'); // extract all files $phar->extractTo('/another/path', 'file.txt'); // extract only file.txt $phar->extractTo('/this/path', array('file1.txt', 'file2.txt')); // extract 2 files only $phar->extractTo('/third/path', null, true); // extract all files, and overwrite } catch (Exception $e) { // handle errors } ?> SEE ALSO
PharData.extractTo(3). PHP Documentation Group PHAR.EXTRACTTO(3)

Check Out this Related Man Page

PHARDATA(3)								 1							       PHARDATA(3)

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 PharDataextends Phar Methods o bool PharData::addEmptyDir (string $dirname) o public void Phar::addFile (string $file, [string $localname]) o bool PharData::addFromString (string $localname, string $contents) o public array Phar::buildFromDirectory (string $base_dir, [string $regex]) o array PharData::buildFromIterator (Iterator $iter, [string $base_directory]) o object PharData::compress (int $compression, [string $extension]) o bool PharData::compressFiles (int $compression) o PharData::__construct Phar::TAR (string $fname, [int $flags], [string $alias], [int $format]) o PharData PharData::convertToData ([int $format], [int $compression], [string $extension]) o Phar PharData::convertToExecutable ([int $format], [int $compression], [string $extension]) o bool PharData::copy (string $oldfile, string $newfile) o object PharData::decompress ([string $extension]) o bool PharData::decompressFiles (void ) o bool PharData::delMetadata (void ) o bool PharData::delete (string $entry) o bool PharData::extractTo (string $pathto, [string|array $files], [bool $overwrite = false]) o bool PharData::isWritable (void ) o void PharData::offsetSet (string $offset, string $value) o bool PharData::offsetUnset (string $offset) o bool PharData::setAlias (string $alias) o bool PharData::setDefaultStub ([string $index], [string $webindex]) o public void Phar::setMetadata (mixed $metadata) o public void Phar::setSignatureAlgorithm (int $sigtype) o bool PharData::setStub (string $stub, [int $len = -1]) Inherited methods o public void Phar::addEmptyDir (string $dirname) o public void Phar::addFile (string $file, [string $localname]) o public void Phar::addFromString (string $localname, string $contents) o finalpublicstatic string Phar::apiVersion (void ) o public array Phar::buildFromDirectory (string $base_dir, [string $regex]) o public array Phar::buildFromIterator (Iterator $iter, [string $base_directory]) o finalpublicstatic bool Phar::canCompress ([int $type]) o finalpublicstatic bool Phar::canWrite (void ) o public object Phar::compress (int $compression, [string $extension]) o public bool Phar::compressAllFilesBZIP2 (void ) o public bool Phar::compressAllFilesGZ (void ) o public void Phar::compressFiles (int $compression) o public Phar::__construct (string $fname, [int $flags], [string $alias]) o public PharData Phar::convertToData ([int $format = 9021976], [int $compression = 9021976], [string $extension]) o public Phar Phar::convertToExecutable ([int $format = 9021976], [int $compression = 9021976], [string $extension]) o public bool Phar::copy (string $oldfile, string $newfile) o public int Phar::count (void ) o finalpublicstatic string Phar::createDefaultStub ([string $indexfile], [string $webindexfile]) o public object Phar::decompress ([string $extension]) o public bool Phar::decompressFiles (void ) o public bool Phar::delMetadata (void ) o public bool Phar::delete (string $entry) o public bool Phar::extractTo (string $pathto, [string|array $files], [bool $overwrite = false]) o public mixed Phar::getMetadata (void ) o public bool Phar::getModified (void ) o public array Phar::getSignature (void ) o public string Phar::getStub (void ) o finalpublicstatic array Phar::getSupportedCompression (void ) o finalpublicstatic array Phar::getSupportedSignatures (void ) o public string Phar::getVersion (void ) o public bool Phar::hasMetadata (void ) o finalpublicstatic void Phar::interceptFileFuncs (void ) o public bool Phar::isBuffering (void ) o public mixed Phar::isCompressed (void ) o public bool Phar::isFileFormat (int $format) o finalpublicstatic bool Phar::isValidPharFilename (string $filename, [bool $executable = true]) o public bool Phar::isWritable (void ) o finalpublicstatic bool Phar::loadPhar (string $filename, [string $alias]) o finalpublicstatic bool Phar::mapPhar ([string $alias], [int $dataoffset]) o finalpublicstatic void Phar::mount (string $pharpath, string $externalpath) o finalpublicstatic void Phar::mungServer (array $munglist) o public bool Phar::offsetExists (string $offset) o public int Phar::offsetGet (string $offset) o public void Phar::offsetSet (string $offset, string $value) o public bool Phar::offsetUnset (string $offset) o finalpublicstatic string Phar::running ([bool $retphar = true]) o public bool Phar::setAlias (string $alias) o public bool Phar::setDefaultStub ([string $index], [string $webindex]) o public void Phar::setMetadata (mixed $metadata) o public void Phar::setSignatureAlgorithm (int $sigtype, [string $privatekey]) o public bool Phar::setStub (string $stub, [int $len = -1]) o public void Phar::startBuffering (void ) o public void Phar::stopBuffering (void ) o public bool Phar::uncompressAllFiles (void ) o finalpublicstatic bool Phar::unlinkArchive (string $archive) o finalpublicstatic void Phar::webPhar ([string $alias], [string $index = "index.php"], [string $f404], [array $mimetypes], [callable $rewrites]) PHP Documentation Group PHARDATA(3)
Man Page