PHP Classes

Zip File: Create and extract ZIP archives in purely in PHP

Recommend this page to a friend!
  Info   View files Example   View files View files (3)   DownloadInstall with Composer Download .zip   Reputation   Support forum (9)   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStar 46%Total: 9,653 This week: 1All time: 150 This week: 571Down
Version License PHP version Categories
zipfile 1.0GNU General Publi...4.0Files and Folders, Compression
Description 

Author

This class can be used to create and extract ZIP archives.

It can add and list files and directories in a ZIP archive.

The class uses pure PHP code, so it does not use the PHP ZIP extension.

Picture of Joshua Townsend
Name: Joshua Townsend <contact>
Classes: 3 packages by
Country: United States United States
Age: 32
All time rank: 21825 in United States United States
Week rank: 420 Down49 in United States United States Down

Recommendations

How to select files using file date and compress files as zip?
Select files by date and compress files as zip

ZipArchive not found exception, Class not found exception
ZipArchive how to resolve this

Convert the folder to ZIP
convert the folder to ".zip" format in php

Example

<?php
require "zip.class.php"; // Get the zipfile class
$zipfile = new zipfile; // Create an object
$zipfile->read_zip("myzip.zip"); // Read the zip file

// Now, $zipfile->files is an array containing information about the files
// Here is an example of it's use

foreach($zipfile->files as $filea)
{
    echo
"The contents of {$filea['name']}:\n{$file['data']}\n\n";
}
?>


  Files folder image Files  
File Role Description
Accessible without login Plain text file example1.php Example Example of using class to zip a file.
Accessible without login Plain text file example2.php Example Example of using class to read a zip file
Plain text file zip.class.php Class The main zipfile class

 Version Control Unique User Downloads Download Rankings  
 0%
Total:9,653
This week:1
All time:150
This week:571Down
User Ratings User Comments (2)
 All time
Utility:66%StarStarStarStar
Consistency:69%StarStarStarStar
Documentation:-
Examples:61%StarStarStarStar
Tests:-
Videos:-
Overall:46%StarStarStar
Rank:3152