Yii2 how to solve the problem with bootstrap4, where it does not match?

Hello!
I installed yii2, (installed automatically yiisoft/yii2-bootstrap4), then installed kartik-v/yii2-widget-datepicker, put connection code use kartik\select2\Select2; then main code:

 echo '<label>Check Issue Date</label>';
 echo DatePicker::widget([
    'name' => 'mytime',
    'value' => date('d-M-Y', strtotime('+2 days')),
    'options' => ['placeholder' => 'Select issue date ...'],
    'pluginOptions' => [
        'format' => 'dd-M-yyyy',
        'todayHighlight' => true
    ]
]);

this error comes out:

Invalid Configuration – yii\base\InvalidConfigException You must install ‘yiisoft/yii2-bootstrap’ extension for Bootstrap 3.x version support. Dependency to ‘yii2-bootstrap’ has not been included with ‘yii2-krajee-base’. To resolve, you must add ‘yiisoft/yii2-bootstrap’ to the ‘require’ section of your application’s composer.json file and then run ‘composer update’.

NOTE: This dependency change has been done since v2.0 of ‘yii2-krajee-base’ because only one of ‘yiisoft/yii2-bootstrap’ OR ‘yiisoft/yii2-bootstrap4’ OR ‘yiisoft/yii2-bootstrap5’ extensions can be installed. The developer can thus choose and control which bootstrap extension library to install.


the site for installing kartik datapicker says so: The widget is specially styled for Bootstrap 3 and Bootstrap 4 for Yii 2 Framework. The widget allows graceful degradation to a normal HTML text input, if the browser does not support JQuery. i have it installed in yii2 bootstrap4 how to solve the problem where it does not match?

I think you need to set

‘params’ => [
‘bsVersion’ => ‘4.x’,

in your config

Hi, I have the same problem and I am new to this, in what file is this parameter configured?, thanks!!!

If you are using config as it is, for basic app
config/params.php

<?php
//add which ever boot strap version you using.
return [
    ...
      'bsVersion' => '4.x',
    ....
];
2 Likes