yiisoft / yii2-jquery
jQuery integration layer for Yii2 asset bundles, client validation scripts, and widget client scripts.
Requires
- php: >=8.3
- yiisoft/yii2: ^22.0@dev
Requires (Dev)
- maglnet/composer-require-checker: ^4.17
- php-forge/foxy: ^0.2
- phpstan/extension-installer: ^1.4
- phpstan/phpstan-strict-rules: ^2.0.3
- phpunit/phpunit: ^11.5
- rector/rector: ^2.1
- symplify/easy-coding-standard: ^13.0
- yii2-extensions/phpstan: ^0.4
This package is auto-updated.
Last update: 2026-04-14 22:39:36 UTC
README
jQuery Integration Extension for Yii2
This extension provides the optional jQuery integration layer for Yii Framework 2.0 applications. It supplies jQuery-backed asset bundles, client-side validation scripts, and widget client scripts for every core validator, grid component, and widget that supports the client-script strategy pattern.
Installation
Important
- The minimum required PHP version is PHP
8.3. - Requires
yiisoft/yii222.x.
The preferred way to install this extension is through composer.
Either run
composer require --prefer-dist yiisoft/yii2-jquery:~1.0.0
or add
"yiisoft/yii2-jquery": "~1.0.0"
to the require section of your composer.json file.
Usage
Once the extension is installed, register the bootstrap class in your application configuration:
return [ 'bootstrap' => [ \yii\jquery\Bootstrap::class, ], // ... ];
The Bootstrap class configures the DI container with jQuery-based $clientScript defaults for every core validator,
grid component, and widget that supports the client-script strategy pattern. No further configuration is required.
Overriding a single validator
You can override the client-script implementation on a per-rule basis by passing the clientScript key in the rule
definition:
public function rules(): array { return [ [ 'email', 'required', 'clientScript' => ['class' => MyCustomRequiredClientScript::class], ], ]; }