Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

phar.setmetadata(3) [php man page]

PHAR.SETMETADATA(3)							 1						       PHAR.SETMETADATA(3)

Phar::setMetadata - Sets phar archive meta-data

SYNOPSIS
public void Phar::setMetadata (mixed $metadata) 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. Phar.setMetadata(3) should be used to store customized data that describes something about the phar archive as a complete entity. PharFile- Info.setMetadata(3) should be used for file-specific meta-data. Meta-data can slow down the performance of loading a phar archive if the data is large. Some possible uses for meta-data include specifying which file within the archive should be used to bootstrap the archive, or the location of a file manifest like PEAR's package.xml file. However, any useful data that describes the phar archive may be stored. PARAMETERS
o $metadata - Any PHP variable containing information to store that describes the phar archive RETURN VALUES
No value is returned. EXAMPLES
Example #1 A Phar.setMetadata(3) example <?php // make sure it doesn't exist @unlink('brandnewphar.phar'); try { $p = new Phar(dirname(__FILE__) . '/brandnewphar.phar', 0, 'brandnewphar.phar'); $p['file.php'] = '<?php echo "hello"'; $p->setMetadata(array('bootstrap' => 'file.php')); var_dump($p->getMetadata()); } catch (Exception $e) { echo 'Could not create and/or modify phar:', $e; } ?> The above example will output: array(1) { ["bootstrap"]=> string(8) "file.php" } SEE ALSO
Phar.getMetadata(3), Phar.delMetadata(3), Phar.hasMetadata(3). PHP Documentation Group PHAR.SETMETADATA(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