{"id":20174783,"url":"https://github.com/gemorroj/archive7z","last_synced_at":"2025-04-08T12:12:13.150Z","repository":{"id":4510884,"uuid":"5650558","full_name":"Gemorroj/Archive7z","owner":"Gemorroj","description":"This library provides handling of 7z files in PHP","archived":false,"fork":false,"pushed_at":"2025-03-03T18:10:00.000Z","size":4467,"stargazers_count":92,"open_issues_count":9,"forks_count":19,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-01T11:06:19.602Z","etag":null,"topics":["7-zip","7z","7zip","archive","archiver","p7zip"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Gemorroj.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2012-09-02T18:16:45.000Z","updated_at":"2025-03-21T22:06:48.000Z","dependencies_parsed_at":"2023-12-22T15:28:27.317Z","dependency_job_id":"dac09040-1d54-4333-8b31-a5ff8fda8630","html_url":"https://github.com/Gemorroj/Archive7z","commit_stats":{"total_commits":195,"total_committers":8,"mean_commits":24.375,"dds":"0.45641025641025645","last_synced_commit":"5743569154a618403457e138c806860eb2109798"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gemorroj%2FArchive7z","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gemorroj%2FArchive7z/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gemorroj%2FArchive7z/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gemorroj%2FArchive7z/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Gemorroj","download_url":"https://codeload.github.com/Gemorroj/Archive7z/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247838446,"owners_count":21004580,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["7-zip","7z","7zip","archive","archiver","p7zip"],"created_at":"2024-11-14T01:43:42.268Z","updated_at":"2025-04-08T12:12:13.128Z","avatar_url":"https://github.com/Gemorroj.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Wrapper 7-zip (p7zip)\n\n[![License](https://poser.pugx.org/gemorroj/archive7z/license)](https://packagist.org/packages/gemorroj/archive7z)\n[![Latest Stable Version](https://poser.pugx.org/gemorroj/archive7z/v/stable)](https://packagist.org/packages/gemorroj/archive7z)\n[![Continuous Integration](https://github.com/Gemorroj/Archive7z/workflows/Continuous%20Integration/badge.svg)](https://github.com/Gemorroj/Archive7z/actions?query=workflow%3A%22Continuous+Integration%22)\n\n\n### Features:\n\n- Supported all 7-zip formats:\n    - Packing / unpacking: `7z`, `XZ`, `BZIP2`, `GZIP`, `TAR`, `ZIP` and `WIM`.\n    - Unpacking only: `APFS`, `AR`, `ARJ`, `Base64`, `CAB`, `CHM`, `CPIO`, `CramFS`, `DMG`, `EXT`, `FAT`, `GPT`, `HFS`, `IHEX`, `ISO`, `LZH`, `LZMA`, `MBR`, `MSI`, `NSIS`, `NTFS`, `QCOW2`, `RAR`, `RPM`, `SquashFS`, `UDF`, `UEFI`, `VDI`, `VHD`, `VHDX`, `VMDK`, `XAR` and `Z`.\n- List files and directories\n- Get contents of any file from archive\n- Delete files or directories\n- Add files or directories\n\n\n### Requirements:\n\n- PHP \u003e= 8.0.2\n- allow [proc_open](https://www.php.net/proc_open) function\n- for Windows: 7-zip \u003e= 7.30 (https://www.7-zip.org/)\n- for Linux/MacOs: 7-zip \u003e= 21.01 or p7zip \u003e= 9.38 (https://github.com/p7zip-project/p7zip)\n\n\n### Installation:\n```bash\ncomposer require gemorroj/archive7z\n```\n\n\n### Notes:\n- https://sourceforge.net/p/p7zip/discussion/383043/thread/fa143cf2/\n- Correctly works only with filenames in UTF-8 encoding [#15](https://github.com/Gemorroj/Archive7z/issues/15).\n\n\n### Recommendations:\nArchive7z focuses on wrapping up the original 7-zip features.\nBut it is not always convenient to use in your application.\nTherefore, we recommend that you always create your own wrapper class over Archive7z with the addition of higher-level logic.\n\n\n### Example:\n\n```php\n\u003c?php\nuse Archive7z\\Archive7z;\n\nclass MyArchive7z extends Archive7z\n{\n    protected $timeout = 120;\n    protected $compressionLevel = 6;\n    protected $overwriteMode = self::OVERWRITE_MODE_S;\n    protected $outputDirectory = '/path/to/custom/output/directory';\n}\n\n$obj = new MyArchive7z('path_to_7z_file.7z');\n\nif (!$obj-\u003eisValid()) {\n    throw new \\RuntimeException('Incorrect archive');\n}\n\nprint_r($obj-\u003egetInfo());\n/*\nArchive7z\\Info Object\n(\n    [path:Archive7z\\Info:private] =\u003e /full_path_to/test.7z\n    [type:Archive7z\\Info:private] =\u003e 7z\n    [physicalSize:Archive7z\\Info:private] =\u003e 165343\n    [headersSize:Archive7z\\Info:private] =\u003e 241\n    [method:Archive7z\\Info:private] =\u003e LZMA2:192k\n    [solid:Archive7z\\Info:private] =\u003e +\n    [blocks:Archive7z\\Info:private] =\u003e 1\n    [codePage:Archive7z\\Info:private] =\u003e \n)\n*/\n\n\n// $obj-\u003esetPassword('123');\n\n// $obj-\u003egetEntries('test', 100)\nforeach ($obj-\u003egetEntries() as $entry) {\n        print_r($entry);\n/*\nArchive7z\\Entry Object\n(\n    [path:Archive7z\\Entry:private] =\u003e 1.jpg\n    [size:Archive7z\\Entry:private] =\u003e 91216\n    [packedSize:Archive7z\\Entry:private] =\u003e 165344\n    [modified:Archive7z\\Entry:private] =\u003e 2013-06-10 09:56:07\n    [created:Archive7z\\Entry:private] =\u003e \n    [attributes:Archive7z\\Entry:private] =\u003e A\n    [crc:Archive7z\\Entry:private] =\u003e 871345C2\n    [encrypted:Archive7z\\Entry:private] =\u003e +\n    [method:Archive7z\\Entry:private] =\u003e LZMA:192k 7zAES:19\n    [block:Archive7z\\Entry:private] =\u003e 0\n    [comment:Archive7z\\Entry:private] =\u003e \n    [hostOs:Archive7z\\Entry:private] =\u003e \n    [characteristics:Archive7z\\Entry:private] =\u003e \n    [folder:Archive7z\\Entry:private] =\u003e \n    [archive:Archive7z\\Entry:private] =\u003e MyArchive7z Object\n        (\n            [timeout:protected] =\u003e 60\n            [compressionLevel:protected] =\u003e 6\n            [overwriteMode:protected] =\u003e -aos\n            [outputDirectory:protected] =\u003e /path/to/custom/output/directory\n            [binary7z:Archive7z\\Archive7z:private] =\u003e C:\\Program Files\\7-Zip\\7z.exe\n            [filename:Archive7z\\Archive7z:private] =\u003e s:\\VCS\\Git\\Archive7z\\tests/fixtures/testPasswd.7z\n            [password:Archive7z\\Archive7z:private] =\u003e 123\n            [encryptFilenames:protected] =\u003e \n        )\n)\n*/\n\n    if ($entry-\u003egetPath() === 'test/test.txt') {\n        $entry-\u003eextractTo('path_to_extract_folder/'); // extract the file\n    }\n}\n\necho $obj-\u003egetContent('test/test.txt'); // show content of the file\n$obj-\u003esetOutputDirectory('path_to_extract_folder/')-\u003eextract(); // extract the archive\n$obj-\u003esetOutputDirectory('path_to_extract_pass_folder/')-\u003esetPassword('pass')-\u003eextractEntry('test/test.txt'); // extract the password-protected entry\n\n$solidMode = new SolidMode();\n$solidMode-\u003esetMode(SolidMode::OFF);\n$obj-\u003esetSolidMode($solidMode);\n$obj-\u003eaddEntry(__DIR__);  // add directory to the archive (include subfolders)\n$obj-\u003eaddEntry(__FILE__); // add file to the archive\n\n$obj-\u003erenameEntry(__FILE__, __FILE__.'new'); // rename the file in the archive\n$obj-\u003edelEntry(__FILE__.'new'); // remove the file from the archive\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgemorroj%2Farchive7z","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgemorroj%2Farchive7z","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgemorroj%2Farchive7z/lists"}