fileManager = $fileManager; } /** * Unzip archive. * * @param string $file Path to .zip file. * @param string $destinationPath Destination path. * @return bool */ public function unzip($file, $destinationPath) { if (!class_exists('\ZipArchive')) { throw new RuntimeException("php-zip extension is not installed. Cannot unzip the file."); } $zip = new \ZipArchive; $res = $zip->open($file); if ($res === true) { $this->fileManager->mkdir($destinationPath); $zip->extractTo($destinationPath); $zip->close(); return true; } return false; } }