PHP Classes

dUnzip2: Pack and unpack files packed in ZIP archives

Recommend this page to a friend!
  Info   View files Example   Screenshots Screenshots   View files View files (4)   DownloadInstall with Composer Download .zip   Reputation   Support forum (24)   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStarStar 72%Total: 13,906 All time: 75 This week: 89Down
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: 332 Down23 in Brazil Brazil Down
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  
  • dUnzip2.gif
  Files folder image Files  
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

 Version Control Unique User Downloads Download Rankings  
 0%
Total:13,906
This week:0
All time:75
This week:89Down
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:182
 
nice package
7 years ago (Ashok kumar kashyap)
80%StarStarStarStarStar
This is a good, basic, generally robust unzipper.
13 years ago (Rich Parker)
75%StarStarStarStar
Excellent class.
14 years ago (Gonzalo ALFAMDQ)
80%StarStarStarStarStar
Thank you.
14 years ago (ngocthai)
70%StarStarStarStar
The better script that I found, good comments and a really us...
14 years ago (Geferson de Moraes)
77%StarStarStarStar
Very good
15 years ago (monzinho)
80%StarStarStarStarStar
Hello! In dUnzip2.
15 years ago (Willian Pedroso Neves)
80%StarStarStarStarStar
Great class
15 years ago (Michael Clarke)
80%StarStarStarStarStar
It was very easy to make it work for the first time.
16 years ago (Prado)
75%StarStarStarStar