jQuery Integration Extension for Yii2
This extension provides the optional jQuery integration layer for [Yii Framework 2.0](https://www.yiiframework.com) 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. [](https://packagist.org/packages/yiisoft/yii2-jquery) [](https://packagist.org/packages/yiisoft/yii2-jquery) [](https://github.com/yiisoft/yii2-jquery/actions?query=workflow%3Abuild) [](https://codecov.io/gh/yiisoft/yii2-jquery) [](https://github.com/yiisoft/yii2-jquery/actions/workflows/static.yml) Installation ------------ > [!IMPORTANT] > - The minimum required [PHP](https://www.php.net/) version is PHP `8.3`. > - Requires [`yiisoft/yii2`](https://github.com/yiisoft/yii2) `22.x`. The preferred way to install this extension is through [composer](https://getcomposer.org/download/). 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: ```php 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: ```php public function rules(): array { return [ [ 'email', 'required', 'clientScript' => ['class' => MyCustomRequiredClientScript::class], ], ]; } ``` ## Quality code [](https://github.com/yii2-framework/jquery/actions/workflows/static.yml) [](https://github.styleci.io/repos/1053295485?branch=main) ## Documentation - [Installation Guide](docs/guide/installation.md) - [Configuration Reference](docs/guide/configuration.md) - [Usage Examples](docs/guide/usage.md) - [Testing Guide](docs/guide/testing.md) ## Support the project [](https://opencollective.com/yiisoft) ## Follow updates [](https://www.yiiframework.com/) [](https://x.com/yiiframework) [](https://t.me/yii_framework_in_english) [](https://yiiframework.com/go/slack) ## License [](LICENSE)
If you have any questions, please ask in the forum instead.
Signup or Login in order to comment.