PHPackages                             josegonzalez/cakephp-gzip - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. josegonzalez/cakephp-gzip

AbandonedArchivedCakephp-plugin

josegonzalez/cakephp-gzip
=========================

cakephp component plugin that auto-gzips html output

148.4k3PHP

Since Nov 29Pushed 10y ago1 watchersCompare

[ Source](https://github.com/josegonzalez/cakephp-gzip)[ Packagist](https://packagist.org/packages/josegonzalez/cakephp-gzip)[ RSS](/packages/josegonzalez-cakephp-gzip/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (2)DependenciesVersions (1)Used By (0)

[![Build Status](https://camo.githubusercontent.com/f1a1ee35fe0a4cc5dd18a4e8c299712391f2c6e862d539a399e5ba2fa978dd8a/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6a6f7365676f6e7a616c657a2f63616b657068702d677a69702f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/josegonzalez/cakephp-gzip)[![Coverage Status](https://camo.githubusercontent.com/fdeda8157f3229563ac8c0c65cf2022a3d14610dd85e77def70a091626b9c6f1/68747470733a2f2f696d672e736869656c64732e696f2f636f766572616c6c732f6a6f7365676f6e7a616c657a2f63616b657068702d677a69702e7376673f7374796c653d666c61742d737175617265)](https://coveralls.io/r/josegonzalez/cakephp-gzip?branch=master)[![Total Downloads](https://camo.githubusercontent.com/681bdab7cdb630e25e763c99af9d55c07306c8009296d27c9270fe0d0b7ce92e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6a6f7365676f6e7a616c657a2f63616b657068702d677a69702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/josegonzalez/cakephp-gzip)[![Latest Stable Version](https://camo.githubusercontent.com/92773e22e06bd554d02598a75b77a0c33d02dd3d6056092aaad6c230e922f974/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6a6f7365676f6e7a616c657a2f63616b657068702d677a69702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/josegonzalez/cakephp-gzip)[![Documentation Status](https://camo.githubusercontent.com/c8e4097b112b8c3cffdef1f554acd03a40a845b0bea1595674a860d47e831afd/68747470733a2f2f72656164746865646f63732e6f72672f70726f6a656374732f63616b657068702d677a69702f62616467652f3f76657273696f6e3d6c6174657374267374796c653d666c61742d737175617265)](https://readthedocs.org/projects/cakephp-gzip/?badge=latest)[![Gratipay](https://camo.githubusercontent.com/40a48c7b3fc02e9d39dd715fe09e404c4cb2e89288c6ace0773d2aab6913b46f/68747470733a2f2f696d672e736869656c64732e696f2f67726174697061792f6a6f7365676f6e7a616c657a2e7376673f7374796c653d666c61742d737175617265)](https://gratipay.com/~josegonzalez/)

Gzip Component
==============

[](#gzip-component)

Easily Gzip your production application's HTML output with the Gzip Component Plugin

Background
----------

[](#background)

I was attempting to optimize some small sites according to what YSlow said was inefficient, and saw some code at [debuggable.com](http://debuggable.com/posts/issues-with-output-buffering-in-cakephp:480f4dd5-b4fc-42a7-a5ab-4544cbdd56cb) that mentioned gzipping html output. So I wrapped that into a method in the AppController and used it in Production.

Not happy with copy-pasting that one method each and every time, I refactored it into a Component (woo-hoo CakePHP Components!), which I've just now refactored as a plugin. Thats a lot of refactoring.

This plugin only works on HTML, so YMMV.

Installation
------------

[](#installation)

*\[Using [Composer](http://getcomposer.org/)\]*

Add the plugin to your project's `composer.json` - something like this:

```
{
    "require": {
        "josegonzalez/cakephp-gzip": "dev-master"
    }
}

```

Because this plugin has the type `cakephp-plugin` set in it's own `composer.json`, composer knows to install it inside your `/Plugins` directory, rather than in the usual vendors file. It is recommended that you add `/Plugins/Upload` to your .gitignore file. (Why? [read this](http://getcomposer.org/doc/faqs/should-i-commit-the-dependencies-in-my-vendor-directory.md).)

*\[Manual\]*

- Download this:
- Unzip that download.
- Copy the resulting folder to `app/Plugin`
- Rename the folder you just copied to `Gzip`

*\[GIT Submodule\]*

In your app directory type:

```
git submodule add git://github.com/josegonzalez/cakephp-gzip.git Plugin/Gzip
git submodule init
git submodule update

```

*\[GIT Clone\]*

In your plugin directory type

```
git clone git://github.com/josegonzalez/cakephp-gzip.git Gzip

```

### Enable plugin

[](#enable-plugin)

In 2.0 you need to enable the plugin your `app/Config/bootstrap.php` file:

```
	CakePlugin::load('Gzip');

```

If you are already using `CakePlugin::loadAll();`, then this is not necessary.

Usage
-----

[](#usage)

Include the component in your controller (AppController or otherwise):

```
