Sublime Text 2 perfect PHP development set-up

Posted by Peter
tags: git php sublime text sublime text 2 zend framework

Update: There is also available plugins list for Sublime Text 3, check it out here

Lately, I’ve become a huge fun of Sublime Text 2, which in my humble opinion (OK, not only mine, take a look in here Poll Roundup 2: The controversial questions")) is best text editor/IDE I’ve ever used.

I called it IDE (Integrated Development Environment) which isn’t really true yet, but it’s getting awfully close to become one.

Sublime Text 2 is great on its own, but it really starts to kick ass with help of addons called ‘packages’. You can look for them on Internet or browse on wbondwebsite.

OK, but getting to the point: I use ST2 for some time now for PHP development and I tried almost all packages I came across which are even slightly related to my job. In order to get most of them (except one or two) you’ll need wbond’s Sublime Package Control. Ok, really you CAN install all of them manually, but what’s the point of re-inventing the wheel? I’ll stick with the easy way if you don’t mind ;)

And here is my list, enjoy and maybe throw a suggestion or two if you know something I don’t know ;)

  1. SublimeCodeIntel (https://github.com/Kronuz/SublimeCodeIntel) This is package I use all the time. It’s job is to provide hints related to function, object, variable etc. names. It also hints what methods and parameters are available in objects/classes. It’s based on Komodo CodeIntel and sometimes it has some problems working at all. But most of the time it rocks :)

  2. SublimeLinter (https://github.com/SublimeLinter/SublimeLinter) This package does full-time job for me - it constantly watches what I write and instantly lets me know if something is not OK, for example I forget semi-colon or brackets.

  3. SFTP, paid (http://wbond.net/sublime_packages/sftp) Great package enabling very comfortable use of SFTP, FTP and FTPS. It supports remote folders browsing, editing and synchronization between local and remote files. Also regular upload, download pn save or file open.

  4. SideBarGit (https://github.com/SublimeText/SideBarGit) I use Git on daily basis and having an easy and comfortable GUI is essential. This is what this package does - it provides set of most often used functions and integrates it with ST2 via right-click menu.

  5. Tortoise (on Windows only) (http://wbond.net/sublime_packages/tortoise) I use it as a complementary package to SideBarGit if I’m working in Windows environment. It doesn’t have so many features but those what it provide are very helpfull and intuitive. If you like Tortoise Git but you are working on Linux you might want to check out RabbitVCS. It isn’t integrated with ST2, but it provides comfortable right-mouse-click Git GUI.

  6. sublime-github (https://github.com/bgreenlee/sublime-github) Every developer should use code snippets of some kind. I use Gist provided by GitHub and this package enables me to use them instantly (save/paste).

  7. Tag (https://github.com/SublimeText/Tag) Great package, which simply takes care of all tag-matching related issues. Love it :)

  8. DocBlockr (https://github.com/spadgos/sublime-jsdocs) Nobody likes it, at least nobody I know, but as a developer you have to maintain solid code documentation. This is where this package helps - it prepares DocBlock comments for classes, params, methods etc. Speeds up things.

  9. Phpcs (http://soulbroken.co.uk/code/sublimephpcs) This package adds support for PHPCodeSniffer to ST2. It checks if you code is written according to one of the standards. Just pick one: Zend, PEAR.. and more :) Check out PHPCodeSniffer website for configuration details.

  10. TrailingSpaces (https://github.com/SublimeText/TrailingSpaces) Small horror of every code - empty spaces at lines ends, at the end of file. Especially troublesome if you are working on the code with other developers, who might use different editors/IDEs which might interpret them (empty spaces) differently.

  11. BracketHighlighter (https://github.com/facelessuser/BracketHighlighter) One of my favorites: clearly highlights matching brackets, quotes etc. Just makes everyday life easier when looking at code with multiple brackets-in-brackets constructions.

  12. DetectSyntax (https://github.com/phillipkoebbe/DetectSyntax) Detects syntax of opened file. ST2 doesn’t always get it right and this packages helps.

  13. EncodingHelper (https://github.com/SublimeText/EncodingHelper) Detects and displays file encoding and sticks to it. Helpful in shared development environment if someone uses for example IDE with default windows encoding instead of UTF-8.

  14. Sublime Function Name Display (https://github.com/akrabat/SublimeFunctionNameDisplay) Displays in bottom bar name of a function (or method) in which our cursor is placed. Simple and helpful.

  15. Terminal (http://wbond.net/sublime_packages/terminal) Using Git or maybe some PEAR packages you might need to switch to console from time to time and do some magic. Maybe use Zend Tool or “bake” something ;) It’s just what this plugin is for.

  16. Xdebug (https://github.com/Kindari/SublimeXdebug) Last but not least - power of Xdebug in ST2. It brings Xdebug capabilities to ST2 and enables debugging as most of “big” IDEs can do.

Few packages I use but don’t consider essential:

  1. Color Highlighter (https://github.com/Monnoroch/ColorHighlighter) When you move your cursor on color definition (hex, for example) it highlights text with this color. helpful when writing CSS.

  2. ColorPicker (https://github.com/weslly/ColorPicker) Graphical color picker. Doesn’t really need explanation, doesn’t it?

  3. Prefixr (http://wbond.net/sublime_packages/prefixr) This one is nice and I would probably make more use of it if I were developing more CSS :)

  4. All Autocomplete (https://github.com/iamnoah/Autocomplete-All) Enhances ST2 ability to autocomplete by increasing scope to all opened files, not only one we are currently in.

  5. ApacheConf.tmbundle (https://github.com/colinta/ApacheConf.tmLanguage) Language definitions for Apache conf and .htaccess files.

  6. Zend-Framework.tmbundle (https://github.com/ybits/Zend-Framework.tmbundle) Code snippets for developing in Zend Framework. Although I do use ZF I never started to make use of these snippets, at least not of their full potential.

  7. Additional PHP Snippets (https://github.com/stuartherbert/sublime-phpsnippets) Same here as with Zend Framework snippets. I might some day start to use more of them. There are also packages for Wordpress, Emmet (previous name: ZenCoding) or one moving SemiColon out of brackets and many more, but I’m doing all right without them.

Yousuf mentioned in comments that Emmet (https://github.com/sergeche/emmet-sublime) is worth mentioning. It does great job speeding up generation of HTML tags and more! If you are more of a frontend developer than backend, you will most likely greatly appreciate it.