1. Products
  2.   Compression
  3.   PHP
  4.   PhpZip
 
  

Open Source PHP Library for Working with ZIP-Archives

Create, Update, Delete & Extract Compression File Formats like ZIP or BZIP2 and Password Protected Archives via PHP API.

PhpZip is an open source PHP library that provides functionality for working with ZIP-archives. The API generates the Zip file in memory (or temp file) and allows users to save the final Zip file to the user's suggested location. It gives you the power to get information about each entry in the archive. It also supports archival comments as well as individual entry comments.

The API supports several important features, such as creating and modifying ZIP-archives, opening and unzipping zip files, appending to existing ZIP, WinZip AES encryption files, BZIP2 compression, external file attributes, and ZIP64 extensions, saving the archive to a file & more.

Previous Next

Getting Started with PhpZip

First of all, you need to have PHP 5.5 and above to run the library smoothly. The easiest way to install is to have the Composer installed on your computer. Once the composer is installed you need to add this requirement to your composer.json file.

Here is the command

 "phpzip/phpzip": ">=2.0.7"  

Add Entries to the Archive via PHP Library

Software programmers can easily add files to a ZIP archive using PhpZip library inside their own PHP apps. To add a file you need to specify the name of the entry in the archive as well as provide a path. The API also provides the facility to add an entry from the stream to the ZIP archive. It also provides support for adding a new directory.

Delete Entries form the ZIP-Archive

PhpZip library provides a feature for deleting entries from the ZIP archive. There are several options available for deleting the entries, such as deleting an entry in the archive using its name, deleting all entries in the ZIP archive, deleting entries using the glob pattern, and deleting entries using the PCRE pattern.

Working with Password Protected Archives

PhpZip library provides support for traditional deflate compression and BZIP2 compression with the extension php-bz2. PhpZip library requires PHP 5.5 & above to work with password-protected archives. It facilities developers to set a password for reading all or some entries in the archive, change the password for the archive, delete the archive password, Set a password or encryption method, and many other options.

 English