PHPackages                             sankalp\_sans/slim-goes-slimmer - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. sankalp\_sans/slim-goes-slimmer

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

sankalp\_sans/slim-goes-slimmer
===============================

Used to minimize the HTML output of Slim Framework in PHP

v0.4(2y ago)035.1kMITPHP &gt;=5.3

Since Nov 27Compare

[ Source](https://github.com/sankalpsans/slim-goes-slimmer)[ Packagist](https://packagist.org/packages/sankalp_sans/slim-goes-slimmer)[ Docs](https://github.com/sankalpsans/slim-goes-slimmer)[ RSS](/packages/sankalp-sans-slim-goes-slimmer/feed)WikiDiscussions Synced 4d ago

READMEChangelog (4)Dependencies (1)Versions (6)Used By (0)

slim-goes-slimmer
=================

[](#slim-goes-slimmer)

Released 2015.11.27, Updated 2024.03.18 (strip HTML comments)

HTML pages with embedded JS or complicated division hierarchy are written with indentation for readability and good developer experience. This causes websites' source codes to look like this:

```

            un

                Some content here

                Some other here

                Still another content here

      function someAwesomeFunction() {
        // This function does something
        for() {
          if() {
           // Some code here
          } else {
           // Some more code here
          }
        }
      }

```

I did a rough benchmarking of this on several popular media websites and found that we waste somewhere from 20 to 30% of the HTML bandwidth to indented HTML and JavaScript. So, I decided to solve this problem, and implement this for Slim framework first, because this the framework I'm currently working with.

So far, slim-goes-slimmer reduces the above piece of HTML to

```

Some content here

Some other here

Still another content here

function someAwesomeFunction() {
// This function does something
for() {
if() {
// Some code here
} else {
// Some more code here
}
}
}

```

... thus stripping whitespaces from the beginning of every line

Why I haven't "optimized" it further?
=====================================

[](#why-i-havent-optimized-it-further)

Mainly because I'm facing weird issues with base64-encoded images in HTML

Using
=====

[](#using)

- Just use `composer require sankalp_sans/slim-goes-slimmer` OR copy the file `SlimGoesSlimmer.php` to the relevant path and include it.
- Register this to the Slim app object using

```
$app = new \Slim\Slim(...));
$app->add(new \Slim\Middleware\SlimGoesSlimmer());

```

Inspiration
===========

[](#inspiration)

This project is inspired by a project I have contributed to  earlier. I intended to contribute to it further, but haven't sone so because slim-goes-slimmer is specifically addresses to my set of problems, and I will tweak this as and how I need it on my PHP projects.

Results so far
==============

[](#results-so-far)

Encouraging. I have been observing page sizes reduced by ~25% based on a sample of 100 pages, the list of which I will be publishing soon.

Contributing
============

[](#contributing)

Contributing is dumb simple. Fork, code, push and raise a pull request. I'll be happy if you could contribute test cases, as I usually am too lousy to code them.

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~1011 days

Total

4

Last Release

838d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/713909?v=4)[Sankalp](/maintainers/sankalpsans)[@sankalpsans](https://github.com/sankalpsans)

---

Tags

phphtmlminify

### Embed Badge

![Health badge](/badges/sankalp-sans-slim-goes-slimmer/health.svg)

```
[![Health](https://phpackages.com/badges/sankalp-sans-slim-goes-slimmer/health.svg)](https://phpackages.com/packages/sankalp-sans-slim-goes-slimmer)
```

###  Alternatives

[oat-sa/tao-core

TAO core extension

66143.7k124](/packages/oat-sa-tao-core)[christianklisch/slim-minify

Minify html output in slim framework

3832.0k1](/packages/christianklisch-slim-minify)[frosh/platform-html-minify

This plugin delivers minified HTML and minified inline JavaScript to visitors.

1179.8k](/packages/frosh-platform-html-minify)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
