Download the PHP package esplora/decompresso without Composer
On this page you can find all versions of the php package esplora/decompresso. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download esplora/decompresso
More information about esplora/decompresso
Files in esplora/decompresso
Package decompresso
Short Description PHP library for extracting contents from various archive formats with ease.
License MIT
Informations about the package decompresso
Decompresso
Decompresso is a library designed for extracting contents from various archive formats, providing flexibility and ease of use, including support for password-protected archives.
Features
- Password-Protected Archives: Handle encrypted archives with various methods for supplying passwords.
- Flexible Handler System: Easily add and configure handlers for different archive formats.
- Intuitive Interface: Utilize a fluent API for convenient configuration and handling of successful or failed extraction events.
Installation
Install the library using Composer:
Usage
To get started, create an instance of the Extractor
class and add the necessary handlers for archive formats. The
example below demonstrates using ZipArchiveAdapter
for ZIP files, but you can add your own handlers or use built-in
ones.
Handling Password-Protected Archives
To work with password-protected archives, add a password provider. The example below uses ArrayPasswordProvider
, which
accepts an array of passwords.
If needed, you can create your own password provider by implementing the PasswordProviderInterface
. For example,
a DataBasePasswordProvider
could be created for fetching passwords from a database with caching.
If you don’t have a password database but want to try all possible combinations, you can use SecLists as a source of popular passwords for brute-forcing.
Event Handling
For more control over the extraction process, you can add event handlers. This allows you to receive information about the reasons for extraction failures or respond to successful completions.
TODO
- [x] Добавить файл ответа, который бы разделял "не смогли распоковать" из-за ошибки и "не смогли распоковать так как не подошёл пароль"
- [ ] Добавить обработчик для RAR-архивов
- [ ] Добавить обработчик для 7z-архивов
- [x] Добавить проверку целостности в тестах
- [x] Ввести проверку на расширение файла для обработчика, что бы он пропускал файлы не поддерживаемых форматов
- [ ] Подумать над тем, чо бы передавать сразу MIME-type в обработчик, а не создавать его каждый раз. - Нет. Будет нарушение ответственности.
- [x] Не обращаться к провайдеру паролей, если он не нужен.
- [ ] Нужно обновить комментарии! Про пароль тоже!
License
The MIT License (MIT). Please see License File for more information.