PHPackages                             sandritsch91/yii2-widget-form-wizard - 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. sandritsch91/yii2-widget-form-wizard

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

sandritsch91/yii2-widget-form-wizard
====================================

A Yii2 form-wizard widget for bootstrap 5

1.2.0(9mo ago)35051MITPHPPHP &gt;=8.0

Since Feb 21Pushed 9mo ago1 watchersCompare

[ Source](https://github.com/Sandritsch91/yii2-form-wizard)[ Packagist](https://packagist.org/packages/sandritsch91/yii2-widget-form-wizard)[ RSS](/packages/sandritsch91-yii2-widget-form-wizard/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (8)Versions (4)Used By (0)

yii2-form-wizard
================

[](#yii2-form-wizard)

A Yii2 form-wizard widget for bootstrap 5

[![Alt preview](preview.png)](preview.png)

Features
--------

[](#features)

- Bootstrap 5
- Client side validation, with the option to validate each step separately

Installation
------------

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
php composer.phar require --prefer-dist sandritsch91/yii2-form-wizard
```

or add

```
"sandritsch91/yii2-form-wizard": "*"
```

to the require section of your composer.json

Usage
-----

[](#usage)

```
use sandritsch91\yii2-form-wizard\FormWizard;

echo FormWizard::widget([
    // required
    'model' => $model,                                                          // The model to be used in the form
    'tabOptions' => [                                                           // These are the options for the Bootstrap Tab widget
        'items' => [
            [
                'label' => 'Step 1',                                            // The label of the tab, if omitted, a default-label will be used (Step 1, Step 2, ...)
                'content' => $this->render('_step1', ['model' => $model]),      // Either the content of the tab
            ],
            [
                'label' => 'Step 2',
                'view' => '/test/_step2',                                       // or a view to be rendered. $model and $form are passed to the view
                'params' => ['a' => 1, 'b' => 2]                                // Pass additional parameters to the view
            ]
        ],
        'navType' => 'nav-pills'
    ],
    // optional
    'validateSteps' => [                                                        // Optional, pass the fields to be validated for each step.
        ['name', 'surname'],
        [],                                                                     // Leave array empty if no validation is needed
        ['email', 'password']
    ],
    'options' => [],                                                            // Wizard-container html options
    'formOptions' => [],                                                        // Form html options
    'buttonOptions' => [                                                        // Button html options
        'previous' => [
            'class' => ['btn', 'btn-secondary'],
            'data' => [
                'formwizard' => 'previous'                                      // If you change this, make sure the clientOptions match
            ]
        ],
        'next' => [...],
        'finish' => [...]
    ],
    'clientOptions' => [                                                        // Client options for the form wizard, if you need to change them
        // 'finishSelector' => '...',
        // 'nextSelector' => '...',
        // 'previousSelector' => '...',
        // 'keepPosition' => true                                               // Keep scroll position on step change.
                                                                                // Set to false to disable, or pass a selector if you have a custom scroll container.
                                                                                // Defaults to true.
    ],
    'clientEvents' => [                                                         // Client events for the form wizard
        // 'onNext' => 'function () {...}',
        // 'onPrevious' => 'function () {...}',
        // 'onFinish' => 'function (){...}'
    ]
]);
```

Contributing
------------

[](#contributing)

Contributions are welcome.

If you have any questions, ideas, suggestions or bugs, please open an issue.

### Testing

[](#testing)

This package uses codeception for testing. To run the tests, run the following commands:

`php.exe .\vendor\bin\codecept run` for all test suites

#### Unit tests

[](#unit-tests)

run `php.exe .\vendor\bin\codecept run Unit` in the root directory of this repository.

#### Functional tests

[](#functional-tests)

run `php.exe .\vendor\bin\codecept run Functional` in the root directory of this repository.

#### Accpetance tests

[](#accpetance-tests)

To be able to run acceptance tests, a few requirements are needed:

For Windows:\\

- install java runtime environment
- install nodejs
- install selenium-standalone: `npm install -g selenium-standalone`
- start selenium-standalone: `selenium-standalone install && selenium-standalone start`
- host a yii2 application on a server or locally via `./yii serve`
    - add this plugin as a dependency to your `composer.json` and update dependencies
    - site must be reachable over
    - add an action `actionTest` to the `SiteController`, as described below
    - this action must return a view file, as described below
    - run `php.exe .\vendor\bin\codecept run Acceptance`

For Linux:
Never did that before, but I think it is similar to the Windows setup.

The action in the SiteController:

```
public function actionTest(): string
{
    include __DIR__ . '/../vendor/sandritsch91/yii2-widget-form-wizard/tests/Support/Data/models/User.php';

    $model = new User();

    if (Yii::$app->request->post() && $model->load(Yii::$app->request->post()) && $model->validate()) {
        return 'success';
    }

    return $this->render('test', [
        'model' => new User()
    ]);
}
```

The view returned by the action:

```
/** @var User $model */

use sandritsch91\yii2\formwizard\FormWizard;
use sandritsch91\yii2\formwizard\tests\Support\Data\models\User;

$wizard = FormWizard::widget([
    'model' => $model,
    'tabOptions' => [
        'options' => [
            'class' => 'mb-3'
        ],
        'items' => [
            [
                'label' => 'Step 1',
                'view' => '@app/vendor/sandritsch91/yii2-widget-form-wizard/tests/Support/Data/views/site/step1',
                'linkOptions' => [
                    'id' => 'step1-link',,
                    'params' => [
                        'test' => 'some test variable'
                    ]
                ]
            ],
            [
                'label' => 'Step 2',
                'view' => '@app/vendor/sandritsch91/yii2-widget-form-wizard/tests/Support/Data/views/site/step2',
                'linkOptions' => [
                    'id' => 'step2-link',
                ]
            ],
            [
                'label' => 'Step 3',
                'view' => '@app/vendor/sandritsch91/yii2-widget-form-wizard/tests/Support/Data/views/site/step3',
                'linkOptions' => [
                    'id' => 'step3-link',
                ]
            ]
        ],
        'navType' => 'nav-pills'
    ],
    'validateSteps' => [
        ['firstname', 'lastname'],
        ['username', 'password', 'password_validate'],
        ['email']
    ],
    'clientOptions' => [
        'keepPosition' => true
    ]
]);

echo \yii\helpers\Html::tag('div', $wizard, [
    'class' => 'col-4'
]);
```

After the initial installation, you only have to start the selenium-standalone server `selenium-standalone start`and run the tests `php.exe .\vendor\bin\codecept run Acceptance` in the root directory of this repository.

If you do not want to setup an application, just run the unit and functional tests by running `php.exe .\vendor\bin\codecept run Unit,Functional`, I can modify and run the acceptance tests for you, after you opened a pull request.

###  Health Score

35

—

LowBetter than 79% of packages

Maintenance56

Moderate activity, may be stable

Popularity19

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity48

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 ~261 days

Total

3

Last Release

288d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/239a4e22e3970ec416269e7fd1b42b26005057eb971076bb204cb6cd80b5642d?d=identicon)[Sandritsch91](/maintainers/Sandritsch91)

---

Top Contributors

[![Sandritsch91](https://avatars.githubusercontent.com/u/17873124?v=4)](https://github.com/Sandritsch91 "Sandritsch91 (22 commits)")

---

Tags

yii2widgetbootstrapformwizardbootstrap5form-wizard

### Embed Badge

![Health badge](/badges/sandritsch91-yii2-widget-form-wizard/health.svg)

```
[![Health](https://phpackages.com/badges/sandritsch91-yii2-widget-form-wizard/health.svg)](https://phpackages.com/packages/sandritsch91-yii2-widget-form-wizard)
```

###  Alternatives

[kartik-v/yii2-widget-rating

A Yii2 widget for the simple yet powerful bootstrap-star-rating plugin with fractional rating support (sub repo split from yii2-widgets)

444.1M8](/packages/kartik-v-yii2-widget-rating)[kartik-v/yii2-widget-timepicker

Enhanced Yii2 wrapper for the bootstrap timepicker plugin (sub repo split from yii2-widgets)

404.9M14](/packages/kartik-v-yii2-widget-timepicker)[kartik-v/yii2-widget-switchinput

A Yii2 wrapper widget for the Bootstrap Switch plugin to use checkboxes &amp; radios as toggle switchinputes (sub repo split from yii2-widgets)

384.4M13](/packages/kartik-v-yii2-widget-switchinput)[kartik-v/yii2-widget-touchspin

A Yii2 wrapper widget for the Bootstrap Switch plugin to use checkboxes &amp; radios as toggle touchspines (sub repo split from yii2-widgets)

184.1M6](/packages/kartik-v-yii2-widget-touchspin)[bizley/ajaxdropdown

Bootstrap dropdown list with AJAX data.

1524.8k](/packages/bizley-ajaxdropdown)

PHPackages © 2026

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