PharData
PHP Manual

PharData::convertToZip

(No version information available, might be only in CVS)

PharData::convertToZip — Convert a tar archive to the zip file format

Description

bool PharData::convertToZip ( string $extension )

This method is used to convert a phar archive in phar or tar format to the zip file format.

Parameters

extension

By default, the extension is .zip for converting from tar archives.

Return Values

The method returns a PharData object on success and throws an exception on failure.

Errors/Exceptions

This method throws BadMethodCallException when the requested archive is buffering with PharData::startBuffering() and has not concluded with PharData::stopBuffering(), and a PharException if any problems are encountered during the zip creation process.

Examples

Example#1 A PharData::convertToZip() example

Using PharData::convertToZip():

<?php
try {
    
$tar = new PharData('myphar.tar.gz');
    
// convert it to the zip file format
    
$zip $tar->convertToZip();
} catch (
Exception $e) {
    
// handle the error here
}
?>

See Also


PharData
PHP Manual