PHPackages                             smladeoye/yii2-dependentinput - 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. smladeoye/yii2-dependentinput

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

smladeoye/yii2-dependentinput
=============================

Yii 2 Dependent Form Input

08PHP

Since Jun 18Pushed 9y ago1 watchersCompare

[ Source](https://github.com/smladeoye/yii2-dependentinput)[ Packagist](https://packagist.org/packages/smladeoye/yii2-dependentinput)[ RSS](/packages/smladeoye-yii2-dependentinput/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependenciesVersions (1)Used By (0)

yii2-dependentinput
===================

[](#yii2-dependentinput)

YII 2 Dependent Form-Input Control Widget

- \[Installation\] ()
- \[Usage\] ()

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

[](#installation)

The preferred way to install this extension is through composer.

Either run

```
composer require smladeoye/yii2-dependentinput
```

**or**

add '"smladeoye/yii2-dependentinput": "1.0.0"' to the require section of your composer.json file, then run:

```
composer install
```

Usage
-----

[](#usage)

To use the widget, simply call it from your view and pass it the required parameters; Example:

```
    use smladeoye\dependentinput\DependentInputWidget;

    echo DependentInputWidget::widget(
    [
        // set to true to display the default loader when ajax request is being made
        'displayLoader' => true,

        // settings for the widget dependent element
        // this can be an array containg an array of settings or just one array with the setting
        'options' => [
            [
                // the dependent element type - ("select" or "text")
                'type' => 'select',

                // the dependent element parent/parents id without the #
                // the value can be a string or an array;
                // if it is an array, the array key is used to save the value
                //the value for the below input can be gotten from $_GET['params']['input1']
                'parent' => ['input1' => 'input1'],

                OR

                //the value for the below input can be gotten from $_GET['params'][0]
                // 'parent' => 'input1'

                // the dependent element id without the #
                'child' => 'input2',

                // the url used for the ajax request
                'url' => Url::to(),
            ],
            // another dependent element settings
            [
                'type' => 'text',
                'parent' => ['input2'=>'input2'],
                'child' => 'input3',
                'url' => Url::to(),
                // you can set this value in cases where the dependent is an input and you
                // want to modify some attributes with the gotten result
                'resultAttr' => ['max'],
                // you can also set the element attributes
                'elementAttr' => ['max' => 0, 'value' => 'sweet', 'min' => 0]
            ],
        ],
    ]
    );
?>
```

The request method used is GET; The controller action is passed a params array as the GET parameter containing all the parent values which can be identified by their respective keys.

###  Health Score

19

—

LowBetter than 9% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

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://avatars.githubusercontent.com/u/12571220?v=4)[smladeoye](/maintainers/smladeoye)[@smladeoye](https://github.com/smladeoye)

### Embed Badge

![Health badge](/badges/smladeoye-yii2-dependentinput/health.svg)

```
[![Health](https://phpackages.com/badges/smladeoye-yii2-dependentinput/health.svg)](https://phpackages.com/packages/smladeoye-yii2-dependentinput)
```

###  Alternatives

[swiftmade/statamic-clear-assets

Deletes unused assets. Saves storage space.

1944.5k](/packages/swiftmade-statamic-clear-assets)

PHPackages © 2026

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