victor78/zippy-ext
Composer 安装命令:
composer require victor78/zippy-ext
包简介
The 7-Zip integration for the Zippy.
README 文档
README
ZippyExt (aka ZippyExtended) is a library extended over Zippy providing the strategy and adapter for using 7-Zip, including password support.
Requirements
- PHP >= 8.1
- 7-Zip (
7zaor7zinPATH) — required only for 7zip adapter
PHP Compatibility
| ZippyExt | PHP |
|---|---|
| 1.x | 8.1–8.3 |
| 0.x | 7.0+ |
Installation
The only supported installation method is via Composer. Run the following command to require ZippyExt in your project:
composer require victor78/zippy-ext
Adapters
ZippyExt currently supports the following drivers and file formats:
- zip
- .zip
- PHP zip extension
- .zip
- GNU tar
- .tar
- .tar.gz
- .tar.bz2
- BSD tar
- .tar
- .tar.gz
- .tar.bz2
- 7zip
- .zip (with optional AES-256 password encryption)
Getting started
All the following code samples assume that ZippyExt is loaded and available as $zippy. You need the following code (or variation of) to load ZippyExt:
<?php use Victor78\ZippyExt\Zippy; // Require Composer's autoloader require __DIR__ . '/vendor/autoload.php'; // Load Zippy $zippy = Zippy::load();
List an archive's contents:
// Open an archive $archive = $zippy->open('build.tar'); // Iterate through members foreach ($archive as $member) { echo "Archive contains $member" . PHP_EOL; }
Extract an archive to a specific directory:
// Open an archive $archive = $zippy->open('build.tar'); // Extract archive contents to `/tmp` $archive->extract('/tmp');
Create a new archive
// Creates an archive.zip that contains a directory "folder" that contains // files contained in "/path/to/directory" recursively $archive = $zippy->create('archive.zip', array( 'folder' => '/path/to/directory' ), true);
Use 7zip
If you need to use 7zip archiving to create a zip archive, use the fourth parameter:
// Creates an archive.zip using the 7zip engine $archive = $zippy->create('archive.zip', $files, true, '7zip');
To create an AES-256 encrypted archive, pass the password as the fifth parameter:
// Creates an archive.zip with AES-256 encryption $archive = $zippy->create('archive.zip', $files, true, '7zip', 'your_password');
To open and extract a password-protected 7zip archive:
// Open archive with password $archive = $zippy->open('archive.zip', '7zip', 'your_password'); $archive->extract('folder_for_extracted');
Known Limitations
- Password protection is only supported with the 7zip adapter. Standard zip and tar adapters ignore the password parameter.
extractMembers()is not supported for the 7zip adapter (useextract()instead)..zipis ambiguous: by default,open('file.zip')may resolve to standard zip strategy. If you need 7zip-specific behavior (including password flow), pass type explicitly:open('file.zip', '7zip', 'your_password').
Documentation
Documentation in English and Russian is available in the wiki.
License
This project is licensed under the MIT license.
victor78/zippy-ext 适用场景与选型建议
victor78/zippy-ext 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 34.92k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2018 年 03 月 30 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「zip」 「archive」 「archiver」 「zippy」 「7zip」 「7-zip」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 victor78/zippy-ext 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 victor78/zippy-ext 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 victor78/zippy-ext 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Allow packages to be installed from a repository or tarball bundle that have multiple packages in the sub-folders
Iteration tools for PHP
Class for working with archives RAR.
DbArchiver archive and restore old data from DB to file by Yii2 ActiveRecord models. For big tables allow direct file export from MySQL database(fast archiving, but file save only on MySQL server drive)
Convert and operate with FIPS codes for states, counties, etc.
A trait to make an Eloquent model archivable
统计信息
- 总下载量: 34.92k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 36
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-03-30