PHPackages                             makehappen/autominifier - 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. makehappen/autominifier

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

makehappen/autominifier
=======================

Automatically Minify and Concatenate your JS and CSS files and libraries into single files for improved application performance.

1.0.1(8y ago)31.1kMITPHPPHP ~5.6|~7.0

Since May 30Pushed 8y agoCompare

[ Source](https://github.com/makehappen/autominifier)[ Packagist](https://packagist.org/packages/makehappen/autominifier)[ Docs](https://github.com/makehappen/minifier)[ RSS](/packages/makehappen-autominifier/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (4)Versions (4)Used By (0)

autominifier
============

[](#autominifier)

[![Latest Version on Packagist](https://camo.githubusercontent.com/17ae505ffb64e3a2f5eed9a3bc71183745d486157a5618b28590d5d8fae45915/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d616b6568617070656e2f6175746f6d696e69666965722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/makehappen/autominifier)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/a0a3600b12b9e18df3c24263531bcd72ed5fe0517d339cc5f0f015ceed80602a/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6d616b6568617070656e2f6175746f6d696e69666965722f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/makehappen/autominifier)[![Coverage Status](https://camo.githubusercontent.com/f6eaf67f823940ecb47268795f069eb460ebbd6404168625a1703bf7e8b66058/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f6d616b6568617070656e2f6175746f6d696e69666965722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/makehappen/autominifier/code-structure)[![Quality Score](https://camo.githubusercontent.com/e4ca42c82e8f4d57320c98c10de0da7547365c97a5dd802d80e7b4f39c1353af/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f6d616b6568617070656e2f6175746f6d696e69666965722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/makehappen/autominifier)[![Total Downloads](https://camo.githubusercontent.com/27affcce537cddab484f0c696208ed9562285bc1317fbcd2676c9ff6eb659a15/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d616b6568617070656e2f6175746f6d696e69666965722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/makehappen/autominifier)

Automatically Minify and Concatenate your JS and CSS files and libraries into single files for improved application performance.

Main features
-------------

[](#main-features)

- Auto minify and concatenate js and css libraries into single .min files
- Auto cache bust on changed versions
- Auto detection of environment type

Other features
--------------

[](#other-features)

- It just works, out of the box
- Set it and forget it
- No complex configurations
- No Node.js required
- No "watch" command required
- No "--production" flag required
- No configuration updates needed when adding new files
- Auto detect already minified files
- Customize destination folder and file names
- Faster than Gulp or Grunt

Install
-------

[](#install)

Via Composer

```
$ composer require makehappen/autominifier
```

Basic Usage
-----------

[](#basic-usage)

```
// minifier instance with default settings
$minifier = new Makehappen\AutoMinifier\Minify();

// returns "/js/app.min.js"
$minifier->js();

// returns "/css/app.min.css"
$minifier->css();
```

Post install:

- Add env.json files to .gitignore
- Update environment in env.json to development

```
{
    "environment": "development"
}
```

- Run minifier instance again to generate .min files

Customized Usage
----------------

[](#customized-usage)

Custom folders and .min files:

```
// minifier instance with public path relative to package src folder path
$minifier = new Makehappen\AutoMinifier\Minify();
$minifier->setPublicFolder('/../../../../public_html/');

// returns .min.js file path with custom destinations
$minifier->js('/javascript', 'functions.min.js');

// returns .min.css file path path with custom destinations
$minifier->js('/styles', 'style.min.css');
```

Custom list and order of files: config.json

```
{
    "files": [
        "file-1.js",
        "folder2/file-2.js"
    ]
}
```

Implementation example in a Laravel project
-------------------------------------------

[](#implementation-example-in-a-laravel-project)

[![Autominifier implementation example in a Laravel project](https://user-images.githubusercontent.com/3846431/27359704-261c8d24-55d2-11e7-88dc-00520ed71bf4.png)](https://github.com/makehappen/autominifier/issues/1)[View all Screenshots &gt;&gt;](https://github.com/makehappen/autominifier/issues/1)

Conventions
-----------

[](#conventions)

- By default, JavaScript files should live in the public /js folder or its sub-folders
- By default, CSS files should live in the public /css folder or its sub-folders
- Default concatenation order is alphabetical, folders first, followed by file names
- Default relative path from vendor folder to public folder is expected to be ../public
- Accepted extension files: .js, .css, .sass, .scss

Change log
----------

[](#change-log)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Testing
-------

[](#testing)

```
$ composer test
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) and [CONDUCT](CONDUCT.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Florin Ilie](https://github.com/makehappen)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~0 days

Total

3

Last Release

3267d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/35493b3579c43c45e05e7e9792a78df91d15ac52deca76d7570292651cfd7c52?d=identicon)[makehappen](/maintainers/makehappen)

---

Top Contributors

[![makehappen](https://avatars.githubusercontent.com/u/3846431?v=4)](https://github.com/makehappen "makehappen (31 commits)")

---

Tags

gruntgulpminifyminify-cssminify-javascriptminifygulpgruntconcatenatemakehappenautominifier

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/makehappen-autominifier/health.svg)

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

###  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)[natxet/cssmin

Minifying CSS

827.3M98](/packages/natxet-cssmin)[stolz/assets

An ultra-simple-to-use assets management library

296519.2k8](/packages/stolz-assets)[mrclay/jsmin-php

Provides a modified port of Douglas Crockford's jsmin.c, which removes unnecessary whitespace from JavaScript files.

5312.9M27](/packages/mrclay-jsmin-php)[vinkius-labs/laravel-page-speed

Laravel Page Speed

2.5k5.4k1](/packages/vinkius-labs-laravel-page-speed)[tholu/php-packer

A PHP version of Packer, JavaScript obfuscation library originally created by Dean Edwards

137441.2k5](/packages/tholu-php-packer)

PHPackages © 2026

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