Configuring PhpStorm IDE for Yii

You are viewing revision #6 of this wiki article.
This version may not be up to date with the latest version.
You may want to view the differences to the latest version or see the changes made in this revision.

« previous (#5)next (#7) »

  1. Code completion
  2. Enhanced code navigation
  3. Testing

Note: This article explains the settings for Yii 1.1. For Yii 2 there is another Wiki article.

Code completion

  1. Exclude yiilite.php from index:
    - `File → Settings → IDE Settings → File Types`.
    - `yiilite.php` to `Ignore files and folders`.
    
  2. Exclude not used directories, specify resources.
    - `File → Settings → Project settings → Directories`.
    - Mark `framework/cli/views`, `protected/runtime` and `assets` as `excluded`.
    - Mark website root as `resource root`.
    
  3. Specify path to your PHP.
    - `File → Settings → Project settings → PHP → PHP Home`.
    
  4. If your project uses common Yii framework folder you need to include it.
    • File → Settings → Project settings → PHP → PHP Home → Add.
    • Specify a path to framework directory.
  5. If you are writing unit tests you can include PHPUnit to get code completion:
    • File → Settings → Project settings → PHP → PHP Home → Add.
    • Specify a path to PHPUnit.
  • Complete code: Ctrl+Space.
  • Show method arguments: Ctrl+Q.

Enhanced code navigation

In order to be able to get from render or renderPartial to the view, from widget to widget class, from relations to model classes you need to install additional plugin called YiiStorm.

Testing

You should install PHPUnit to run unit tests.

  1. PHPUnit.
    • Follow official PHPUnit installation guide.
    • In your IDE: Run → Edit configurations.
    • Press "+".
    • Name: anything.
    • Test: depending on what do you want to test select an appropriate option. Specify path.
    • Use XML configuration file: specifying path to phpunit.xml. Often it's path_to_your_webroot/protected/tests/phpunit.xml.
  • To run tests use SHIFT+F10.
59 1
53 followers
Viewed: 154 398 times
Version: 1.1
Category: Tips
Tags: IDE, PhpStorm
Written by: samdark
Last updated by: samdark
Created on: Oct 27, 2010
Last updated: 6 years ago
Update Article

Revisions

View all history

Related Articles