Php_PhpStorm_IDE_Yii_customize_让phpstorm支持Yii

Php_PhpStorm_IDE_Yii_customize_让phpstorm支持Yii

 

提示: 最新的版本已经有yii的插件了,但目前这个插件还是有很多问题。不过,有总比没有强了,否则每个项目都得自己配置一遍。

 

--官方

http://www.yiiframework.com/wiki/92/configuring-phpstorm-ide-for-yii

最好仔细看看注释,有很多新解的!

--中文翻译:

http://www.neatstudio.com/archives/?article-1801.html

 

如果到facebook上关注一下yii framework的群组,会发现有人在介绍yiicookbook.org,里面是一本关于1.1的书。
然后去yii framework官方上搜索一下phpstorm,会发现同一个人在说自己用phpstorm,问phpstorm有没有什么支持。结果官网说暂时好象不支持。。。
然后再搜索了一下,发现在yii的官网有一个简单的例子在说如何让项目支持yii framework。看了一下,发现,大多数都用过,只有第一点,说是把yiilite.php过滤掉。这个其实很重要了,否则有些变量就会出现提示两次。
OK,来看官网的wiki吧:http://www.yiiframework.com/wiki/92/configuring-phpstorm-ide-for-yii

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 .
OK,现在这样就可以简单的支持yii framework了。只是phpstorm还是有点小问题,因为提示的时候不会显示phpdoc的信息。纠结,啥时候会有doc的提示呢?
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值