mitmelon/compress
Composer 安装命令:
composer require mitmelon/compress
包简介
Advanced file compresser which reduces and encrypt large files to smaller chunks by saving them as binary for later use.
关键字:
README 文档
README
Compress
Advanced file compresser which reduces and encrypts large files to smaller chunks by saving them as binary for later use. Many applications supports file uploads which consumes large memory sizes on their systems. This library has been designed to reduce both zip, rar, images, pdf, words sizes or any kinds of files or documents into smaller size.
Install:
Use composer to install
composer require mitmelon/compress
Usage :
require_once __DIR__."/vendor/autoload.php"; // Initialize library class $compress = new Compress\Compress();
Compress File Only
/** * @param String $filePath * File location to be compressed * @param String $storePath * Path to output compressed binary file to * @param Mixed $options ["removeMeta" => false, "encrypt" => false, "key" => "password", "scanFile" => ["token" => $token, "service" => $service, "csp" => $csp, "region" => $region]] * Options to remove meta, encrypt file and scan content for reputations */ $compress::compressFile($filePath, $storePath, $options = []); //Compress Image file $compress::compressFile(__DIR__.'/image.png', __DIR__.'/image.txt'); // Compress PDF $compress::compressFile(__DIR__.'/file.pdf', __DIR__.'/file.txt');
Scan File and Compress
Scan content to get informations such as file's disposition, ranging from malicious (malware, ransomware, trojan horses, spyware, adware) to known good content (operating system files, known third-party software packages) using Pangea's File Intel Service.
To use the Pangea's File Intel Service create an account and plug your credentials into the options below. Account creation is free.
$options = array("scanFile" => array("token" => "{File_Intel_API_Token}", "service" => 'file-intel', "csp" => 'aws', "region" => 'us')); $compress::compressFile(__DIR__.'/file.pdf', __DIR__.'/file.txt', $options);
Decompress File
/** * UnCompress Image file [Get original file back from stored binary] * @param String $storePath * Path containing binary file which was compressed * @param String $fileOutputPath * Path to output original file to * @param String $encrypt_key * If your file was encrypted then provide the key for decryption as third argument */ $compress::uncompressFile($storePath, $fileOutputPath, $encrypt_key = null); //Uncompress Image $compress::uncompressFile(__DIR__.'/image.txt', __DIR__.'/image.png'); // Uncompress PDF $compress::uncompressFile( __DIR__.'/file.txt', __DIR__.'/file.pdf')
Other Public Variables To Change
/** * Encryption block chunk size * * @param Int $block */ public int $block = 1024; /** * Compression and Uncompression chunk size * * @param Int $compress_chunk_size */ public int $compress_chunk_size = 100 * 1024 * 1024; // 100 MB /** * Encryption cipher * * @default aes-256-cbc */ public string $cipher = 'aes-256-cbc';
Changelog
All notable changes to this project will be documented here.
[3.0.0] - 2023-06-11
- 🌟 Added Pangea's File Intel Service to get file reputations and only allow secure content for compressing
- 🌟 Updated compressor, uncompressor and file handlers to handle large file without consuming huge memory
- 🌟 Fixed Bugs and updated the documentation page
[2.0.0] - 2022-03-12
- 🌟 Added AES 256 CBC Mode encryption
Future Update
- Store files on centralize and decentralize cloud providers
Support
If you love my project and wish to assist me to keep working on this project. Please follow this link https://flutterwave.com/donate/oq61dyrjk9xh to donate.
License
Released under the MIT license.
mitmelon/compress 适用场景与选型建议
mitmelon/compress 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 4.17k 次下载、GitHub Stars 达 18, 最近一次更新时间为 2020 年 08 月 22 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「file」 「compress」 「encryption」 「zip」 「archive」 「compress files」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 mitmelon/compress 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 mitmelon/compress 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 mitmelon/compress 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
CSS/Javascript Minificator, Compressor and Concatenator for TYPO3 - highly configurable frontend asset optimization for CSS/JS merging, minification and compression with optional body parsing, async/defer loading, inline output, data-ignore exclusions, SRI integrity validation/calculation, external
The file manager intended for using Laravel with CKEditor / TinyMCE / Colorbox
A simple PHP class to encrypt a string and decrypt an encrypted string
OriginPHP Html
A package for automatically encrypting and decrypting Eloquent attributes in Laravel 5.5+, based on configuration settings.
Encryption with AES-256 and HMAC-SHA256
统计信息
- 总下载量: 4.17k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 18
- 点击次数: 28
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-08-22