Static PHP code analysis with Sublime Text 2
The steps below will perform static code analysis on your PHP code (make sure there are no syntax errors, etc)
Requirements: Package Control for Sublime Text
Step 1) Add a new build system
Go to Tools->Build->New Build System and paste the following in
{
"cmd": ["/usr/bin/php", "-l", "$file"]
}
Save it as whatever you want but keep it in the folder that it defaults to
Step 2) On save run the build
Press Command+shift+P -> type in install and select 'Package Control: Install Package' -> type in SublimeOnSaveBuild
Once it installs, go to Sublime Text 2 -> Preferences -> Package Settings -> SublimeOnSaveBuild -> Settings - User -> type in the following
{
"filename_filter": "\\.(php)$",
"build_on_save": 1
}
and save.
Quit and restart Sublime and every-time you save a PHP file, it will run it through the 'linter' and let you know the results.
Written by Bijan Vaez
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Php
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#