PHPackages                             imt/yii-assetic - 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. imt/yii-assetic

ActiveYii-extension[Utility &amp; Helpers](/categories/utility)

imt/yii-assetic
===============

This extension integrates Assetic into Yii

54.3k↓45.6%2PHP

Since Feb 10Pushed 11y ago2 watchersCompare

[ Source](https://github.com/IgorTimoshenko/IMTYiiAssetic)[ Packagist](https://packagist.org/packages/imt/yii-assetic)[ RSS](/packages/imt-yii-assetic/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependenciesVersions (1)Used By (0)

[![Build Status](https://camo.githubusercontent.com/3cf67b34dfe7f2e6386c766e754f91e06b06878f0289a295a369443883db106a/68747470733a2f2f7472617669732d63692e6f72672f49676f7254696d6f7368656e6b6f2f494d54596969417373657469632e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/IgorTimoshenko/IMTYiiAssetic)[![Coverage Status](https://camo.githubusercontent.com/81b25fd83abaa40aa11453752a558a47e84a635da0c6b812a45100f4fa9826b3/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f49676f7254696d6f7368656e6b6f2f494d54596969417373657469632f62616467652e706e67)](https://coveralls.io/r/IgorTimoshenko/IMTYiiAssetic)[![Dependencies Status](https://camo.githubusercontent.com/fbbd62e849dedb4644d6cc0a6f3839a13494c7dfd4a23422de4d4add3be1b318/68747470733a2f2f646570656e64696e672e696e2f49676f7254696d6f7368656e6b6f2f494d54596969417373657469632e706e67)](http://depending.in/IgorTimoshenko/IMTYiiAssetic)

IMTYiiAssetic
=============

[](#imtyiiassetic)

Overview
--------

[](#overview)

This extension integrates [Assetic](https://github.com/kriswallsmith/assetic) into Yii.

> Note that this extension is under development. Use it at your own risk.

Installation
------------

[](#installation)

### 1. Using Composer (recommended)

[](#1-using-composer-recommended)

To install `IMTYiiAssetic` with [Composer](http://getcomposer.org) just add the following to your `composer.json` file:

```
{
    "require": {
        "imt/yii-assetic": "dev-master"
    }
}
```

> Do not forget to require the `vendor/autoload.php` file that is generated by Composer.

Then, you can install the new dependencies by running Composer's update command from the directory where your `composer.json` file is located:

```
$ php composer.phar update imt/yii-assetic
```

Now, Composer will automatically download all required files, and install them for you. All that is left to do is to update your `main.php` file, and register the new extension:

```
return array(
    // ...
    'aliases'    => array(
        // ...
        'IMT\YiiAssetic' => __DIR__ . '/../../vendor/imt/yii-assetic/src/',
        // ...
    ),
    // ...
    'components' => array(
        // ...
        'assetManager' => array(
            'class' => 'IMT\YiiAssetic\AssetManager',
            // ...
        ),
        'clientScript' => array(
            'class' => 'IMT\YiiAssetic\ClientScript',
            // ...
        ),
        // ...
    ),
    // ...
);
```

Usage
-----

[](#usage)

The main goal of this extension is to provide a rich set of Assetic filters to Yii. While developing this extension it was found that is not easy to integrate Assetic into Yii. Yii publishes a whole directory (not the specified files), and does not provide any mechanism to combine assets.

This extension overrides a few core Yii classes and provides some new properties to the overridden classes. Bellow you will find these properties and how use them.

### AssetManager

[](#assetmanager)

#### Public properties

[](#public-properties)

##### cache

[](#cache)

Determines whether assets will be cached.

##### debug

[](#debug)

Determines whether a debug mode will be enabled.

##### filtersByExt

[](#filtersbyext)

A map that defines relations between file extensions and filters.

```
return array(
    // ...
    'components' => array(
        // ...
        'assetManager' => array(
            'class'        => 'IMT\YiiAssetic\AssetManager',
            'filtersByExt' => array(
                'css' => array('css_rewrite'),
                // more filters by ext
            ),
            // ...
        ),
        // ...
    ),
    // ...
);
```

##### userFilters

[](#userfilters)

User-defined filters, can be used to override the core filters.

```
return array(
    // ...
    'components' => array(
        // ...
        'assetManager' => array(
            'class'   => 'IMT\YiiAssetic\AssetManager',
            'filters' => array(
                // built-in Assetic filters has already registered
                'css_rewrite' => 'Assetic\Filter\CssRewriteFilter',
                'smth'        => array(
                    'factoryClass' => 'IMT\YiiAssetic\SmthFilterFactory',
                    // some options that will be passed to the filter factory
                ),
                // more filters
            ),
            // ...
        ),
        // ...
    ),
    // ...
);
```

##### workers

[](#workers)

An array of key-value pairs: the key is the alias, and the value is the class name.

```
return array(
    // ...
    'components' => array(
        'assetManager' => array(
            'class'   => 'IMT\YiiAssetic\AssetManager',
            'workers' => array(
                'smth' => 'IMY\YiiAssetic\SmthWorker',
                // more workers
            ),
            // ...
        ),
        // ...
    ),
    // ...
);
```

### ClientScript

[](#clientscript)

Each user-defined package has the new properties:

#### filtersByExt

[](#filtersbyext-1)

A map that defines relations between file extensions and filters. If it is not specified, will be used the `filtersByExt` property that defined under the `AssetManager`.

#### combineTo

[](#combineto)

Determines whether assets will be combined into one asset. Actually it as a filename, the file extension should be omitted.

```
return array(
    // ...
    'components' => array(
        'clientScript' => array(
            'class'    => 'IMT\YiiAssetic\ClientScript',
            'packages' => array(
                'smth' => array(
                    'basePath'     => 'application.js.src.smth',
                    'css'          => array(
                        'css/file.css',
                        'css/file2.css',
                    ),
                    'filtersByExt' => array(
                        'css' => array('css_rewrite'),
                    ),
                    'combineTo'    => 'smth',
                ),
                // more packages
            ),
            // ...
        ),
        // ...
    ),
    // ...
);
```

Testing
-------

[](#testing)

```
$ make test
```

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

[](#contributing)

Please see [CONTRIBUTING](https://github.com/IgorTimoshenko/IMTYiiAssetic/blob/master/CONTRIBUTING.md) for details.

Credits
-------

[](#credits)

- [Igor Timoshenko](https://github.com/IgorTimoshenko)
- [All Contributors](https://github.com/IgorTimoshenko/IMTYiiAssetic/graphs/contributors)

License
-------

[](#license)

This extension is released under the MIT license. See the complete license in the `LICENSE` file that is distributed with this source code.

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity28

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/2175eb37631b675663d133f303db687d7fb7fc7ff30362d7c7aa175117d21362?d=identicon)[IhorTymoshenko](/maintainers/IhorTymoshenko)

---

Top Contributors

[![carterqw2](https://avatars.githubusercontent.com/u/20768968?v=4)](https://github.com/carterqw2 "carterqw2 (1 commits)")

### Embed Badge

![Health badge](/badges/imt-yii-assetic/health.svg)

```
[![Health](https://phpackages.com/badges/imt-yii-assetic/health.svg)](https://phpackages.com/packages/imt-yii-assetic)
```

PHPackages © 2026

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