When using the pretty error page feature, whoops comes with the ability to open referenced files directly in your IDE or editor.
<?php
use Whoops\Handler\PrettyPageHandler;
$handler = new PrettyPageHandler;
$handler->setEditor('sublime');
The following editors are currently supported by default.
sublime
- Sublime Text 2emacs
- Emacstextmate
- Textmatemacvim
- MacVimxdebug
- xdebug (uses xdebug.file_link_format)
Adding your own editor is simple:
$handler->setEditor(function($file, $line) {
return "whatever://open?file=$file&line=$line";
});
You can add PhpStorm support with PhpStormOpener (Mac OS X only):
$handler->setEditor(
function ($file, $line) {
// if your development server is not local it's good to map remote files to local
$translations = array('^' . __DIR__ => '~/Development/PhpStormOpener'); // change to your path
foreach ($translations as $from => $to) {
$file = preg_replace('#' . $from . '#', $to, $file, 1);
}
return "pstorm://$file:$line";
}
);