Home arrow PHP arrow An Object-based Approach to HTTP Compression in PHP

An Object-based Approach to HTTP Compression in PHP

Welcome to the second tutorial of the series “Using HTTP compression in PHP.” In three parts, this series demonstrates how to apply HTTP compression to parsed PHP pages, in order to reduce their overall download times, which results in faster delivery of dynamic content.

TABLE OF CONTENTS:
  1. An Object-based Approach to HTTP Compression in PHP
  2. Object-based "Gzip" compression: creating a data compressor PHP class
  3. Setting up a concrete example: putting the "DataCompressor" class to work
  4. Explaining the example
By: Alejandro Gervasio
Rating: starstarstarstarstar / 6
April 17, 2006

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

Introduction

Over the first tutorial of this series, I developed some hands-on examples, aimed at illustrating how "Gzip" encoding can be used within PHP scripts to compress the output generated by dynamic PHP pages. After transferring the encoded data to the client, contents are uncompressed and finally displayed on the browser.

As you probably recall, the data encoding/decoding process that I just described  was performed by a combination of the PHP built-in "gzencode()" function and some output buffering functions. These became extremely handy for storing temporarily the dynamic output of parsed PHP files and applying "Gzip" encoding on the respective data. Indeed, output buffering control can be used as a simple mechanism for implementing different kinds of post-processing on parsed data, such as caching (X)HTML output, or compressing dynamic pages, to name a few popular applications.

Now that the data compression methods shown in the previous article are hopefully familiar concepts to you, it's time to move toward the implementation of HTTP compression within object-oriented PHP applications, particularly, for obvious reasons, on those whose output include some sort of (X)HTML rendering process.

By the end of this article, you should have the appropriate knowledge for building a simple data compressor class, in addition to using HTTP compression for reducing the download time of object-generated web pages. I'm sure the subject is quite interesting to you, so let's dive into the topic together.



 
 
>>> More PHP Articles          >>> More By Alejandro Gervasio
 

blog comments powered by Disqus
   

PHP ARTICLES

- PHP Closures as View Helpers: Lazy-Loading F...
- Using PHP Closures as View Helpers
- PHP File and Operating System Program Execut...
- PHP: Effects of Wrapping Code in Class Const...
- PHP: Building Concrete Validators
- Sanitizing Input with PHP
- Executing Shell Commands with PHP
- Handling File Data with PHP
- File Security and Resources with PHP
- ArrayObject PHP Class Examples
- ArrayObject PHP Class: An Introduction
- Getting File System Data with PHP
- PHP Tools for Working with the File and Oper...
- Working with the File and Operating System w...
- PHP Proxy Patterns: Completing a Blog


© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 11 - Follow our Sitemap

Dev Shed Tutorial Topics: