Configuring PhpStorm IDE for Yii

You are viewing revision #4 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.

next (#5) »

  1. Code completion
  2. Testing

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.

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 397 times
Version: Unknown (update)
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