Support:

Skip special feature

Where's Simon?

Language selection:

English Deutsch

PHP Code Compressor

1. Preface

If you design a webapplication that has to meet the requirements of high performance and availability, you will always come to the point where compression of your website's sourcecode is required and neccessary. This PHP-class is meant to help you with this concern by providing the needed functionalities. They will shrink down your sources to keep the overall filesize compact, the traffic prizes low and transfer latencies short.

2. System requirements

In order to use this PHP-class, your server needs to run PHP at least in version 5.

PHP installations below version 5 won't be able to utilize this class as the PHP 5 object model is used which is not supported in earlier versions. There are no plans to establish downwards compatibility with PHP 4.x servers as the support for PHP 4 has been discontinued since December 2007.

3. License

This class is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This class is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

4. Download

All information and sourcecode related to this project can be found at the regarding projectpage at Sourceforge.net.

Please download the latest release and extract all the zipfile contents into the regarding directory of your webapplication on your webserver.

5. Installation

The first step to use the Code Compressor class in your PHP-application is to include the classfile itself (dependant on your installation, you probably will have to adjust the contained filepath):

require_once('codecompressor.class.php');

6. Functionalities

Now you are ready to compress your HTML-sources. This can be done by calling the static method compressHtml():

CodeCompressor::compressHtml($htmlSourceCode,true);

This function expects two parameters. The first one is the string formatted sourcecode itself, the second one determines whether you want to remove HTML comments, too. If set to false, the returned (compressed) sourcecode still contains your comments.

Note: This method is uncritical to all contained code, including JavaScript and CSS.

11. Changes and updates

Changes that are applied to this software are documented in the file changelog.txt that is included within within the directory "/docs" of the provided zip-archive.

New versions of this class will always be available on the regarding projectpage at Sourceforge.net. This platform will also provide you with news about ongoing work and future releases.

Please feel free to contact me for feature requests or in case of emerging errors or bugs.



copyright © 2002-2010 by Simon Wippich, all rights reserved.

Back to the top of this page