欢迎各位兄弟 发布技术文章

这里的技术是共享的

You are here

phpstorm framework mvc structure support looks like framework yii is used in project Configuring PhpStorm IDE for Yii

shiping1 的头像

  
取消掉后 应该速度变快点 不用一直indexing了

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/viewsprotected/runtimeand 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, fromrelations 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'spath_to_your_webroot/protected/tests/phpunit.xml.
  • To run tests use SHIFT+F10.
来自 http://www.yiiframework.com/wiki/92/configuring-phpstorm-ide-for-yii/

 icultivator  2013-11-14 13:42:03  4504次浏览  1条评论  2 0 0

原文链接:http://www.icultivator.com/p/524.html

配置

  1. 从索引中排除 yiilite.php :
    • File → Settings → IDE Settings → File Types .
    • yiilite.php to Ignore files and folders .

排除yiilite.php

  1. 排除不使用的文件夹以及设定特定的资源根目录.
    • File → Settings → Project settings → Directories .
    • Mark framework/cli/views , protected/runtime and assets as excluded .
    • Mark website root as resource root .

设置根目录

  1. 设置你的PHP的路径.
    • File → Settings → Project settings → PHP → PHP Home .
  2. 如果你的项目使用的是公用的Yii框架文件夹那么你需要包含这个:
    • File → Settings → Project settings → PHP → PHP Home → Add .
    • Specify a path to framework directory.

设置PHP和Yii的路径

  1. 如果你正在写单元测试那么你可以包含PHPUnit以获取提示代码(和上面一样添加路径):
    • File → Settings → Project settings → PHP → PHP Home → Add .
    • Specify a path to PHPUnit.
  • 自动完成代码快捷键: Ctrl+Space .(注意中文拼音输入法的快捷键很多也是这个,注意修改以区别)
  • 显示函数参数快捷键: Ctrl+Q .

测试

你需要安装 PHPUnit 来运行这些测试.

  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 .
  • 运行测试使用 SHIFT+F10 快捷键.

OK,现在这样就可以简单的支持yii framework了。

最新的phpstorm能智能识别yii的framework:

当用yiic创建的项目以后,需要手工做一些设置

File, Settings(mac下是phpstorm,preference),Project Setting ,Directories

标记当前项目的protected/runtime, assets为excluded
标记工程项目的根目录为resource root

点击Add Content Root,把yii框架的路径添加进来,标记cli/views目录为excluded

另外,需要排除yiilite.php,否则会补全多次,File,Settings,File Types,右下角的ignore files里面添加yiilite.php

注:本文转自 http://www.icultivator.com/p/524.html


来自 http://www.yiichina.com/tutorial/41


普通分类: