Questions tagged [yii2]

Yii 2 is the latest version of the Yii framework - a high-performance, component-based PHP framework

Yii Framework

Yii is a generic Web programming framework, meaning that it can be used for developing all kinds of Web applications using PHP. Because of its component-based architecture and sophisticated caching support, it is especially suitable for developing large-scale applications such as portals, forums, content management systems (CMS), e-commerce projects, RESTful Web services, and so on.

Yii 2.0 is the current version of the Yii PHP framework, released on October 12, 2014. The latest version can be downloaded from the Yii website. Guidelines on how to upgrade minor Yii 2.0 version and changelog can be found here.

Yii 2.0 is a complete rewrite of Yii 1.1 based on PHP 5.4 improvements and aims for simplicity, performance and extensibility. The framework adopts namespaces and traits, PSR standards, , and . Yii 2.0 implements the dependency injection container and service locator. It makes the applications built with Yii more customizable and testable.

Official documentation can be found in the Definitive Guide to Yii 2.0. Further important documentation sources:

More information on the current project status can be found in the Yii 2.0 release announcement and the project roadmap.

15456 questions
18
votes
8 answers

How to get user role in Yii2?

How to get user role in Yii2? I searched and read Yii2 guide but I didn't find any solution.
b24
  • 2,425
  • 6
  • 30
  • 51
18
votes
1 answer

Setting up preview of Yii2

The Yii2 preview was recently released and is available on github. I want to take it for a test drive, but the "documentation" so far gets outdated almost instantly since it is still under heavy development. I have tried to follow this guide on…
Brett Gregson
  • 5,867
  • 3
  • 42
  • 60
17
votes
9 answers

SQLSTATE[HY000] [2002] No such file or directory in yii2

I use ubuntu 16.04. PHP Version 7.0.4-7ubuntu2. Apache/2.4.18 (Ubuntu) . PHP extension: mysqli (in phpmyadmin Written). I got Upgrade my ubuntu from 15.10 to 16.04 and I have this error: My project correctly run in my server but I can't run that in…
Saltern
  • 1,305
  • 2
  • 16
  • 42
17
votes
2 answers

How to add class to form-group div of ActiveField in YII2?

I have some code below: field($model, 'phone_no')->textInput( [ 'placeholder' => '(Conditionally validated based on checkbox above, groovy!)' ] ) ?> Which results in HTML:
gvanto
  • 1,936
  • 3
  • 21
  • 26
17
votes
1 answer

Yii2: updateAll with multi conditions

How to update all records by my condition? (my code is not work) $condition[] = ['>', 'position', $old_position]; $condition[] = ['<=', 'position', $new_position]; $condition[] = ['in', 'id', $ids]; Video::updateAll([ 'position' => new…
Hett
  • 3,484
  • 2
  • 34
  • 51
17
votes
3 answers

Yii2 - How to include external js and css in view file

I am trying to include my plugins and custom js files in frontend/views/layouts/main.php So I used this code for js and css