IDE Integration

Since ^1.10 version of PhpInsights, you can add links to files in PhpInsights output.

Prerequisite & Troubleshouting

Links in terminal work thanks to symfony/console from 4.3 version. Be sure you are using this version with composer info symfony/console.

If your terminal does not support hyperlinks, they will be rendered as normal and non-clickable text.

That's why it's recommended to check out the list of terminal emulators that support hyperlinks.

Configuration

In your phpinsights.php file, add the config 'ide' => 'myide'.

For example:

<?php

return [
    // ...
    'ide' => 'vscode',
    // ...
];

Supported IDE

You can fill ide config with the followings values:

  • phpstorm
  • sublime
  • textmate
  • macvim
  • emacs
  • atom
  • vscode

About PhpStorm

The phpstorm option is supported natively by PhpStorm on MacOS.

Windows requires PhpStormProtocol and Linux requires phpstorm-url-handler.

You may also have to enable the command-line launcher.

Unsupported IDE

If you use another editor, the expected configuration value is a URL template that contains an %f placeholder where the file path is expected and %l placeholder for the line number.

For example:

<?php

return [
    // ...
    'ide' => 'myide://open?url=file://%f&line=%l',
    // ...
];