PHP Classes

PHP ZIP Handler Class: Create and extract ZIP files with compressed data

Recommend this page to a friend!
  Info   View files Example   View files View files (7)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 188 This week: 1All time: 8,613 This week: 560Up
Version License PHP version Categories
php-zip-handler-clas 1.0.1MIT/X Consortium ...5PHP 5, Files and Folders, Compression
Description 

Author

This package can create and extract ZIP files with compressed data.

It can take an array with a list of file names and creates a ZIP archive with a given name adding the file contents after being compressed. The class can update an existing ZIP archive as well replacing the listed files.

The class can also take a given ZIP archive to extract a given file from it. Optionally it may also delete the original ZIP archive file.

Picture of Muhammad Umer Farooq
Name: Muhammad Umer Farooq is available for providing paid consulting. Contact Muhammad Umer Farooq .
Classes: 52 packages by
Country: Pakistan Pakistan
Age: 22
All time rank: 84611 in Pakistan Pakistan
Week rank: 52 Up3 in Pakistan Pakistan Up
Innovation award
Innovation award
Nominee: 6x

Example

<?php


require_once 'classes/Zip.php';

$zip = new Zip();

/**
 * //Note if you want manipulate files in outside the root of server / script you may use my file manipulation class here is two possible link
 * Github: https://github.com/Lablnet/PHP-files-manipulation-class
 * Alternative: https://www.phpclasses.org/package/10621-PHP-Manipulate-files-and-directories-in-several-ways.html
 * please fork/rate these classes if you like thanks.
 */
//compress file
$comp = $zip->Compress(
[
'data/image/one.png', 'data/image/two.png'],
'data/compressed/images.zip', false
);
if (
$comp === true) {
    echo
'file successfully compressed ';
} else {
    echo
'already / something went wrong ';
}

//extract file
$ext = $zip->Extract(
   
'data/compressed/images.zip', 'data/extract/'
);
if (
$ext === true) {
    echo
' file extract successfully ';
} else {
    echo
' already / something went wrong ';
}


Details

PHP-zip-handler-class

This package can Handel zip/archives.

It can perform 1. Extract files from zip 2. Compressed files into zip


  Files folder image Files  
File Role Description
Files folder imageclasses (1 file)
Files folder imagedata (2 directories)
Accessible without login Plain text file example.php Example Example script
Accessible without login Plain text file readme.md Doc. Documentation

  Files folder image Files  /  classes  
File Role Description
  Plain text file Zip.php Class Class source

  Files folder image Files  /  data  
File Role Description
Files folder imageextract (1 directory)
Files folder imageimage (2 files)

  Files folder image Files  /  data  /  extract  
File Role Description
Files folder imagedata (1 directory)

  Files folder image Files  /  data  /  extract  /  data  
File Role Description
Files folder imageimage (2 files)

  Files folder image Files  /  data  /  extract  /  data  /  image  
File Role Description
  Accessible without login Image file one.png Data Auxiliary data
  Accessible without login Image file two.png Data Auxiliary data

  Files folder image Files  /  data  /  image  
File Role Description
  Accessible without login Image file one.png Data Auxiliary data
  Accessible without login Image file two.png Data Auxiliary data

 Version Control Unique User Downloads Download Rankings  
 100%
Total:188
This week:1
All time:8,613
This week:560Up