定制 petrknap/xz-utils 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

petrknap/xz-utils

最新稳定版本:v1.1.0

Composer 安装命令:

composer require petrknap/xz-utils

包简介

XZ Utils (wrapper)

README 文档

README

User-friendly wrapper for XZ Utils, providing simplified and streamlined access to powerful data compression and decompression tools. For ease of use, you can use the approach known from the compression extensions:

$encoded = xzencode(b'data') or throw new Exception();
$decoded = xzdecode($encoded) or throw new Exception();

printf('`%s` was decoded from encoded base64(`%s`)', $decoded, base64_encode($encoded));

Object-based approach

All functionality is available object-wise through the classes Lzma and Xz.

$xz = new PetrKnap\XzUtils\Xz();
$compressed = $xz->compress(b'data');
$decompressed = $xz->decompress($compressed);

printf('`%s` was decompressed from compressed base64(`%s`)', $decompressed, base64_encode($compressed));

Filter-based approach

For more complex use cases, a filter-based approach is also possible.

use PetrKnap\ExternalFilter\Filter;
use PetrKnap\XzUtils\FilterFactory;

$file = fopen('README.md', 'r');
$xzFile = tmpfile();

# compress file to file
FilterFactory::xz()->compress()->filter(input: $file, output: $xzFile);

fclose($file);
rewind($xzFile);

# decompress file, filter headline and print it
print FilterFactory::xz()->decompress()->pipe(new Filter('head', ['-n', '1']))->filter($xzFile);

fclose($xzFile);

Run composer require petrknap/xz-utils to install it. You can support this project via donation. The project is licensed under the terms of the LGPL-3.0-or-later.

统计信息

  • 总下载量: 62
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 1
  • 推荐数: 1

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: LGPL-3.0-or-later
  • 更新时间: 2024-11-03

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固