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

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

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

A PHP console application for minifying JavaScript and CSS files of a PHP Yii web application.

v0.4(10y ago)113MITPHPPHP &gt;=5.3

Since Jun 1Pushed 10y ago1 watchersCompare

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

READMEChangelog (4)Dependencies (5)Versions (5)Used By (0)

Yii-MinifyClientScriptPackage
=============================

[](#yii-minifyclientscriptpackage)

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

[![Build Status](https://camo.githubusercontent.com/73f5580f09a8a6287fc86ea512f4d44508f350e6c4847a457da2be60e5f16b8a/68747470733a2f2f7472617669732d63692e6f72672f79616e6c69303330332f5969692d4d696e696679436c69656e745363726970745061636b6167652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/yanli0303/Yii-MinifyClientScriptPackage)[![Coverage Status](https://camo.githubusercontent.com/89751c372cfcd0e9b6fde953d24f31755dc4446f377bba6ba0a95fe71e28a0cd/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f79616e6c69303330332f5969692d4d696e696679436c69656e745363726970745061636b6167652f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/r/yanli0303/Yii-MinifyClientScriptPackage?branch=master)[![License](https://camo.githubusercontent.com/1a2e0606685ce00663bf829868f794fd3fc9c86f8d80cae324734129e0723a58/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d627269676874677265656e2e737667)](https://packagist.org/packages/yanli0303/yii-minify-client-script-package)[![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 console application for minifying JavaScript and CSS files of a PHP Yii web application.

Usage
-----

[](#usage)

1. Minify JavaScript and CSS files with [Ant-MinifyJsCss](https://github.com/yanli0303/Ant-MinifyJsCss)

    > ant -Dsrc="path to Yii web application webroot" minify
2. Download *yiimin.phar* from [downloads](downloads)
3. Open a new command/terminal window, change current directory to the *Yii web app webroot*, and execute following command

    > php yiimin.phar minify -v

Example
-------

[](#example)

Take the [YiiWebApp](tests/YiiWebApp) in tests as an example, suppose you have 3 client script packages defined in Yii web app config file [protected/config/main.php](tests/YiiWebApp/protected/config/main.php):

```
'clientScript' => array(
    'class'    => 'CClientScript',
    'packages' => array(
        'jquery'   => array(
            'baseUrl' => '//code.jquery.com/',
            'js'      => array('jquery-1.11.3.min.js')
        ),
        'layout'   => array(
            'baseUrl' => 'css/layout',
            'css'     => array('pageHeader.css', 'pageFooter.css')
        ),
        'homePage' => array(
            'baseUrl' => '',
            'depends' => array('jquery', 'layout'),
            'js'      => array('js/homePage/homePage.js'),
            'css'     => array('css/homePage/homePage.css')
        )
    )
)
```

Firstly you need to minify each local JavaScript and CSS files, after doing so, you'll have the following files:

- css/layout/pageHeader.min.css
- css/layout/pageFooter.min.css
- css/homePage/homePage.min.css
- js/homePage/homePage.min.js

Then, with this tool:

1. Open a new terminal window, change current directory to *YiiWebApp*
2. Run `php yiimin.phar minify -v`

After that, your config file will be changed to:

```
'clientScript' => array(
    'class' => 'CClientScript',
    'packages' => array(
        'jquery' => array(
            'baseUrl' => '//code.jquery.com',
            'js' => array('jquery-1.11.3.min.js')
        ),
        'layout' => array(
            'baseUrl' => '',
            'css' => array('assets/layout_d7863...48618.min.css')
        ),
        'homePage' => array(
            'baseUrl' => '',
            'depends' => array('jquery'),
            'css' => array('assets/homePage_d8e21...fa8f7.min.css'),
            'js' => array('assets/homePage_8cc59...57c458.min.js')
        )
    )
)
```

And the *assets/homePage\_d8e21...fa8f7.min.css* comprises the contents of following files:

- css/layout/pageHeader.min.css
- css/layout/pageFooter.min.css
- css/homePage/homePage.min.css

Limitations
-----------

[](#limitations)

- Better to only register one client script package on a page/view. If you registered several packages on a page, make sure the packages don't depend on a same package, otherwise the resources of the shared package will be loaded on the page multiple times;
- Don't use [registerCssFile](http://www.yiiframework.com/doc/api/1.1/CClientScript#registerCssFile-detail) or [registerScriptFile](http://www.yiiframework.com/doc/api/1.1/CClientScript#registerScriptFile-detail) anymore; use [registerPackage](http://www.yiiframework.com/doc/api/1.1/CClientScript#registerPackage-detail) instead.

Run tests
---------

[](#run-tests)

1. Install [composer](https://getcomposer.org/) and run `composer install`
2. Install [PHPUnit](https://phpunit.de/) and run `phpunit`

Build PHAR from source
----------------------

[](#build-phar-from-source)

1. Download [box.phar](https://github.com/box-project/box2)
2. Open a new terminal/command prompt window, change current directory to this console application
3. Run `php /path/to/box.phar build`, new **yiimin.phar** will be created in **downloads**

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity51

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

Every ~2 days

Total

4

Last Release

3996d 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 (41 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[symfony/maker-bundle

Symfony Maker helps you create empty commands, controllers, form classes, tests and more so you can forget about writing boilerplate code.

3.4k111.1M568](/packages/symfony-maker-bundle)[roave/backward-compatibility-check

Tool to compare two revisions of a public API to check for BC breaks

5953.3M56](/packages/roave-backward-compatibility-check)[coenjacobs/mozart

Composes all dependencies as a package inside a WordPress plugin

4723.6M20](/packages/coenjacobs-mozart)[psalm/plugin-laravel

Psalm plugin for Laravel

3274.9M308](/packages/psalm-plugin-laravel)[php-soap/wsdl

Deals with WSDLs

173.5M12](/packages/php-soap-wsdl)[aeliot/todo-registrar

Register TODOs from source code in issue tracker

153.0k](/packages/aeliot-todo-registrar)

PHPackages © 2026

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