(No version information available, might be only in CVS)
Phar::convertToTar — Convert the phar archive to the tar file format, optionally compressing the entire archive using gzip or bzip2 compression
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.
This method is used to convert a phar archive in phar or zip format to the tar file format.
This can be one of Phar::GZ or Phar::BZ2. By default, no compression is applied.
The method returns TRUE on success, but it is safer to encase the call within a try/catch block and assume success if an exception is not thrown.
This method throws BadMethodCallException when unable to compress, an unknown compression method has been specified, the requested archive is buffering with Phar::startBuffering() and has not concluded with Phar::stopBuffering(), an UnexpectedValueException if write support is disabled, and a PharException if any problems are encountered during the phar creation process.
Example#1 A Phar::convertToTar() example
Using Phar::convertToTar():
<?php
try {
$zip = new Phar('myphar.zip.phar');
$tar = $zip->convertToTar();
$phar->setStub('<?php include "phar://" . __FILE__ . "/cli.php"; __HALT_COMPILER();');
} catch (Exception $e) {
// handle the error here
}
?>