Today I tried to install a new package into my Yii2 Beta application with composer. I chose the Summernote WYSIWYG editor for Yii2, and performed the necessary composer command to install. It seems to have installed correctly. The composer.json, composer.lock, and vendor/composer/installed.json all appear to have the correct updates.
My vendor/yiisoft/extensions.php file also was updated with the following array:
'zelenin/yii2-summernote-widget' =>
array (
'name' => 'zelenin/yii2-summernote-widget',
'version' => '9999999-dev',
'alias' =>
array (
'@Zelenin/yii/widgets/Summernote' => $vendorDir . '/zelenin/yii2-summernote-widget',
),
),
When I try to use this Summernote.php class, I get a class not found error. My view file mainly looks like this:
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use common\models\Post;
use Zelenin\yii\widgets\Summernote;
?>
<div>
<?php $form = ActiveForm::begin([
'id' => 'post-form',
'options' => ['class' => 'form-horizontal']
]); ?>
<?= $form->field($post, 'status')->radioList(
array(
Post::STATUS_DRAFT => 'Draft',
Post::STATUS_PUBLISHED => 'Published'
)
); ?>
<?= $form->field($post, 'title'); ?>
<?= $form->field($post, 'shortname'); ?>
<?= $form->field($post, 'body')->widget(Summernote::className(), []) ?>
<?= $form->field($post, 'category_id')->dropDownList($categories); ?>
<?= $form->field($post, 'blog_id')->dropDownList($blogs); ?>
<?= $form->field($post, 'blogger_id')->dropDownList($bloggers); ?>
<?= Html::submitButton('Submit', ['class' => 'btn btn-primary']); ?>
<?php ActiveForm::end(); ?>
</div>
Ive also tried: "use Zelenin\yii\widgets\Summernote\Summernote;" as well.
Is there something about the autoloading process that is missing this package? composer added this to my vendor/composer/autoload_psr4.php file:
'Zelenin\\yii\\widgets\\Summernote\\' => array($vendorDir . '/zelenin/yii2-summernote-widget'),
Is there something about PHP 5.4 namespacing that I am missing? Why do I always get a “class ‘Summernote’ not found” error?