#StandWithUkraine

Quick jump from PHP errors to editor

There quite a disconnect in environment between PHP program that exists as files in file system and its product that exists as web page in browser. Browsers are not too good with files, so when PHP spits out error it is usually followed by menial lookup of the file and opening it in editor.

Seems exactly like boring task computers are supposed to be good at, right? So let’s get it simplified to one click.

Make editor respond to requests

First since browsers are best with links we need a way for editor to respond to a link.

Customize error output

Next thing is to make those PHP error messages. You can go wild with set_error_handler() or splice some JS to convert links.

Myself I use Xdebug which greatly improves error messages and has file_link_format option to customize links in them. So I have added it to my PHP configuration:

xdebug.file_link_format="http://localhost:8091?message=%f:%l"

Profit

Cick file name in error message - have file instantly opened at specific line in editor.

One of those minor improvements that make surprisingly huge difference by eliminating routine and boring mini-task.

Related Posts