Yii

Yii is a high performance, component-based PHP framework for rapidly developing modern Web applications. 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.

[Note]Note

Yii plugin is only available in CodeLobster IDE Professional.

CodeLobster IDE has the following abilities to work with Yii and Yii2 frameworks:

Creating a Yii project

If you have no application yet, you can generate a CodeLobster IDE project with Yii - specific structure from a template. Yii plugin has the wizard that helps you to get and install the latest official framework release.

In order to create Yii project:

  1. Choose File | New | Project... main menu item. Select Yii framework item in the opened dialog.

    or

    Select Project | Yii | Create project main menu item

  2. Define project location, name and project URL for debugging.

    [Note]Note

    If you enable Create project in a new folder option CodeLobster IDE creates a subfolder with the project name.

  3. Click the OK button.

  4. Select version of Yii and click Next button.

  5. Enable Use Database option to setup your database.

    [Note]Note

    You can skip this step and go further without creating database by clicking Finish button.

  6. Define database parameters:

    • Database name - the name of the MySQL database where your project data will be stored.

    • User name - used to connect with MySQL server.

    • User password - used to connect with MySQL server.

    • Root login - used to create a MySQL user.

    • Root password - used to create a MySQL user.

  7. Click the Next button.

  8. Specify some advanced database options:

    • Database host - specify a host name, if your database is located on a different server.

    • Database port - specify database port, if it runs on a non-standard port.

  9. Click the Finish button to create Yii project.

Yii IntelliSense

CodeLobster IDE provides IntelliSense for Yii, which helps you write code more quickly and efficiently. IntelliSense saves you time by putting what you’re most likely to use at the top of your completion list. The suggestion list of the automatic completion appears as soon as you start typing. Pressing Tab or Enter will insert the selected item. You can trigger IntelliSense in the Editor window by pressing Ctrl + Space or using Edit | IntelliSense | Autocomplete main menu item.

IntelliSense suggestion box includes path aliases: system, zii, application, webroot, ext.

IntelliSense also supports autocomplete for functions from CMyBehavior class as well.

After attaching a behavior: $component->attachBehavior('id', new CMyBehavior()); suggestion list will show functions from CMyBehavior class.

Yii Controller/View navigation

CodeLobster IDE can quickly switch between Controllers and Views in the Editor when developing. You can navigate from Template (/views/...) and Action (/controllers/...).

When you inside a Controller press Alt + O (or select Edit | Go to corresponding file main menu item) to jump to the corresponded View.

For example, you can jump from SiteController::actionIndex() to views\site\index.php file.

Tooltips for Yii

Hover mouse for tooltips that includes descriptions for Yii functions. Tooltips appear automatically when you hover the pointer over a function or some other element.

Yii context and dynamic help

The Dynamic Help window allows opening help topics automatically for an element when the pointer is placed on. Yii plugin uses the http://www.yiiframework.com/ for a quick search for relevant information.

To get help topics using Dynamic Help:

  • Place the pointer on the target element and press the F1 button.

  • Select Help | Context Help main menu item.

  • Click the topic item in the Dynamic Help window.

    [Tip]Tip

    To show Dynamic Help select View | Panels | Dynamic Help main menu item.