Open files in PHPStorm from you Symfony application

Open files in PHPStorm from you Symfony application

If you want to open files in PHPStorm8 directly from the Symfony debug toolbar there is a neat trick you can use. This is very helpful when you quickly want to find a controller or when you got an exception.

// /app/config/config.yml
framework:
  ide: "phpstorm://open?file=%%f&line=%%l"

And that is pretty much it. You dont need to install PhpStormOpener, LinCastor or any other Apple script. This will work with PHPStorm8, Symfony2.6 and Mac OSX. Below is a picture to show where you should click to make PHPStorm open the controller used in this request.


PHPStorm8 Symfony debug toolbar

6 Comments

  1. Nice feature, but shouldn’t be defined in config_dev?

    Reply
    • I don’t think it really matters though. The framework.ide only sets a parameter called ‘templating.helper.code.file_link_format’ which tells what format to use. You can accomplish the same in php.ini with ‘xdebug.file_link_format’.

  2. Great trick, do you know if work on linux (Ubuntu)?

    Reply
  3. i use xdebug, so i just can use an php.ini configuration

    xdebug.file_link_format=”phpstorm://open?file=%f&line=%l”

    Reply
  4. you need to expose protocol in firefox in order for this to work:
    Type about:config into the Location Bar (address bar) and press Enter.
    Right-click -> New -> Boolean -> Name: network.protocol-handler.expose.phpstorm -> Value -> false

    then specify a phpstorm.exe file. But it does not work if you are using vagrant, as file paths are different in a VM

    Reply

Submit a Comment

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>