PHPackages                             markstory/mini-asset - 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. markstory/mini-asset

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

markstory/mini-asset
====================

An asset compression library. Provides file concatenation and a flexible filter system for preprocessing and minification.

2.1.3(1y ago)66741.1k—0.9%19[5 issues](https://github.com/markstory/mini-asset/issues)3MITPHPPHP &gt;=8.1,&lt;9CI passing

Since Apr 8Pushed 3mo ago4 watchersCompare

[ Source](https://github.com/markstory/mini-asset)[ Packagist](https://packagist.org/packages/markstory/mini-asset)[ Docs](https://github.com/markstory/mini-asset)[ RSS](/packages/markstory-mini-asset/feed)WikiDiscussions 2.x Synced 1mo ago

READMEChangelog (10)Dependencies (5)Versions (52)Used By (3)

Mini Asset
==========

[](#mini-asset)

[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.txt)[![Build Status](https://github.com/markstory/mini-asset/actions/workflows/ci.yml/badge.svg)](https://github.com/markstory/mini-asset/actions/workflows/ci.yml)[![codecov.io](https://camo.githubusercontent.com/270831385021a41ca2155b1998f8e97b236524f48bb3f6bc64512ea0d9374aa2/68747470733a2f2f636f6465636f762e696f2f6769746875622f6d61726b73746f72792f6d696e692d61737365742f636f7665726167652e7376673f6272616e63683d6d6173746572)](https://codecov.io/github/markstory/mini-asset?branch=master)[![Total Downloads](https://camo.githubusercontent.com/f3ee534b21b41134a0b3091a203c93eb5e89492a69e04038ea2a23d084b864e2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d61726b73746f72792f6d696e692d61737365742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/markstory/mini-asset)

Mini Asset is a small footprint library that provide tools to assist in building an asset minification/optimization pipeline. It uses a simple INI based configuration file that lets you define output files, that are comprised of a number of input files. Input files can be processed by filters on a per-extension or per file basis. Filters allow you to integrate existing pre-processors and minifiers or build your own.

Features
--------

[](#features)

- Built-in support for LESScss, Sass and CoffeeScript, as well as several minifiers.
- Powerful and flexible filter system allowing you to add your own minifiers/pre-processors.
- Simple ini configuration files.
- Incremental builds that don't recompile assets when they don't need to be.
- Command Line Tools for building and clearing assets.

Installing
----------

[](#installing)

Add this library to your application with composer, after that you can start integrating MiniAsset into your application and use the provided CLI tools to generate asset targets:

```
php composer.phar require 'markstory/mini-asset'

```

Usage
-----

[](#usage)

Before MiniAsset can do anything, you'll need to define a configuration file to define your asset and which filters apply to them. For example purposes, we'll assume you have some CSS files that need to be minified.

### Defining a configuration file

[](#defining-a-configuration-file)

In your application's configuration directory create a file called `assets.ini`. In this file we'll put all the configuration that MiniAsset needs. We'll cover how to use multiple configuration files later on. Assuming your, application has a `app.css` and `reset.css` put the following in your config file:

```
[css]
cachePath = WEBROOT/cache_css/
paths[] = WEBROOT/css/*
filters[] = SimpleCssMin

[app.css]
files[] = reset.css
files[] = app.css
```

The above also assumes that `WEBROOT` resolves to your application's document root. In the above we defined a few sections. First, the `[css]` section defines how all CSS files should behave:

- The `cachePath` option tells MiniAsset where to store generated assets.
- The `paths[]` options tell MiniAsset where to find CSS files. Paths use glob syntax.
- The `filters[]` options let you configure which filters are applied to all CSS files. Filters are applied in the order they are defined. See the [filters documentation](https://github.com/markstory/mini-asset/wiki/filters) for the available filters and their options.

We also defined an `[app.css]` section. This section defines the files that are used to create `WEBROOT/cache_css/app.css` when it is generated. We've added two files.

See the [sample configuration file](https://github.com/markstory/mini-asset/tree/master/config/assets.sample.ini) for an annotated sample configuration file, and [configuration docs](https://github.com/markstory/mini-asset/wiki/Configuration) for more configuration reference.

### Use the CLI tool to build your asset

[](#use-the-cli-tool-to-build-your-asset)

With a build target defined, we can now generate our asset. We can use the CLI tool to generate our assets:

```
vendor/bin/mini_asset build --config /path/to/assets.ini
```

The above should generate output indicating that the `all.css` file we defined was compiled. If we were to re-run the above command `all.css` would be skipped. MiniAsset is smart enough to know when the components of a build target change and only re-build files when it is necessary.

You can also use the `mini_asset` CLI tool to clear targets:

```
vendor/bin/mini_asset clear --config /path/to/assets.ini
```

### PSR7 Middleware

[](#psr7-middleware)

Mini-asset provides a PSR7 middleware adapter that implements the pattern found in zendframework/zend-stratagility and SlimPHP. Before you can use the middleware provided by mini-asset be sure to setup a config file with your assets. Next, integrate mini-asset into your middleware stack. For example in a SlimPHP app you would do:

```
use MiniAsset\AssetConfig;
use MiniAsset\Middleware\AssetMiddleware;

$assetConfig = AssetConfig::buildFromIniFile(__DIR__ . '../config/assets.ini');
$assets = new AssetMiddleware($assetConfig);

$app->add($assets);
```

Framework Integrations
----------------------

[](#framework-integrations)

- CakePHP - [AssetCompress plugin](https://github.com/markstory/asset_compress).

Issues
------

[](#issues)

Please report any issues you have with the plugin to the [issue tracker](http://github.com/markstory/mini-asset/issues) on github.

License
-------

[](#license)

Mini Asset is offered under an [MIT license](http://www.opensource.org/licenses/mit-license.php).

Copyright
---------

[](#copyright)

2010-2026 Mark Story ()

### Authors

[](#authors)

See the [github contributors list](https://github.com/markstory/mini-asset/graphs/contributors).

### Changelog

[](#changelog)

See CHANGELOG for changes only available on `master`. See [github releases](https://github.com/markstory/mini-asset/releases) for changelogs on previous releases.

###  Health Score

62

—

FairBetter than 99% of packages

Maintenance65

Regular maintenance activity

Popularity52

Moderate usage in the ecosystem

Community31

Small or concentrated contributor base

Maturity85

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 80.9% 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 ~79 days

Recently: every ~90 days

Total

51

Last Release

99d ago

Major Versions

0.1.1 → 1.0.02015-08-01

1.12.1 → 2.0.02023-09-29

1.12.2 → 2.1.22025-02-13

1.x-dev → 2.1.32025-04-26

PHP version history (7 changes)1.4.0PHP &gt;=5.6.0

1.7.2PHP &gt;=7.1

1.8.0PHP &gt;=7.2

1.10.0PHP &gt;=7.2,&lt;8.2

1.12.0PHP &gt;=7.4,&lt;8.3

2.0.0PHP &gt;=8.1,&lt;9

1.12.2PHP &gt;=7.4,&lt;8.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/1efd7167fe426440c421f477c4e808464bc244dea2f5a9786c94db60732f0870?d=identicon)[markstory](/maintainers/markstory)

---

Top Contributors

[![markstory](https://avatars.githubusercontent.com/u/24086?v=4)](https://github.com/markstory "markstory (827 commits)")[![Phally](https://avatars.githubusercontent.com/u/112639?v=4)](https://github.com/Phally "Phally (21 commits)")[![evilbloodydemon](https://avatars.githubusercontent.com/u/39753?v=4)](https://github.com/evilbloodydemon "evilbloodydemon (18 commits)")[![renan](https://avatars.githubusercontent.com/u/28046?v=4)](https://github.com/renan "renan (17 commits)")[![WyriHaximus](https://avatars.githubusercontent.com/u/147145?v=4)](https://github.com/WyriHaximus "WyriHaximus (15 commits)")[![berarma](https://avatars.githubusercontent.com/u/162766?v=4)](https://github.com/berarma "berarma (14 commits)")[![jadb](https://avatars.githubusercontent.com/u/33527?v=4)](https://github.com/jadb "jadb (12 commits)")[![Codaxis](https://avatars.githubusercontent.com/u/6729928?v=4)](https://github.com/Codaxis "Codaxis (10 commits)")[![rynop](https://avatars.githubusercontent.com/u/372730?v=4)](https://github.com/rynop "rynop (8 commits)")[![fullybaked](https://avatars.githubusercontent.com/u/527122?v=4)](https://github.com/fullybaked "fullybaked (7 commits)")[![stickler-ci](https://avatars.githubusercontent.com/u/16011037?v=4)](https://github.com/stickler-ci "stickler-ci (6 commits)")[![afolgado](https://avatars.githubusercontent.com/u/1505996?v=4)](https://github.com/afolgado "afolgado (6 commits)")[![mrothauer](https://avatars.githubusercontent.com/u/527787?v=4)](https://github.com/mrothauer "mrothauer (5 commits)")[![dinhani](https://avatars.githubusercontent.com/u/1139781?v=4)](https://github.com/dinhani "dinhani (5 commits)")[![jiru](https://avatars.githubusercontent.com/u/5107734?v=4)](https://github.com/jiru "jiru (5 commits)")[![lorenzo](https://avatars.githubusercontent.com/u/37621?v=4)](https://github.com/lorenzo "lorenzo (5 commits)")[![ajibarra](https://avatars.githubusercontent.com/u/794722?v=4)](https://github.com/ajibarra "ajibarra (4 commits)")[![robertschererc](https://avatars.githubusercontent.com/u/203977391?v=4)](https://github.com/robertschererc "robertschererc (4 commits)")[![adamroyle](https://avatars.githubusercontent.com/u/25002779?v=4)](https://github.com/adamroyle "adamroyle (4 commits)")[![zeroasterisk](https://avatars.githubusercontent.com/u/23422?v=4)](https://github.com/zeroasterisk "zeroasterisk (3 commits)")

---

Tags

asset-builderasset-pipelinephppsr7cakephpminifiersasslessassetscoffee-script

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/markstory-mini-asset/health.svg)

```
[![Health](https://phpackages.com/badges/markstory-mini-asset/health.svg)](https://phpackages.com/packages/markstory-mini-asset)
```

###  Alternatives

[markstory/asset_compress

An asset compression plugin for CakePHP. Provides file concatenation and a flexible filter system for preprocessing and minification.

3761.0M11](/packages/markstory-asset-compress)[ishanvyas22/asset-mix

Asset Mix plugin for CakePHP

3375.4k2](/packages/ishanvyas22-asset-mix)[scssphp/scssphp

scssphp is a compiler for SCSS written in PHP.

62827.7M220](/packages/scssphp-scssphp)[efficiently/larasset

Larasset is a library for Laravel 5 which manage assets in an easy way.

684.8k](/packages/efficiently-larasset)[nizsheanez/yii2-asset-converter

Less, Sass, Scss and Phamlp converter for Yii2. No system requires. yii2-composer support, Less autoupdate, customizing of output directory

64167.5k6](/packages/nizsheanez-yii2-asset-converter)[sensiolabs/minify-bundle

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

5694.9k1](/packages/sensiolabs-minify-bundle)

PHPackages © 2026

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