Skip to content

Instantly share code, notes, and snippets.

@hongster
Created December 19, 2014 01:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hongster/34593171f8d632e8fec0 to your computer and use it in GitHub Desktop.
Save hongster/34593171f8d632e8fec0 to your computer and use it in GitHub Desktop.
PHP Syntax Check In Sublime Text 2
/**
* Create a custom [build system](http://bit.ly/17IKkU9) to provide PHP syntax checking.
* Save this file as ~/.config/sublime-text-2/Packages/User/PHP.sublime-build
*
* Usage
* - In the editor, select a tab with PHP source code.
* - Press F7 or CTRL + B to run PHP syntax check.
* - The status will be be displayed in the console at the bottom.
* - If it shows error, press F4, and the editor cursor will be brought to the relevant line in the source code.
*/
{
"cmd": ["/usr/bin/php", "-l", "$file"],
"file_regex": "^PHP Parse error: .+ in (\\S+) on line (\\d+)",
"line_regex": "^PHP Parse error: .+ in \\S+ on line (\\d+)",
"selector": "source.php"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment