Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

TutsPlus.com:
How to Zip and Unzip Files in PHP
Oct 24, 2018 @ 18:35:56

The TutsPlus.com site has a tutorial posted showing how to make use of the ZIP functionality in PHP to handle the compression and decompression of ZIP archives programatically.

Compressing files when transferring them over the internet has a lot of advantages. In most cases, the combined total size of all the files in the compressed format comes down by a nice margin. This means that you will save some of your bandwidth, and users will also get faster download speeds.

[...] One factor that can discourage you from compressing files or make the process very tiresome is the fact that you might be doing it manually. Luckily, PHP comes with a lot of extensions that deal specifically with file compression and extraction. You can use the functions available in these extensions to automatically compress files in PHP.

This tutorial will teach you how to zip and unzip (compress and extract) files to and from a zip archive in PHP. You will also learn how to delete or rename files in an archive without extracting them first.

The tutorial starts with the compression of files making use of the ZipArchive class to create a new instance, add files to compress and close it out to write the resulting archive. Next it shows the reverse, using the same class to create an instance and extraction path. There's also an example of using a loop for even more control of which files are included in the archive.

tagged: tutorial zip unzip introduction ziparchive archive compress

Link: https://code.tutsplus.com/tutorials/file-compression-and-extraction-in-php--cms-31977

Remi Collet:
ZipArchive with encryption
Mar 03, 2017 @ 18:56:56

In this new post Remi Collet focuses on the use of the zip extension and using the ZipArchive functionality to create encrypted archives with PHP.

Point of the situation with the development of zip extension version 1.14.0 which implements support of encrypted archives.

This new feature implementation rely on libzip library new version 1.2.0. For now, only build using system library is supported for this new feature, but an update of the bundled library is planed. When everything will be validated, version will be released and merged in php sources (ext/zip), probably in PHP 7.2.

This development is in progress, nothing final, proposed methods still can change.

The tutorial shows how to get the package installed (via a clone of the GitHub repository) and how to work with encrypted archives, creating and reading their contents.

tagged: tutorial ziparchive zip extension encrypted

Link: https://blog.remirepo.net/post/2017/03/01/ZipArchive-with-encryption

Rob Allen:
Creating a zip file with PHP’s ZipArchive
Jan 15, 2014 @ 21:40:59

Rob Allen has a new post to his site today showing you how to create a ZIP file with the help of PHP's ZipArchive functionality. The latest versions would need to be installed as an extension (PECL) if they're not already there, but it makes creating the archives a lot simpler.

I recently had a requirement to create a zip file from a number of files created within my application. As it has been years since I last had this problem, I had a look around and discovered that PHP 5.2 has the ZipArchive class that makes this easy. ZipArchive is fully featured, but as I just wanted to create a simple zip file.

All it requires is a few short lines of code - one to open the archive itself, some to add in the files to compress down and another to close and create the file. It's a pretty simple process using this handy extension. Rob also included a bit of sample code showing how to send it out for download with the correct headers.

tagged: zip file archive create tutorial ziparchive

Link: http://akrabat.com/php/creating-a-zip-file-with-phps-ziparchive

Pierre-Alain Joye's Blog:
Zip-1.6.0, PHP 5.2.0 and ZipCode
Jul 28, 2006 @ 11:14:14

Pierre-Alain Joye has a new note on his blog today about the release of a new version of his Zip package and his efforts to get it included in the upcoming PHP 5.2.0.

I released zip-1.6.0 on wednesday. This release contains no bug fixes and no new feature. In the past weeks, many zip users asked me when I will bundle it in PHP. I cannot bundle extensions without asking the internals list. I steped in and ask to bundle it in 5.2.0, it was hard but finally sucessful.

For the inclusion, he's change the name of the archive to "ZipArchive" from just "Zip" in an effort to clarify what the package is for (archiving versus zip code related functionality).

tagged: zip archive package bundled php5.2.0 ziparchive zip archive package bundled php5.2.0 ziparchive

Link:

Pierre-Alain Joye's Blog:
Zip-1.6.0, PHP 5.2.0 and ZipCode
Jul 28, 2006 @ 11:14:14

Pierre-Alain Joye has a new note on his blog today about the release of a new version of his Zip package and his efforts to get it included in the upcoming PHP 5.2.0.

I released zip-1.6.0 on wednesday. This release contains no bug fixes and no new feature. In the past weeks, many zip users asked me when I will bundle it in PHP. I cannot bundle extensions without asking the internals list. I steped in and ask to bundle it in 5.2.0, it was hard but finally sucessful.

For the inclusion, he's change the name of the archive to "ZipArchive" from just "Zip" in an effort to clarify what the package is for (archiving versus zip code related functionality).

tagged: zip archive package bundled php5.2.0 ziparchive zip archive package bundled php5.2.0 ziparchive

Link:


Trending Topics: