8

I'm a new user of Sublime Text / Sublime Text 3 on OS X.

I installed the plugin SublimeLinter. I also installed xampp on my local machine.

Which should I install next for the linter to work on PHP? SublimeLinter-php or SublimeLinter-phplint? What's the difference of each plugin?

Mark
  • 125
  • 1
  • 9

2 Answers2

5

The difference lies in the linter they use: SublimeLinter-php uses php -l, SublimeLinter-phplint uses phplint.

idleberg
  • 10,319
  • 7
  • 36
  • 57
  • 3
    Ok, after hours of playing with it I finally get it. I thought they are prerequisites to each other. I guess I'll use SublimeLinter-php since I already have PHP on my local machine. Thank you! – Mark May 04 '14 at 10:20
  • @Mark - The new coders in our team were wondering about the same question as you some time ago, so we installed both SublimeLinter-php and SublimeLinter-phplint on everyone's machines to compare them. To our surprise, the two linters were very different, with SublimeLinter-phplint finding numerous errors in every file (even files that came from official sources) while SublimeLinter-php was a lot more easy-going. See more info and an example in my answer below. – TechnoCat Sep 13 '18 at 11:45
5

To supplement the answer from @idleberg above, the two linters are very different in the number and type of errors that they generate.

We installed both, and ran them side-by-side for a month. Our observations were as follows.

  • SublimeLinter-php tagged only the errors that were genuinely problematic. We found the linter useful and have continued to use it.

  • SublimeLinter-phplint, by contrast, flagged numerous errors in every file, most of which did not affect the functioning of the file. It seemed that SublimeLinter-phplint was either generating false positives or took a very prescriptive / academic perspective of php. Advanced users may benefit from the comprehensive reporting in SublimeLinter-phplint, but less advanced users are likely to find the lints overwhelming and impractical.

Here is an example. The file phpmyadmin.config.inc.php comes from https://docs.phpmyadmin.net/en/latest/config.html and is installed by default if you run brew install phpmyadmin.

SublimeLinter-php finds no fault with the file, but SublimeLinter-phplint identifies four errors - as shown in the screenshot below.

enter image description here

Bottom line: If you are fairly new to coding, start with SublimeLinter-php - it's easy to use and practical.

TechnoCat
  • 509
  • 7
  • 14