7z Archiver Command Wrapper

0.1.1 2022-06-17 09:17 UTC

This package is auto-updated.

Last update: 2024-04-24 15:03:38 UTC



7z command supports several type of archive.


sudo apt install p7zip-full

rar will be installed as non-free

sudo apt install p7zip-rar # debian non-free


Access with file name.

$a7z = new Archive7zReader("sample.zip");
foreach( $a7z->files() as $name) {
    $bin = $a7z->conent($name);

Access with index.

$a7z = new Archive7zReader("sample.zip");
$bin = $a7z->at(0);


currently, this project aimed at READING archive. write/append not yet.

character encodings.(reading archive)

7z command will encode filenames by shell ENV[LANG]. So we should take care of encoding using shell env LANG='XXX' and php mb_string.

cp932(jp/windows/filename) example. #01 using utf8

$a = new Archive7zReader($f);
$file_name = $a->files()[1];
$file_name =   $name = mb_convert_encoding($file_name,"UTF8","UTF8,CP932");

cp932(jp/windows/filename) example. #02 using cp932

$a = new Archive7zReader($f);
$file_name = $a->files()[1];
$file_name =   $name = mb_convert_encoding($file_name,"UTF8","CP932");

Installation from github

composer config repositories.takuya/php-7z-cmd-wrapper vcs $repo
composer require takuya/php-7z-cmd-wrapper

Installation from packagist

composre require takuya/php-7z-cmd-wrapper