PHP Classes

dUnzip2: Pack and unpack files packed in ZIP archives

Recommend this page to a friend!
  Info   Example   Screenshots   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStarStar 72%Total: 13,911 All time: 75 This week: 65Up
Version License PHP version Categories
dunzip2 1.0.0BSD License3Files and Folders, Compression
Description 

Author

This package can be used to pack and unpack files in ZIP archives.

There is a class that can retrieve the list of packed files as well several types of file details, such as the uncompressed size, last modification time, comments, etc..

The class can extract individual files, one at a time, specifying their file names, or extract all at once into a given directory.

There is another class that can pack files into new ZIP archives.

The classes use the usual PHP file access functions and gzip extension functions.

Picture of Alexandre Tedeschi (d)
  Performance   Level  
Name: Alexandre Tedeschi (d) <contact>
Classes: 6 packages by
Country: Brazil Brazil
Age: 38
All time rank: 462 in Brazil Brazil
Week rank: 22 Up2 in Brazil Brazil Equal
Innovation award
Innovation award
Nominee: 1x

Recommendations

Extract files from zip file
I need to extract the files contained within a bespoke zip file

Example

<?
require_once dirname(__FILE__)."/dUnzip2.inc.php";
require_once
dirname(__FILE__)."/dZip.inc.php";

######## Create a ZIP file dinamically ########
# // Initialize dZip class
# echo "Initializing dZip class...<br>";
# $newzip = new dZip('dUnzip2.zip');

# // Create a folder in the ZIP, to store dZip and dUnzip files
# echo "Creating folder to store both classes<br>";
# $newzip->addDir('class dZip');
# $newzip->addDir('class dUnzip2');

# // Put the files
# echo "Adding files to the zip<br>";
# $newzip->addFile('dUnzip2.inc.php', 'class dUnzip2/dUnzip2.inc.php');
# $newzip->addFile('documentation.txt','class dUnzip2/documentation.txt');
# $newzip->addFile('dZip.inc.php', 'class dZip/dZip.inc.php');
# $newzip->addFile('sample.php', 'sample.php');

# // Save the new file
# echo "Finalizing the created file<br>";
# $newzip->save();

######## Then, load the file again. Now, to unzip it ########
echo "<hr>";
$zip = new dUnzip2('dUnzip2.zip');

// Activate debug
$zip->debug = true;

// Unzip all the contents of the zipped file to a new folder called "uncompressed"
$zip->getList();
$zip->unzipAll('uncompressed');

echo
"Checking attributes for dUnzip2.gif<br>";
$d = $zip->getExtraInfo('dUnzip2.gif');
echo (
$d['external_attributes1']&1 )?"File is read only.":"File is NOT read-only."; echo "<br>";
echo (
$d['external_attributes1']&2 )?"File is hidden.":"File is NOT hidden."; echo "<br>";
echo (
$d['external_attributes1']&4 )?"File is system.":"File is NOT system."; echo "<br>";
echo (
$d['external_attributes1']&16)?"It's directory.":"It's NOT a directory."; echo "<br>";
echo (
$d['external_attributes1']&32)?"File is archive":"File is NOT archive"; echo "<br>";

// No secrets, do you agree?


Screenshots (1)  
  • dUnzip2.gif
  Files folder image Files (5)  
File Role Description
Accessible without login Plain text file dUnzip2.inc.php Class The class itself. Well commented.
Plain text file documentation.txt Doc. Simple file explaining what you can do with the class
Plain text file dZip.inc.php Class class to dinamically zip files. support subdirs
Plain text file sample.php Example Example #1

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  
 0%
Total:13,911
This week:0
All time:75
This week:65Up
User Ratings User Comments (9)
 All time
Utility:94%StarStarStarStarStar
Consistency:86%StarStarStarStarStar
Documentation:82%StarStarStarStarStar
Examples:84%StarStarStarStarStar
Tests:-
Videos:-
Overall:72%StarStarStarStar
Rank:162
 
nice package
8 years ago (Ashok kumar kashyap)
80%StarStarStarStarStar
This is a good, basic, generally robust unzipper.
14 years ago (Rich Parker)
75%StarStarStarStar
Excellent class.
14 years ago (Gonzalo ALFAMDQ)
80%StarStarStarStarStar
Thank you.
15 years ago (ngocthai)
70%StarStarStarStar
The better script that I found, good comments and a really us...
15 years ago (Geferson de Moraes)
77%StarStarStarStar
Very good
15 years ago (monzinho)
80%StarStarStarStarStar
Hello! In dUnzip2.
16 years ago (Willian Pedroso Neves)
80%StarStarStarStarStar
Great class
16 years ago (Michael Clarke)
80%StarStarStarStarStar
It was very easy to make it work for the first time.
16 years ago (Prado)
75%StarStarStarStar