Julien Liabeuf

Using SublimeLinter with PHP

November 29, 2013 | 1 Minute Read | 4 Comments

I lost a considerable amount of time today.

I'm completely new to Linters. I've read about it lately, and I felt dumb I didn't start using it earlier. It avoids loosing time on stupid mistakes (a forgotten coma, an extra closing parenthesis... you know!) and help keeping a cleaner code.

I use Sublime as my IDE, and I love it, mostly for its package control. It makes installing a new addons easy as a breeze, and that's how I installed SublimeLinter.

Installing SublimeLinter

Once you opened Sublime, press Ctrl+Shift+P (you must have the Package Control installed), find "Package Control: Install Package". Search for "SublimeLinter" and install.

So here I am, with SublimeLinter installed, and... well, nothing. I checked a few Youtube videos and what it does seems awesome, but it simply doesn't do anything for me. Quick Google search, nothing relevant. Actually, I ended up spending a quite a long time browsing, desperately looking for a solution.

SublimeLinter Settings

I finally found out what was wrong, and again, I felt dumb: it took me 1 minute after that to setup the plugin correctly. No more suspense, here is the missing config:

{
  "sublimelinter_executable_map":
    {
      "php": "C:\wamp\bin\php\php5.4.12\php.exe"
    },
    "sublimelinter_mark_style": "outline"
}

Note that the double backslash is mandatory on Windows.

When customizing the settings, do NOT edit the default settings, edit the user settings instead. You'll find it under Preferences > Package Settings > SublimeLinter > Settings - User.

In conclusion, here is my advice: open the default settings file for SublimeLinter and ready it carefully! It is very well documented and it would have saved me a lot of time to start with this.

4 Comments

Thanks man. you saved me!

Thanks for posting this but i’m having problem inserting the code…i actually don’t know where the code should go in the user settings because i’ve been getting errors putting it like this:

“warning_color”: “DDB700”, “wrap_find”: true { “sublimelinter”: true, “sublimelinter_executable_map”: { “php”:”/wamp/php/php.exe” } }

This doesn’t work too.

“warning_color”: “DDB700”, “wrap_find”: true { “sublimelinter”: true, “sublimelinter_executable_map”: { “php”:”C:\wamp\php\php.exe” } }

I get an error message saying: “Error trying to parse settings: Unexpected character, expected a comma or closing bracket in Packages\User\Sublime.sublime-settings:49:9”

I think the problem is that you have settings outside the brackets, which may be the source of your “Error trying to parse settings” error. Try placing all your settings inside the brackets like so:

{
  “sublimelinter”: true,
  “sublimelinter_executable_map”:
  {
    “php”:”C:\\wamp\\php\\php.exe”
   },
  “warning_color”: “DDB700”,
  “wrap_find”: true
}

Leave a Comment