Yii 2 Interview questions

Yii 2 Interview questions: YII framework?is an open-source PHP?framework?for rapidly-developing, modern Web applications. It is built around the Model-View-Controller composite pattern. Yii provides secure and professional features to create robust projects rapidly.

What is Yii 2?

It is a generic programming framework that web developers can utilize to create virtually, all types of web applications using the PHP framework. Its essence is to make sure that code is written in the simplest way possible.

What are the new features that have been introduced with YII 2?

  • Automatic generation of code
  • Errors are logged and handled automatically
  • It supports anonymous questions
  • Supports SPL classes, late static bindings, and interfaces
  • It is easier to reuse methods from various classes.

Name two differences between Yii 1 and Yii 2

  • Yii 1 uses prefix C because its classes were global namespaces. In Yii 2, classes are based on the directory structure which eliminates the need for using prefix C.
  • While Yii 1 uses PHP as a primary template language, Yii 2 is equipped with TWIG, PHP, and SMARTY to offer greater flexibility.

OpenCart Interview Questions

Name at least four benefits of using Yii 2

  • Yii 2 is based on writing simple code which means that it does not have a large learning curve
  • A large online community supports it implying that you will get ready answers when you need them.
  • It allows developers to customize their code as they wish
  • It is a high performance language.

What requirements does your system need to run Yii 2?

It must have an installation of PHP 5.4.0 or higher although PHP 7 is recommended.

What do you mean by Yii helpers?

These are classes that simplify common coding tasks like generating HTML coding.

What does active record in Yii 2 stand for?

Active record offers an object-oriented interface that helps developers to retrieve and manipulate data from a database. An active record is part of a database table that corresponds to a single row of that table.

State the difference between homeUrl and baseUrl in Yii 2

BaseUrl returns the relative UrL for the application while homeUrl is simply the URL for the homepage.

How can a flash message be set in Yii 2

In Yii 2, a flash message is used to keep messages in session even though it is requested by the same user. It can be set using the setFlash() method.

What is the purpose of GII in Yii 2?

A code generator that helps developers in creating and generating customized forms, models, and databases.