PHP API to Create & Extract ZIP, TAR, TBZ or TGZ Archives
Open Source PHP Library allows developers to Create, List, update, Extract, delete compression file formats Archives via PHP API.
Zippy is an open source PHP library that provides functionality for working popular archive formats like TAR, ZIP, TBZ2, TBZ, TGZ, and more. The Zippy library is simple to use and consists of a collection of adapters that helps in the most common compression and decompression operations like create, list update, extract, delete for a selected format. it aims for high speeds and reasonable compression.
The library supports several important compression related features, such as creating and updating ZIP-archives, open and list an archive's contents, appending files to an existing archive, BZIP2 compression support, customize file and directory names inside the archive, saving the archive to a file, extract an archive to a specific directory & more.
At A Glance
An overview of Zippy features.
- Generate ZIP-archives
- Edit ZIP-archives
- Extract archives
- Manage AR archive
- Manage TBZ2 archive
- Manage TBZ archive
- Manage TGZ archive
- Append File
- Extract zip
- Set password
Zippy supports popular compression file formats listed below.
PhpZip only requires PHP >= 5.5.
- PHP >= 5.5
Getting Started with PhpZip
First of all, you need to have PHP 5.5 and above to run the library smoothly. The only supported installation method is via Composer. Run the following command to require Zippy in your project.
Here is the command
composer require alchemy/zippy
Create a New Archive via PHP API
Software programmers can easily create a new ZIP archive using the Zippy library inside their own PHP applications. The library supports creating an archive.zip that contains a directory"folder" that can contain different kinds of files. To add a file you need to specify the name of the entry in the archive as well as provide a path. It also provides support for adding a new directory. You can add files to your zip archive one at a time or add the whole directory at once..
Extract an Archive to a Specific Directory
The open source Zippy library provides the capability to programmatically extract an archive to a specific directory using PHP. You can use it to either extract everything inside the archive or just some specific files. Please it is important to remember that it’s required to specify the proper path of the file inside the archive in order to extract it. During the extraction process, the directory and file structure is well-kept and it extracts all files to their respective directories.
Listing Archive's Contents
The open source Zippy library enables software developers to programmatically open and displays the contents of an archive via PHP commands. The library gives users full control and has provided methods and properties to get more information about the archive before extracting all its contents. You can count the number of files in an archive, iterate over all the files in the archive, extract only those files which are needed, and more.
Deleting Entries from a ZIP Archive
The open source Zippy library provides the capability to delete entries from the ZIP archive via PHP commands. There are several options available for deleting the entries, such as delete an entry in the archive using its name, deleting all entries in the ZIP archive, deleting entries using glob pattern and deleting entries using PCRE pattern.