Open
Description
Is there a helper to uncompress? Currently I'm using the native PHP class ZipArchive, but it seems natural to have an uncompress helper method as well.
private function unzip(string $filename, string $dir)
{
$zip = new ZipArchive();
if ($zip->open($filename)) {
$zip->extractTo($dir);
$zip->close();
} else {
$this->io()->error("Unable to unzip $filename to $dir");
}
}
private function zip(string $dir, string $filename)
{
// compress a local directory (all files (recursive) in "some/local/directory" are added to archive)
$zipFile = ZipFile::compress(new \SplFileInfo($dir), $filename);
}