PHPackages                             yanli0303/yii-minify-client-script - 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. yanli0303/yii-minify-client-script

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

yanli0303/yii-minify-client-script
==================================

A PHP Yii framework extension to minify JavaScript and CSS files for a web page.

0.2(11y ago)1111MITPHPPHP &gt;=5.3

Since Mar 4Pushed 10y ago1 watchersCompare

[ Source](https://github.com/yanli0303/Yii-MinifyClientScript)[ Packagist](https://packagist.org/packages/yanli0303/yii-minify-client-script)[ RSS](/packages/yanli0303-yii-minify-client-script/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (2)Versions (2)Used By (0)

Yii-MinifyClientScript
======================

[](#yii-minifyclientscript)

*By [Yan Li](https://github.com/yanli0303)*

[![Build Status](https://camo.githubusercontent.com/1b3692cdc342c0ae5817d07d544f11b51b4a810ac505af7a742a0e84f9381c6f/68747470733a2f2f7472617669732d63692e6f72672f79616e6c69303330332f5969692d4d696e696679436c69656e745363726970742e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/yanli0303/Yii-MinifyClientScript)[![Coverage Status](https://camo.githubusercontent.com/ff883585e87b8bda05c112ab33704d346d151ba6c08e7a9f8bbf78b86b2a2f82/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f79616e6c69303330332f5969692d4d696e696679436c69656e745363726970742f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/r/yanli0303/Yii-MinifyClientScript?branch=master)[![License](https://camo.githubusercontent.com/1a2e0606685ce00663bf829868f794fd3fc9c86f8d80cae324734129e0723a58/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d627269676874677265656e2e737667)](https://packagist.org/packages/yanli0303/yii-minify-client-script)[![PayPayl donate button](https://camo.githubusercontent.com/6f1f24b30244c5434ccb5adebe7692acfe95a9740c9aae282f2864334ef51438/687474703a2f2f696d672e736869656c64732e696f2f62616467652f70617970616c2d646f6e6174652d6f72616e67652e737667)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=silentwait4u%40gmail%2ecom&lc=US&item_name=Yan%20Li&no_note=0&currency_code=USD&bn=PP%2dDonationsBF%3apaypal%2ddonate%2ejpg%3aNonHostedGuest)

A PHP [Yii framework](http://www.yiiframework.com/ "Yii Framework Home") extension to minify JavaScript and CSS files for a web page.

How does it work?
-----------------

[](#how-does-it-work)

1. Minify each JavaScript and CSS files before deployment (during build stage):
    - For each JavaScript/CSS file we have, generated a minified version in same directory, and name it with a **.min** suffix;
    - e.g. Minified version of `~/src/css/style.css` should be named as `~/src/css/style.min.css`
2. Concatenate the JavaScript/CSS files required on the page at run-time

Usage
-----

[](#usage)

1. Create a new extension directory for your Yii application: `~/protected/extensions/minify`
2. Download both [src/MinifyClientScript.php](https://github.com/yanli0303/Yii-MinifyClientScript/blob/master/src/MinifyClientScript.php) and [LICENSE.md](https://github.com/yanli0303/Yii-MinifyClientScript/blob/master/LICENSE.md), put them into `~/protected/extensions/minify`
3. Update your Yii application configuration file(usually named `/protected/config/main.php`) and replace the Yii [CClientScript](http://www.yiiframework.com/doc/api/1.1/CClientScript) with `MinifyClientScript`
4. Before deploying, minify the individual JavaScript and CSS files:
    - You can do it with [Ant-MinifyJsCss](https://github.com/yanli0303/Ant-MinifyJsCss)
5. Pack your application sources and deploy

Sample Yii application configuration file:

```
return array(
    'basePath' => __DIR__ . '/..',
    'name' => 'Your App Name',
    'preload' => array('log'),
    'import' => array(
        'application.models.*',
        'application.components.*',
        'application.extensions.*'
    ),
    'clientScript' => array(
        'class' => 'ext.minify.MinifyClientScript',
        'minify' => !YII_DEBUG, // Disable minifying while developing
        // put all js files before end  tag
        // note this setting won't affect css files, they will be put in
        'coreScriptPosition' => CClientScript::POS_END,
        'packages' => array(
            'home_page' => array(
                'baseUrl' => '',
                'js' => array(
                    'bower_components/jquery/jquery.js',
                    'bower_components/angular/angular.js',
                    'bower_components/bootstrap/dist/js/bootstrap.js',
                    'js/home/home_index.js'
                ),
                'css' => array(
                    'bower_components/bootstrap/dist/css/bootstrap.css',
                    'css/home/home_index.css'
                )
            )
        )
    )
);
```

NOTE
----

[](#note)

It requires **sticky session** from load balance server, otherwise you'll encounter HTTP 404 problems.

Alternatives
------------

[](#alternatives)

- EClientScript:

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity48

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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

4086d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6e340371c515137e6faf42b5a2b12e974242352e6cc7d46cd0e0fc61f890a104?d=identicon)[yanli0303](/maintainers/yanli0303)

---

Top Contributors

[![yanli0303](https://avatars.githubusercontent.com/u/3038713?v=4)](https://github.com/yanli0303 "yanli0303 (40 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/yanli0303-yii-minify-client-script/health.svg)

```
[![Health](https://phpackages.com/badges/yanli0303-yii-minify-client-script/health.svg)](https://phpackages.com/packages/yanli0303-yii-minify-client-script)
```

PHPackages © 2026

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