Skip to content
PHP Ecosystem
Explore

Installation guide

  • PHP 8.3 or higher with the dom extension.
  • Composer for dependency management.
  • Yii2 2.0.55 or higher, or the 22.0.x development line; the application opts into it by requiring yiisoft/yii2:22.0.x-dev. Earlier 2.0 releases are affected by security advisories, the most recent being CVE-2026-39850.
  • symfony/css-selector and symfony/dom-crawler 6.4, 7.x or 8.x (8.x requires PHP 8.4).
Terminal window
composer require --prefer-dist yii2-extensions/dynamicform:^2.0

The widget registers Yii2\Extensions\DynamicForm\DynamicFormAsset, which depends on yii\web\JqueryAsset and yii\widgets\ActiveFormAsset. Yii’s asset manager publishes the plugin shipped with the package; no Node.js build is needed for the widget. The application must provide jQuery at the path used by its installed JqueryAsset: @bower/jquery/dist for Yii 2.0.55, or @npm/jquery/dist for Yii 22. Keep any deliberate asset-bundle overrides.

Yii 22 only suggests the jQuery client-script implementation. Install it explicitly alongside the development Yii version:

Terminal window
composer require --prefer-dist yiisoft/yii2:22.0.x-dev yiisoft/yii2-jquery:dev-master

Register its bootstrap before creating forms and validators, merging this entry into the application’s existing bootstrap list:

return [
'bootstrap' => [
\yii\jquery\Bootstrap::class,
],
];

Provide the jQuery distribution at @npm/jquery/dist, for example through the application’s npm assets and @npm alias, or configure yii\web\JqueryAsset to use an existing jQuery distribution. Registering the assets alone does not configure Yii 22’s ActiveForm client validation. Verify yii.activeForm is initialized and newly inserted rows validate in a real browser; the package’s browser suite currently exercises Yii 2.0.55, not Yii 22.

The bundle loads yii2-dynamic-form.js when YII_DEBUG is true and yii2-dynamic-form.min.js otherwise. Configure the bundle through the asset manager to select the files yourself:

return [
'components' => [
'assetManager' => [
'bundles' => [
Yii2\Extensions\DynamicForm\DynamicFormAsset::class => [
'js' => ['yii2-dynamic-form.js'],
],
],
],
],
];

Back to documentation