====== 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 ==== 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 ], ]) ?> ==== input type with Html helper class ==== 'form-control small-width', 'step' => '0.1', 'min' => '0', 'value' => $value]) ?> ==== always copy current vendor asset files in public dir ==== /** * @var array */ public $publishOptions = [ 'forceCopy' => true ]; ===== 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]]