Your IP : 216.73.216.240
<?php
/*
* @package Tech Fry Library
* @license https://www.gnu.org/licenses/gpl-3.0.en.html
*/
namespace TechFry\Library;
defined('_JEXEC') or die;
class TZip
{
// create_zip, extract_zip
private $zip;
public function __construct()
{
$this->zip = new \ZipArchive();
}
public function create_zip($zip_path, $files)
{
$this->zip->open($zip_path, \ZipArchive::CREATE);
foreach ($files as $file)
{
$name = basename($file);
$this->zip->addFile($file, $name);
}
$this->zip->close();
}
public function extract_zip($zip_path, $destination)
{
$this->zip->open($zip_path);
$this->zip->extractTo($destination);
}
}