PHP Classes

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

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 188 All time: 8,617 This week: 488Up
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 <contact>
Classes: 52 packages by
Country: Pakistan Pakistan
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 (7)  
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

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:188
This week:0
All time:8,617
This week:488Up