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

Wojciech Sznapka's Blog:
Power of PHP streams – decompress gz archives on the fly from remote server
Nov 24, 2010 @ 14:39:05

Wojciech Sznapka has a new post to his blog today looking at the "power of PHP streams" and how they can be used to decompress gzipped data from remote servers.

Probably most of us heard about streams in PHP. They are background of all files and network operations in PHP, even if we don’t see it. Everytime when you use file_get_contents or fopen you are actually using streams. But there are many stream wrappers I haven’t used, because they aren’t well known.One of them is compress.zlib (and two other compression stream filters).

He includes a quick example (because, thankfully, that's all working with streams like this usually requires) about pulling in a file from his server and uses the stream to fetch and unzip the data to display the contents.

tagged: streams tutorial gzip decompress archive

Link:

Thomas Weidner's Blog:
Compression and Decompression for ZF
Sep 23, 2009 @ 15:26:40

As Thomas Weidner mentions in a new blog post, starting with the 1.10 release of the Zend Framework there'll be a new component to help with compressing and decompressing files - Zend_Filter_Compress/Decompress.

The new components Zend_Filter_Compress and Zend_Filter_Decompress provide a unified API for several compression formats. Actually the formats BZ2, GZ, LZF, RAR, TAR and ZIP are implemented: You can not only work with Strings, but also with Files and also with complete Directories.

He includes a quick example of how it will work with both data (like a string) and writing out the information to a compressed file. You can find out more about the component from Thomas' proposal on the Zend Framework wiki.

tagged: zendframework compress decompress

Link:

Zend Developer Zone:
Dynamically Creating Compressed Zip Archives With PHP
Jun 05, 2007 @ 16:54:00

The Zend Developer Zone has a new tutorial that focuses on the dynamic creation of zip archives in a PHP application.

PHP too has included support for the ZIP format since PHP 4.x but it was only recently when, idly browsing the PHP manual, I realized that PHP 5.2.0 includes a re-engineered version of the ext/zip extension, one based on the zlib library. Bored and not a little intrigued, I decided to try it out. And over the next few pages, I'm going to tell you what I found.

The tutorial does require that you have the zip extension installed before getting started. He starts with the basics (reading and opening a zip file) but quickly moves on to creating and decompressing them. All of the code needed is included of course, so you'll be up and working with your own zip files in no time.

tagged: zip archive extension tutorial extract compress decompress zip archive extension tutorial extract compress decompress

Link:

Zend Developer Zone:
Dynamically Creating Compressed Zip Archives With PHP
Jun 05, 2007 @ 16:54:00

The Zend Developer Zone has a new tutorial that focuses on the dynamic creation of zip archives in a PHP application.

PHP too has included support for the ZIP format since PHP 4.x but it was only recently when, idly browsing the PHP manual, I realized that PHP 5.2.0 includes a re-engineered version of the ext/zip extension, one based on the zlib library. Bored and not a little intrigued, I decided to try it out. And over the next few pages, I'm going to tell you what I found.

The tutorial does require that you have the zip extension installed before getting started. He starts with the basics (reading and opening a zip file) but quickly moves on to creating and decompressing them. All of the code needed is included of course, so you'll be up and working with your own zip files in no time.

tagged: zip archive extension tutorial extract compress decompress zip archive extension tutorial extract compress decompress

Link:


Trending Topics: