使用Vagrant + Symfony应用程序在PHPStorm中打开文件

时间:2016-05-30 12:52:12

标签: symfony phpstorm

我知道你可以在project/app/config.yml中使用它来打开Symfony探查器或异常文件链接中的文件:

framework:
    ide: "phpstorm://open?file=%%f&line=%%l"

更多信息:http://developer.happyr.com/open-files-in-phpstorm-from-you-symfony-application

但是当我使用vagrant时,服务器的文件路径与我的主机不匹配。

我在PHPStorm中使用propper路径映射创建了一个PHP Web应用程序服务器,但仍然无效。

有什么想法吗?

由于

3 个答案:

答案 0 :(得分:2)

在容器或虚拟机中运行应用程序时,您可以通过更改其前缀告诉Symfony将来自guest虚拟机的文件映射到主机。应在URL模板的末尾指定此地图,使用&和>作为客户到主机的分隔符:

// /path/to/guest/.../file will be opened
// as /path/to/host/.../file on the host
// as /path/to/host/.../file on the host
'phpstorm://%f:%l&/path/to/guest/>/path/to/host/&/foo/>/bar/&...'

Symfony FrameworkBundle Configuration - IDE

答案 1 :(得分:0)

不幸的是,杰弗里(Jeffry)给出的答案不再起作用:(。当在配置路径时,探查器抛出该事件:

ParameterNotFoundException
You have requested a non-existent parameter "f:".

我已根据SF文档This map should be specified at the end of the URL template中的这一行配置了路径,结果是:

phpstorm://open?url=file://%%f&line=%%l&/path/to/guest/>/path/to/host/

但是,它确实可以打开PHPStorm,但是phpstorm无法打开文件,所以我现在有点卡在这里。

答案 2 :(得分:0)

这解决了从Vagrant无法在PhpStorm中打开文件的问题:

phpstorm://open?file=%%f&line=%%l&/path/to/guest/>/path/to/host/

来源:https://youtrack.jetbrains.com/issue/IDEA-65879