Skip to content
Mark Sch edited this page Jan 19, 2018 · 6 revisions

Setup for Linux (Mint)

First test if your PHPStorm version can open files via CLI. For that you just find your path to the installed PHPStorm folder and try to open a file on a specific line:

/locale/path/to/PhpStorm/bin/phpstorm.sh --line {line} {filepath}

It should jump to your IDE and open exactly that line.

Note that the file path has to be an absolute path on your host system (not inside any VM).

Create a handler file

This will serve the incoming browser click and execute the above sh script.

#!/usr/bin/env bash
# PhpStorm URL Handler
#
# phpstorm://open?file=@file&line=@line
# Adapted from https://github.com/sanduhrs/phpstorm-url-handler
#
# @license GPL
# @author Stefan Auditor <stefan.auditor@erdfisch.de>
arg=${1}
# Get the file path.
file=$(echo "${arg}" | sed -r 's/.*file=(.*)&line=.*/\1/')
# Get the line number.
line=$(echo "${arg}" | sed -r 's/.*file=.*&line=(.*)/\1/')
/locale/path/to/PhpStorm/bin/phpstorm.sh --line "${line}" "${file}"

Important for Firefox is, that you enable the the phpstorm:// protocol via about:config. To enable the PHPStorm protocol, add a new boolean value for network.protocol-handler.expose.phpstorm and keep the default value false.

Note: you can also use /usr/bin/env pstorm instead of the sh file (or even /usr/bin/env phpstorm on older IDE versions).

Setup for Ubuntu/Linux

(who wants to do that?)

Setup for Windows

(who wants to do that?)

Setup for MacOS

(who wants to do that?)

Clone this wiki locally