Class 'yii\jui\DatePicker' not found

I can’t get DatePicker to work.

Code in view:


  <?= $form->field($model, 'name')->widget( yii\jui\DatePicker::className(),['clientOptions' => ['dateFormat' => 'yy-mm-dd', 'defaultDate' => '2014-01-01']]) ?>


I get error:

Class ‘yii\jui\DatePicker’ not found

Tried also:

widget( \yii\jui\DatePicker::className()

widget( DatePicker::className()

Result is the same.

Class DatePicker is located at vendor/yiisoft/yii2-jui/DatePicker.php

Where could be the problem?

Have you added on top of the file

use yii\jui\DatePicker;


in your code should be


yes, but it gives the same result

changed but it gives the same result

Post your current code

Did you install JUI Extension for Yii 2?

How to install:

no, but I have already these files under /vendor/yiisoft/yii2-jui/

Is it possible you have a namespace problem? Make sure you have:

namespace yii\jui;

at the top of your DatePicker.php file.

this also don’t help

How did you get /vendor/yiisoft/yii2-jui/? If you’ve just copied it it won’t work. You have to install it via Composer.

No? how did you install it? you can’t put the files by yourself! if you did that you need to modify the extension.php file. So i recommend you to install the extension by composer!!!

As Xview is saying, you should confirm that you have in extensions.php:

 'yiisoft/yii2-jui' => 

  array (

    'name' => 'yiisoft/yii2-jui',

    'version' => '',

    'alias' => 

    array (

      '@yii/jui' => $vendorDir . '/yiisoft/yii2-jui',



Otherwise it will not work. When you install an extension via composer, extensions.php is automatically updated for you, which is a lot easier in the long run than trying to keep track of it manually.