Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Open files in PHPStorm with Vagrant+Symfony application

I know you can open files from Symfony profiler or exception file links using this in project/app/config.yml :

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

More info: http://developer.happyr.com/open-files-in-phpstorm-from-you-symfony-application

However as I'm using vagrant, the file path of the server doesn't match my host.

I have created a PHP web application server in PHPStorm with the propper path mappings, but still doesn't work.

Any ideas?

Thanks

like image 516
Gerard Brull Avatar asked Oct 19 '22 08:10

Gerard Brull


1 Answers

When running your app in a container or in a virtual machine, you can tell Symfony to map files from the guest to the host by changing their prefix. This map should be specified at the end of the URL template, using & and > as guest-to-host separators:

// /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

like image 147
Jeffrey Avatar answered Oct 21 '22 04:10

Jeffrey