在 Eclipse 中为不同的 PECL 扩展启用 PHP 代码辅助
我在 PHP 环境中使用了一些 PECL 安装的扩展。我正在使用 Eclipse 进行开发,如果 Eclipse 对这些扩展的代码辅助/自动完成支持非常有用。此过程对于 Solr 扩展效果非常好:
- 我还下载了最新的 solr-php PECL 源 并将它们放入单独的文件夹中。
- 我将此特定文件夹作为“外部文件夹”添加到我的用户库之一(首选项 -> PHP -> PHP 库)。
- 我将用户库添加到项目的 php 包含路径中(属性 -> PHP 包含路径 -> 库 -> 添加库),
- 我立即在编辑器的自动完成中获得了新的类/方法。
问题是:这似乎并不适用于所有扩展。例如扩展向 PHP 添加 MongoDB 支持。这是为什么?
比较文件夹的内容,我注意到 Mongo 扩展缺少一个 php 文件,如 docs/documentation.php(包含在 Solr 扩展中)。而所有相关的 *.h 和 *.c 文件均可用。
我必须自己生成某些文件吗?
预先感谢您的提示,干杯!
I'm using a few PECL installed extensions in my PHP environment. I am developing with Eclipse and it would be useful to have Eclipse's code assist / auto-completion support for these extensions. This procedure worked quite well for the Solr extension:
- I additionally downloaded the latest solr-php PECL sources and put them into a separate folder.
- I added this certain folder as an "external folder" to one of my User Libs (Prefrences -> PHP -> PHP Libraries).
- I added the user lib to my project's php include path (Properties -> PHP Include Path -> Libraries -> Add Library)
- I immediately had the new classes/methods available in the editor's auto-completion.
The problem is: This doesn't seem to work for all extensions. E. g. for the extension adding MongoDB support to PHP. Why is that?
Comparing the folders' contents I notice that the Mongo extension is missing a php file like docs/documentation.php (which is contained in the Solr extension). Whereas all relevant *.h and *.c files are available.
Do I have to generate certain file(s) by myself?
Thanks in advance for your hints, cheers!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
嗯...可能使用源代码而不是 *.php 类?
或者只是 mongo 没有像 Solr 那样好的 *.php 片段。
我认为它不应该......
据我了解 - 它是某种扩展,默认情况下不与 PHP 捆绑在一起,所以我们没有这么好的东西,就像某些 php.core 一样,当我们点击
realpath
。我建议在这里向 mongo 团队添加一些错误,也许可以通过一些补丁来修复它,这将类似于 solr 解决方案。是的——您应该自己添加。 Ecl 使用 *.php 文件来完成 PHP 中的操作。 *.h& *.c 在这里没有帮助。
Hmm... May be using sources instead of *.php classes?
Or just mongo don`t have such good piece of *.php, like in Solr.
And I think it shouldn`t have...
As I understand -- it's somekind of extension, which is not bundled with PHP by default, so then we don't have such a nice stuff, like for some php.core, when we click on
realpath
.I suggest here to add some bug to mongo team and maybe to fix it by some patch, that will be analog of the solr solution. Yes -- you should add it by yourself. Ecl works with *.php files for compeletion in PHP. *.h & *.c will not helps here.
在 mongodb 的用户组发布问题后,我得到了一个包含 mongo php 驱动程序的 *.php 文档文件的链接,该链接在将它们包含在我的 eclipse/pdt 环境中后解决了我的问题。
A generate.php 脚本由 pdt 项目提供,新链接由下面的 @ss333 给出。
After posting the question at mongodb's user group I got a link containing *.php doc files for the mongo php driver, which solved my problem after including them in my eclipse/pdt environment.
A generate.php script is offered by the pdt project, the new link was given by @ss333 below.