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

ActiveSymfony-bundle[Utility &amp; Helpers](/categories/utility)

sensiolabs/minify-bundle
========================

Assets Minifier (CSS, JS) for Symfony &amp; Minify integration in Asset Mapper

v1.2.0(9mo ago)5694.9k↑16.3%91MITPHPPHP &gt;=8.1CI passing

Since Oct 17Pushed 1mo ago4 watchersCompare

[ Source](https://github.com/sensiolabs/minify-bundle)[ Packagist](https://packagist.org/packages/sensiolabs/minify-bundle)[ Docs](https://github.com/sensiolabs/minify-bundle)[ RSS](/packages/sensiolabs-minify-bundle/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (9)Dependencies (11)Versions (11)Used By (1)

SensioLabs Minify Bundle
========================

[](#sensiolabs-minify-bundle)

![SensioLabs Minify Bundle for Symfony](./minify.dark.svg)```
composer require sensiolabs/minify-bundle
```

[![PHP Version](https://camo.githubusercontent.com/f3ceeb7975cdd364fcf9d9cd13b15e96e08264cb728e90f508c04e8037b32afb/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f2543322541307068702d253345253344253230382e322d3737374242342e7376673f6c6f676f3d706870266c6f676f436f6c6f723d7768697465)](https://github.com/sensiolabs/minify-bundle/blob/main/composer.json)[![CI](https://github.com/sensiolabs/minify-bundle/actions/workflows/CI.yaml/badge.svg?color=68c22e)](https://github.com/sensiolabs/minify-bundle/actions)[![Release](https://camo.githubusercontent.com/c5869614d0c8fa6b15195d2a29cf1f23a0872e8e43fd720e9cebd15c9b51924b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f73656e73696f6c6162732f6d696e6966792d62756e646c653f636f6c6f723d333161366365)](https://github.com/sensiolabs/minify-bundle/releases)[![Packagist Downloads](https://camo.githubusercontent.com/c0c1cd8d2dc51e87ed19c91001eb77bc49655d4d7c09cec0882f4c2ebef01862/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f73656e73696f6c6162732f6d696e6966792d62756e646c653f636f6c6f723d636538353331)](https://github.com/sensiolabs/minify-bundle/)[![License](https://camo.githubusercontent.com/975a3075bf07225b64f046d7305d6f8fa4f8e18fd79d7cbe635c2f355c05ffc9/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f73656e73696f6c6162732f6d696e6966792d62756e646c653f636f6c6f723d643334313666)](https://github.com/sensiolabs/minify-bundle/blob/main/LICENSE)

Minify integration
------------------

[](#minify-integration)

SensioLabs Minify Bundle integrates [Minify](https://github.com/tdewolff/minify) into Symfony Asset Mapper.

### Asset Minifier

[](#asset-minifier)

✅ Minify `CSS` and `JS` files, remove whitespace, comments, and more..

🌍 Reduces the size of your assets by up to `70%` (see metrics below).

🚀 Improves the loading time of your website, and the `user experience`.

### Asset Mapper

[](#asset-mapper)

🎯 Automatically `minify` assets during the build process.

📦 Stores minified assets in the Symfony `cache`.

🌿 Download the Minify binary `automatically` from Github.

Minification
------------

[](#minification)

### JavaScript

[](#javascript)

FileOriginalMinifiedRatioGainCompressionTime[autocomplete.js](https://cdn.jsdelivr.net/npm/@tarekraafat/autocomplete.js@10.2.7/dist/autoComplete.js)19.88 KB9.17 KB46.13%53.87%🟩🟩🟩🟩🟩⬜️⬜️⬜️⬜️⬜️8 ms[bootstrap.js](https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.js)145.40 KB62.20 KB42.76%57.24%🟩🟩🟩🟩🟩🟩⬜️⬜️⬜️⬜️10 ms[video.js](https://cdn.jsdelivr.net/npm/video.js@8.18.1/dist/video.js)2.35 MB690.10 KB29.33%70.67%🟩🟩🟩🟩🟩🟩🟩⬜️⬜️⬜️42 ms[w3c.org js](https://github.com/w3c/w3c-website-templates-bundle/blob/main/public/dist/assets/js/main.js)43.39 KB19.23 KB44.34%55.66%🟩🟩🟩🟩🟩🟩⬜️⬜️⬜️⬜️6 msEven gzip compression is more efficient on minified assets (see metrics below).

 See transfer comparison (gzip) FileOriginalMinifiedRatioGainCompressionautoComplete.js5.59 KB2.68 KB47.96%52.04%🟩🟩🟩🟩🟩⬜️⬜️⬜️⬜️⬜️bootstrap.js29.92 KB12.58 KB42.06%57.94%🟩🟩🟩🟩🟩🟩⬜️⬜️⬜️⬜️video.js538.83 KB202.62 KB37.61%62.39%🟩🟩🟩🟩🟩🟩⬜️⬜️⬜️⬜️w3c.org.js10.44 KB5.89 KB56.45%43.55%🟩🟩🟩🟩⬜️⬜️⬜️⬜️⬜️⬜️### CSS

[](#css)

FileOriginalMinifiedRatioGainCompressionTime[autocomplete.css](https://cdn.jsdelivr.net/npm/@tarekraafat/autocomplete.js@10.2.7/dist/css/autoComplete.css)3.09 KB2.51 KB81.33%18.67%🟩🟩⬜️⬜️⬜️⬜️⬜️⬜️⬜️⬜️2 ms[bootstrap.css](https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.css)281.05 KB231.89 KB82.51%17.49%🟩🟩⬜️⬜️⬜️⬜️⬜️⬜️⬜️⬜️9 ms[video-js.css](https://cdn.jsdelivr.net/npm/video.js@8.18.1/dist/video-js.css)53.37 KB47.06 KB88.24%11.76%🟩🟩⬜️⬜️⬜️⬜️⬜️⬜️⬜️⬜️4 ms[w3c.org css](https://github.com/w3c/w3c-website-templates-bundle/blob/main/public/dist/assets/styles/core.css)111.44 KB70.37 KB63.17%36.83%🟩🟩🟩🟩⬜️⬜️⬜️⬜️⬜️⬜️5 ms See transfer comparison (gzip) FileOriginalMinifiedRatioGainCompressionautoComplete.css1.08 KB0.89 KB82.41%17.59%🟩🟩⬜️⬜️⬜️⬜️⬜️⬜️⬜️⬜️bootstrap.css33.56 KB28.94 KB86.08%13.92%🟩⬜️⬜️⬜️⬜️⬜️⬜️⬜️⬜️⬜️video-js.css13.14 KB12.72 KB96.79%3.21%🟩⬜️⬜️⬜️⬜️⬜️⬜️⬜️⬜️⬜️w3c.org.css21.98 KB13.65 KB62.13%37.87%🟩🟩🟩🟩⬜️⬜️⬜️⬜️⬜️⬜️Installation
------------

[](#installation)

Make sure Composer is installed globally, as explained in the [installation chapter](https://getcomposer.org/doc/00-intro.md)of the Composer documentation.

### With Symfony Flex

[](#with-symfony-flex)

Open a command console, enter your project directory and execute:

```
composer require sensiolabs/minify-bundle
```

### Without Symfony Flex

[](#without-symfony-flex)

 How to install without Symfony Flex#### Step 1: Download the Bundle

[](#step-1-download-the-bundle)

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:

```
composer require sensiolabs/minify-bundle
```

#### Step 2: Enable the Bundle

[](#step-2-enable-the-bundle)

Then, enable the bundle by adding it to the list of registered bundles in the `config/bundles.php` file of your project:

```
// config/bundles.php

return [
    // ...
    Sensiolabs\MinifyBundle\SensiolabsMinifyBundle::class => ['all' => true],
];
```

Depending on your deployment process, you might want to enable the bundle only in the desired environment(s).

Usage
-----

[](#usage)

If you use [AssetMapper](https://symfony.com/doc/current/frontend/asset_mapper.html), run the following command to minify all the assets:

```
php bin/console asset-map:compile
```

This command is usually run when [serving assets in production](https://symfony.com/doc/current/frontend/asset_mapper.html#serving-assets-in-dev-vs-prod) and the SensioLabs Minify Bundle will hook into it to minify all assets while copying them.

### Command Line

[](#command-line)

You can also minify assets manually with the command line. First, make sure that the binary file used to minify assets is properly installed in your computer:

```
php bin/console minify:install
```

Then, run the following command to minify assets:

```
# this outputs the result in the console
php bin/console minify:asset css/main.css

# this will write the output into the 'main.min.css' file
# (the given output file is created / overwritten if needed)
php bin/console minify:asset css/main.css css/main.min.css
```

Configuration
-------------

[](#configuration)

### AssetMapper

[](#assetmapper)

```
# config/packages/sensiolabs_minify.yaml
sensiolabs_minify:
    asset_mapper:
        # you can minify only CSS files, only JS files or both
        types:
            css: true # (default: true)
            js:  true # (default: true)

        # a list of assets to exclude from minification (default: [])
        # the values of the list can be any shell wildcard patterns
        ignore_paths:
            - 'admin/*'
            - '*.min.js'

        # whether to exclude the assets stored in vendor/ from minification;
        # these assets are usually pre-minified, so it's common to exclude them
        ignore_vendor: true # (default: true)
```

### Minify Binary

[](#minify-binary)

#### Local binary

[](#local-binary)

The minification is performed by a binary file that can be installed on your computer/server or downloaded automatically by the bundle. This is the default configuration used by the bundle:

```
# config/packages/sensiolabs_minify.yaml
sensiolabs_minify:
    # ...

    minify:
        # this disables the usage of local binaries
        local_binary: false

        # if TRUE, the bundle will download the binary from GitHub
        download_binary: '%kernel.debug%'

        # the local path where the downloaded binary is stored
        download_directory: '%kernel.project_dir%/var/minify'

        # the Minify version to download (default: null for latest)
        version: null
```

You can customize this configuration to use a local binary:

```
# config/packages/sensiolabs_minify.yaml
sensiolabs_minify:
    # ...

    minify:
        # set it to 'auto' to let the bundle try to find the location of the binary
        local_binary: 'auto'

        # you can also define the path to the binary explicitly, but this won't work
        # if you run the application in multiple servers with different binary locations
        local_binary: "/usr/local/bin/minify"
```

Credits
-------

[](#credits)

### Authors

[](#authors)

- MinifyBundle: [Simon André](https://github.com/smnandre) &amp; [SensioLabs](https://github.com/sensiolabs)
- Minify binary: [Timo Dewolf](https://github.com/tdewolff)

### Acknowledgments

[](#acknowledgments)

This bundle is inspired by the following projects:

- [SassBundle](https://github.com/SymfonyCasts/sass-bundle) from @SymfonyCasts
- [BiomejsBundle](https://github.com/Kocal/BiomeJsBundle) from @Kocal
- [TypeScriptBundle](https://github.com/sensiolabs/AssetMapperTypeScriptBundle) from @SensioLabs

### Contributors

[](#contributors)

Special thanks to the Symfony community for their contributions and feedback.

License
-------

[](#license)

The [SensioLabs Minify Bundle](https://github.com/sensiolabs/minify-bundle) is released under the [MIT license](LICENSE).

###  Health Score

53

—

FairBetter than 97% of packages

Maintenance76

Regular maintenance activity

Popularity47

Moderate usage in the ecosystem

Community24

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 61.3% of commits — single point of failure

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

Recently: every ~67 days

Total

9

Last Release

272d ago

Major Versions

v0.9.5 → v1.0.02024-12-29

PHP version history (2 changes)v0.9.0PHP &gt;=8.2

v1.1.0PHP &gt;=8.1

### Community

Maintainers

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

![](https://www.gravatar.com/avatar/70517f2da516f65e2886381e15213831adb24018a3aec5e29778efb00352c188?d=identicon)[sensiolabs](/maintainers/sensiolabs)

---

Top Contributors

[![smnandre](https://avatars.githubusercontent.com/u/1359581?v=4)](https://github.com/smnandre "smnandre (19 commits)")[![alexislefebvre](https://avatars.githubusercontent.com/u/2071331?v=4)](https://github.com/alexislefebvre "alexislefebvre (4 commits)")[![javiereguiluz](https://avatars.githubusercontent.com/u/73419?v=4)](https://github.com/javiereguiluz "javiereguiluz (2 commits)")[![Rmy5](https://avatars.githubusercontent.com/u/30668074?v=4)](https://github.com/Rmy5 "Rmy5 (1 commits)")[![rvmourik](https://avatars.githubusercontent.com/u/6427451?v=4)](https://github.com/rvmourik "rvmourik (1 commits)")[![salahm](https://avatars.githubusercontent.com/u/1071005?v=4)](https://github.com/salahm "salahm (1 commits)")[![sschueller](https://avatars.githubusercontent.com/u/1180107?v=4)](https://github.com/sschueller "sschueller (1 commits)")[![araab](https://avatars.githubusercontent.com/u/1562064?v=4)](https://github.com/araab "araab (1 commits)")[![n3o77](https://avatars.githubusercontent.com/u/321891?v=4)](https://github.com/n3o77 "n3o77 (1 commits)")

---

Tags

asset-mapperassetscsscss-minifierjsjs-minifierminifierminifypagespeedperformancephpphp-cssphp-minifysymfonysymfony-bundleuglifysymfonycssJSminifyminifiercompressassetsuglifyasset-mapper

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[matthiasmullie/minify

CSS &amp; JavaScript minifier, in PHP. Removes whitespace, strips comments, combines files (incl. @import statements and small assets in CSS files), and optimizes/shortens a few common programming patterns.

2.0k30.5M336](/packages/matthiasmullie-minify)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[stolz/assets

An ultra-simple-to-use assets management library

296519.2k8](/packages/stolz-assets)[fisharebest/laravel-assets

Asset management for Laravel

208.1k](/packages/fisharebest-laravel-assets)

PHPackages © 2026

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