Show pageBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ====== Yii PHP Framework ====== [[https://www.yiiframework.com/|Homepage]] ===== Gii ===== [[https://www.yiiframework.com/extension/yiisoft/yii2-gii/doc/guide/2.0/en/basic-usage|Gii]] can generate models for you. If you want to generate a model for all database tables, enter ''*'' for the database name. ===== useful extensions ===== * [[https://www.yiiframework.com/extension/yii2-migration-creator|Yii2 Migration Creator]] – automatically create migrations from existing database ==== widgets ==== * [[https://github.com/kartik-v/yii2-widgets|Krajee Yii2 Widgets]] * [[https://github.com/kartik-v/yii2-widget-select2|select2]] * [[https://github.com/wbraganca/yii2-dynamicform|Dynamic Forms]] ===== useful helpers ===== * ArrayHelper * [[https://www.yiiframework.com/doc/guide/2.0/en/helper-html|Html]] ===== Snippets ===== ==== Select2 with values from DB table ==== <code php><?php use yii\helpers\ArrayHelper; use kartik\select2\Select2; use app\models\YourModelYouWantToQuery; ?> … <?= $form->field($model, 'servicelevel_id')->widget(Select2::classname(), [ 'data' => ArrayHelper::map(YourModelYouWantToQuery::find()->all(),'servicelevel_id','servicelevel_id'), 'options' => ['placeholder' => 'Select a service level …'], 'pluginOptions' => [ 'allowClear' => true ], ]) ?> </code> ==== input type with Html helper class ==== <code php><?= Html::activeInput('number', $model, 'attribute', ['class' => 'form-control small-width', 'step' => '0.1', 'min' => '0', 'value' => $value]) ?></code> ==== always copy current vendor asset files in public dir ==== <file php AssetBundle> /** * @var array */ public $publishOptions = [ 'forceCopy' => true ];</file> ===== further reading ===== * [[https://github.com/awesome-yii/list|awesome-yii]] – curated list of Yii2 resources * [[https://yiigist.com/packages#!?framework=2&sort=-popularity|Yii Gist]] – Yii framework and extension/package catalog ==== Documentation / Tutorials ==== * [[https://www.youtube.com/playlist?list=PLRd0zhQj3CBmusDbBzFgg3H20VxLx2mkF|Yii2 Lessons]] (YouTube / DoingITeasy) * [[https://code.tutsplus.com/series/how-to-program-with-yii2--cms-725|How to Program With Yii2]] (envato tuts+) * [[https://mrphp.com.au/blog/advanced-multi-model-forms-yii2/|Advanced Multi Model Forms]] Last modified: 2024-07-05 14:31