Delicious Bookmark this on Delicious Share on Facebook SlashdotSlashdot It! Digg! Digg



PHP : Function Reference : Phar archive stream and classes : Phar::loadPhar

Phar::loadPhar

Loads any phar archive with an alias ()
mixed Phar::loadPhar ( string filename [, string alias] )

This can be used to read the contents of an external Phar archive. This is most useful for assigning an alias to a phar so that subsequent references to the phar can use the shorter alias, or for loading Phar archives that only contain data and are not intended for execution/inclusion in PHP scripts.

Parameters

filename

the full or relative path to the phar archive to open

alias

The alias that may be used to refer to the phar archive. Note that many phar archives specify an explicit alias inside the phar archive, and a PharException will be thrown if a new alias is specified in this case.

Return Values

Returns TRUE on success or FALSE on failure.

Errors/Exceptions

PharException is thrown if an alias is passed in and the phar archive already has an explicit alias

Examples

Example 1806. A Phar::loadPhar() example

Phar::loadPhar can be used anywhere to load an external Phar archive, whereas Phar::mapPhar should be used in a loader stub for a Phar.

<?php
try {
   
Phar::loadPhar('/path/to/phar.phar', 'my.phar');
   echo
file_get_contents('phar://my.phar/file.txt');
} catch (
PharException $e) {
   echo
$e;
}
?>


See Also
Phar::mapPhar()

Change Language


Follow Navioo On Twitter
Phar::apiVersion
Phar::canCompress
Phar::canWrite
Phar->compressAllFilesBZIP2
Phar->compressAllFilesGZ
Phar::__construct
Phar->count
Phar->getMetaData
Phar->getModified
Phar->getSignature
Phar->getStub
Phar->getVersion
Phar->isBuffering
Phar::loadPhar
Phar::mapPhar
Phar::offsetExists
Phar::offsetGet
Phar::offsetSet
Phar::offsetUnset
Phar->setMetaData
Phar->setStub
Phar->startBuffering
Phar->stopBuffering
Phar->uncompressAllFiles
PharFileInfo->chmod
PharFileInfo::__construct
PharFileInfo->getCompressedSize
PharFileInfo->getCRC32
PharFileInfo->getMetaData
PharFileInfo->getPharFlags
PharFileInfo->isCompressed
PharFileInfo->isCompressedBZIP2
PharFileInfo->isCompressedGZ
PharFileInfo->isCRCChecked
PharFileInfo->setCompressedBZIP2
PharFileInfo->setCompressedGZ
PharFileInfo->setMetaData
PharFileInfo->setUncompressed
eXTReMe Tracker