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

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

yii-ext/client-script
=====================

Extending client script

08PHP

Since Jun 11Pushed 11y ago1 watchersCompare

[ Source](https://github.com/yii-ext/client-script)[ Packagist](https://packagist.org/packages/yii-ext/client-script)[ RSS](/packages/yii-ext-client-script/feed)WikiDiscussions master Synced 6d ago

READMEChangelogDependenciesVersions (1)Used By (0)

Requirements
------------

[](#requirements)

Yii 1.1.x or above

Description:
------------

[](#description)

EClientScript (an extension for Yii's CClientScript)

This is an optimizing client script manager for Yii framework, that can minify and combine CSS/JS files.

It will automatically detects changes in file content (based on modification time) and generates a unique file name accordingly.

This will reduce the HTTP calls for resources files by merging several resources filesinto a single (or more) files.

Since version of 1.5, also support conditional loading js/css file in IE browser, see example codes please.

The source code is hosted under github:

\####Css Files: CSS files are merged based on there media attribute, background images with a relative path in file can also be displayed correctly.

\####Script files: Script files are merged based on their position, If you use the 'CClientScript::POS\_HEAD' you will end up with a single file for all the script files you've used on that page.

If you use 'CClientScript::POS\_HEAD' and 'CClientScript::POS\_END' for example then you'll end up with two files for each page on that request, becuase those resources are located in different positions.

\####File optmization (EXPERIMENTAL, @since: 1.1) [CssMin](http://code.google.com/p/cssmin/) used to optimize merged css file. You can set property 'optmizeCssFiles' of the component to enable this feature. [JSMinPlus](http://crisp.tweakblogs.net/blog/1856/jsmin+-version-13.html) used to optimize merged script file. You can set property 'optmizeScriptFiles' of the component to enable this feature.

Usage:
------

[](#usage)

1. Using this extension is as simple as adding the following code to the application configuration under the components array:

    ```
      'clientScript' => array(
        'class' => 'application.vendors.yii-EClientScript.EClientScript',
        'combineScriptFiles' => !YII_DEBUG, // By default this is set to true, set this to true if you'd like to combine the script files
        'combineCssFiles' => !YII_DEBUG, // By default this is set to true, set this to true if you'd like to combine the css files
        'optimizeScriptFiles' => !YII_DEBUG,	// @since: 1.1
        'optimizeCssFiles' => !YII_DEBUG, // @since: 1.1
        'optimizeInlineScript' => false, // @since: 1.6, This may case response slower
        'optimizeInlineCss' => false, // @since: 1.6, This may case response slower
      ),
    ```

    Then you can use the regular 'registerScriptFile' &amp; 'registerCssFile' methods as normal and the files will be combined or optimized automatically.
2. Using to conditional loading js/css file for IE browser, you just need to specify the media property.

    ```
    $cs = Yii::app()->clientScript;

    // result to:
    $cs->registerScriptFile('/js/html5.js', CClientScript::POS_HEAD, array('media' => 'lt IE 9'));

    // result to:
    $cs->registerCssFile('/css/ie.css', 'lte IE 6');
    ```

NOTE:
-----

[](#note)

If you registered some external resource files that not in the web application root directory, they will be kept and not combined. Compression or optmization is a EXPERIMENTAL feature, please use it carefully(@since: 1.1)

ChangesLog:
-----------

[](#changeslog)

**Aug 13, 2013**

- New version number 1.6
- Fixed bug for merging minified scripts, they may be missing a semicolon at the end
- Add support to optimize inline css/js codes

**Aug 2, 2013**

- Fixed load order of non-combined css files.

**Mar 29, 2013**

- New version number 1.5
- Compatiable with the 3rd parameter of `registerScript` and `registerScriptFile`
- Add support for conditional loading js/css file in IE.
- Prepend the base url of current request when register a script/css file with relative path

**Mar 27, 2013** (by Muayyad Alsadi)

- New version number 1.4
- update JSMinPlus, CssMin
- use stronger hash for file names
- consider modification time for calculating hash
- enable all features by default

**Dec 06, 2010**

- Fixed problem for css files that begin with `@charset "xxx"`, it should be in the first line of file and not repeatly.
- Add support for theme resource files.

**Nov 23, 2010**

- Skip the minimization of files whose names include `.pack.`
- Add the last modification time as the QUERY\_STRING to merged file, to avoid not properly flush the browser cache when the file updated.

**Nov 6, 2010**

- New version number 1.3
- Not repeat the minimization of Javascript codes those who have been minimized, whose names include `.min.`
- Fixed `getRelativeUrl()` platform compatibility issue. (thanks to Troto)

Known Issues:
-------------

[](#known-issues)

When some resource files can not be merged and they are strictly dependent on loading order, then may have some problems.

Reporting Issue:
----------------

[](#reporting-issue)

Reporting Issues and comments are welcome, please report issues to

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

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/1a53a15e1548ce60ee92591e71492a39eaaecfc88eaa1a9d7f353d5c910381de?d=identicon)[disem](/maintainers/disem)

---

Top Contributors

[![muayyad-alsadi](https://avatars.githubusercontent.com/u/1312683?v=4)](https://github.com/muayyad-alsadi "muayyad-alsadi (9 commits)")[![hightman](https://avatars.githubusercontent.com/u/812381?v=4)](https://github.com/hightman "hightman (6 commits)")[![alsadi](https://avatars.githubusercontent.com/u/95337?v=4)](https://github.com/alsadi "alsadi (5 commits)")[![dmitry-semenov](https://avatars.githubusercontent.com/u/17027799?v=4)](https://github.com/dmitry-semenov "dmitry-semenov (3 commits)")[![xt99](https://avatars.githubusercontent.com/u/608600?v=4)](https://github.com/xt99 "xt99 (3 commits)")[![korotin](https://avatars.githubusercontent.com/u/277992?v=4)](https://github.com/korotin "korotin (1 commits)")[![viqtor](https://avatars.githubusercontent.com/u/3830201?v=4)](https://github.com/viqtor "viqtor (1 commits)")

### Embed Badge

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

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

###  Alternatives

[teguh02/indonesia-territory-forms

Display a Indonesia Territory Select Form For Filament Within the Zip-Code Without Any Seeder Needed

161.1k](/packages/teguh02-indonesia-territory-forms)

PHPackages © 2026

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