MacDada
MacDada

Reputation: 2021

Symfony's framework.ide config for PhpStorm and Vagrant

How do I set up framework.ide config value so that it properly links to files in PhpStorm, when the code is run from Vagrant?

I've tried phpstorm://open?file=%%f&line=%%l

but it gives me Vagrant paths, like: phpstorm://open?file=/vagrant/src/AppBundle/Controller/DefaultController.php&line=27

while I should be getting host paths, like: phpstorm://open?file=/Volumes/my_project_volume/project_name/src/AppBundle/Controller/DefaultController.php&line=27

I guess the solution would be to somehow configure path mapping, either in Symfony or in PhpStorm.

Upvotes: 2

Views: 1589

Answers (3)

Rvanlaak
Rvanlaak

Reputation: 3085

When working with Docker and with Mac, and your project is hosted in your user folder, the configuration has to slightly get changed as well.

framework:
    ide: 'phpstorm://open?file=%%f&line=%%l&/app/>/Users/your-username/PhpstormProjects/your-project-folder/'

Please note that

  • /app/ is the path inside the Docker container,
  • using ~/PhpstormProjects as alias to the home directory is something PHPStorm does not seem to support

Upvotes: 1

WiR3D
WiR3D

Reputation: 1691

For a project relative directory:

framework:
    ide: 'phpstorm://open?url=file://%%f&line=%%l&/path/in/server>%kernel.project_dir%'

Upvotes: 1

Rafał Mnich
Rafał Mnich

Reputation: 546

Regarding symfony's official documentation: https://symfony.com/doc/current/reference/configuration/framework.html#ide

you can use (from symfony 3.2) something like this:

ide: 'phpstorm://open?file=%%f&line=%%l&/path/on/vagrant>/your/local/path/'

Upvotes: 3

Related Questions