Files
ave-cms/help/en/helpers/Zip.md
T
2026-07-27 12:58:44 +03:00

1.1 KiB

Zip - archives

App\Helpers\Zip - a wrapper around ZipArchive for creating and unpacking archives. Used as instance (new Zip()).

use App\Helpers\Zip;

$zip = new Zip();

Usage

The class encapsulates working with ZipArchive: creating an archive, adding files and directories, saving and unpacking. For the exact set of methods and their signatures, see system/App/Helpers/Zip.php (API repeats the logic of ZipArchive).

Typical scenario:

$zip = new Zip();
// открыть/создать архив, добавить файлы каталога, закрыть — по методам класса
// затем отдать пользователю:
File::download(BASEPATH . '/exports/backup.zip', null, 'backup.zip');

Recipe

Submit the generated archive for download:

// ... сборка архива через $zip ...
Response::download($archivePath, 'export.zip');

To upload the finished file, use File::download() or Response::download(). Directories - Dir.