PHPackages                             wikimedia/minify - 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. wikimedia/minify

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

wikimedia/minify
================

Minification of JavaScript code and CSS stylesheets.

2.10.0(4mo ago)6839.4k—4%110Apache-2.0PHPPHP &gt;=8.1

Since Feb 9Pushed 2mo ago17 watchersCompare

[ Source](https://github.com/wikimedia/mediawiki-libs-Minify)[ Packagist](https://packagist.org/packages/wikimedia/minify)[ Docs](https://gerrit.wikimedia.org/g/mediawiki/libs/Minify)[ RSS](/packages/wikimedia-minify/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (10)Versions (20)Used By (10)

wikimedia/minify
================

[](#wikimediaminify)

Minify is a PHP library for minification of JavaScript code and CSS stylesheets.

Quick start
-----------

[](#quick-start)

Install using [Composer](https://getcomposer.org/), from [Packagist.org](https://packagist.org/packages/wikimedia/minify):

```
composer require wikimedia/minify

```

Usage
-----

[](#usage)

```
use Wikimedia\Minify\JavaScriptMinifier;

$input = '
/**
 * @param a
 * @param b
 */
function sum(a, b) {
	// Add it up!
	return a + b;
}
';

$output = JavaScriptMinifier::minify( $input );
// Result:
// function sum(a,b){return a+b;}
```

```
use Wikimedia\Minify\CSSMin;

$input = '
.foo,
.bar {
	/* comment */
	prop: value;
}
';

$output = CSSMin::minify( $input );
// Result:
// .foo,.bar{prop:value}
```

Known limitations
-----------------

[](#known-limitations)

The following trade-offs were made for improved runtime performance and code simplicity. If they cause problems in real-world applications without trivial workarounds, please let us know!

- [T37492](https://phabricator.wikimedia.org/T37492): In CSS, content within quoted strings that looks like source code are sometimes minified.
- [T287631](https://phabricator.wikimedia.org/T287631): In CSS, writing a URL over multiple lines with escaped line-breaks is not supported.

Contribute
----------

[](#contribute)

- Issue tracker:
- Source code:
- Submit patches via Gerrit: [https://www.mediawiki.org/wiki/Developer\_account](https://www.mediawiki.org/wiki/Developer_account)
- To run tests: `composer update`, then `composer test`

See also
--------

[](#see-also)

- High-level documentation:

###  Health Score

60

—

FairBetter than 99% of packages

Maintenance82

Actively maintained with recent releases

Popularity43

Moderate usage in the ecosystem

Community35

Small or concentrated contributor base

Maturity70

Established project with proven stability

 Bus Factor3

3 contributors hold 50%+ of commits

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 ~99 days

Recently: every ~195 days

Total

19

Last Release

131d ago

PHP version history (3 changes)2.0.0PHP &gt;=7.2.9

2.8.0PHP &gt;=7.4.3

2.10.0PHP &gt;=8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/716c86d71cbf921e7912a505f89d799de398fc0a3af0bd4c8862834b2d642bd7?d=identicon)[wikimedia](/maintainers/wikimedia)

![](https://www.gravatar.com/avatar/a91173408bf645b6ff78a309a9e55bde405d29c72e2b1ae8ec9f9df1225f76c3?d=identicon)[Krinkle](/maintainers/Krinkle)

---

Top Contributors

[![Krinkle](https://avatars.githubusercontent.com/u/156867?v=4)](https://github.com/Krinkle "Krinkle (84 commits)")[![catrope](https://avatars.githubusercontent.com/u/260792?v=4)](https://github.com/catrope "catrope (36 commits)")[![reedy](https://avatars.githubusercontent.com/u/67615?v=4)](https://github.com/reedy "reedy (19 commits)")[![MatmaRex](https://avatars.githubusercontent.com/u/160413?v=4)](https://github.com/MatmaRex "MatmaRex (18 commits)")[![jdforrester](https://avatars.githubusercontent.com/u/881572?v=4)](https://github.com/jdforrester "jdforrester (15 commits)")[![trevorparscal](https://avatars.githubusercontent.com/u/108389?v=4)](https://github.com/trevorparscal "trevorparscal (13 commits)")[![umherirrender](https://avatars.githubusercontent.com/u/1174884?v=4)](https://github.com/umherirrender "umherirrender (12 commits)")[![atdt](https://avatars.githubusercontent.com/u/376462?v=4)](https://github.com/atdt "atdt (11 commits)")[![anny21](https://avatars.githubusercontent.com/u/34449508?v=4)](https://github.com/anny21 "anny21 (10 commits)")[![tstarling](https://avatars.githubusercontent.com/u/389141?v=4)](https://github.com/tstarling "tstarling (7 commits)")[![thiemowmde](https://avatars.githubusercontent.com/u/6576639?v=4)](https://github.com/thiemowmde "thiemowmde (6 commits)")[![legoktm](https://avatars.githubusercontent.com/u/81392?v=4)](https://github.com/legoktm "legoktm (5 commits)")[![siebrand](https://avatars.githubusercontent.com/u/210297?v=4)](https://github.com/siebrand "siebrand (5 commits)")[![addshore](https://avatars.githubusercontent.com/u/3308769?v=4)](https://github.com/addshore "addshore (4 commits)")[![NovemLinguae](https://avatars.githubusercontent.com/u/79697282?v=4)](https://github.com/NovemLinguae "NovemLinguae (3 commits)")[![Volker-E](https://avatars.githubusercontent.com/u/619536?v=4)](https://github.com/Volker-E "Volker-E (2 commits)")[![amire80](https://avatars.githubusercontent.com/u/346271?v=4)](https://github.com/amire80 "amire80 (2 commits)")[![Daimona](https://avatars.githubusercontent.com/u/38216014?v=4)](https://github.com/Daimona "Daimona (2 commits)")[![DannyS712](https://avatars.githubusercontent.com/u/46829944?v=4)](https://github.com/DannyS712 "DannyS712 (2 commits)")[![kaldari](https://avatars.githubusercontent.com/u/1707155?v=4)](https://github.com/kaldari "kaldari (2 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/wikimedia-minify/health.svg)

```
[![Health](https://phpackages.com/badges/wikimedia-minify/health.svg)](https://phpackages.com/packages/wikimedia-minify)
```

###  Alternatives

[emberlabs/gravatarlib

A lightweight PHP 5.3 OOP library providing easy gravatar integration.

10023.5k](/packages/emberlabs-gravatarlib)

PHPackages © 2026

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