Tuesday, September 9, 2014

PHP Tools

PHP tools

So now we now a linux mint virtual machine with php. So we can start coding in php. But it is not easy to code in vi. So I have searched on what will be a nice IDE for PHP. Can I recoment SublimeText. As of writing SublimeText 3 is currently in beta testing. But I find it stable enough to use.



So for this post, let me run through the installation of SublimeText3 and a couple of nice plugins for it.

SublimeText3



Go to SublimeText3 download page and click on the Ubuntu 64 bit link. A pop up will appear and click on save file. Once it is done, double click on the downloaded deb file. The package installer window.



Click on the Close button and then the Install Package button. This will then ask you to just enter your password again. This will then start the installation.Click on close after the installation. You can now close the package installer. You can now find SublimeText3 under Programming Menu






Now open up SublimeText3 and we can start installing some plugins.


Plugins



First off, we need to install Package Control . Package Control is your easy way to install and update SublimeText packages. There are tons of packages that you can install for SublimeText that does different things.



You can go to Installation page. In this page, you can find the command that will be used to install Package Control. You will have to copy the the SublimeText 3 version of the command.

Now go back to SublimeText3 and click View -> Show Console. And then paste the copied text to the console.



Now its time to download more plugins.



First off, may I suggest SublimeCodeIntel. This will help in in code completion and function look up. I find it a bit flaky at times, but when it works, it works like a charm.

To install click on Preferences - Package Control. Type Install Package. Then type SublimeCodeIntel. After installation, you should restart SublimeText3. I highly recommend updating the user settings. To do so click on Preferences -> Package Settings -> SublimeCodeIntel -> Settings - User.




This will open up a blank file. In this file, paste this :


 {"PHP": {
            "phpExtraPaths": [],
            "codeintel_scan_files_in_project": true,
            "codeintel_max_recursive_dir_depth": 5
        }
 }



Next up is a syntax checker. This will be a couple of steps process. First among the packages that we need to install for syntax checking is SublimeLinter.  To install, go to Preferences -> Package Control. Type Install Package. Type in SublimeLinter and select SublimeLinter. This will install the package. I again recommend to restart SublimeText3 after the installation.



SublimeLinter won't work as is, it needs the linter package for our development tool of choice. For me I installed SublimeLinter-php. To install, go to Preferences -> Package Control. Type Install Package. Type in SublimeLinter-php and select it. I may sound like a broken record at this point, but, restart SublimeText3.



Some of the important shortcuts to remember are :

ctrl+k, l :  Lint the current view.
ctrl+k, n : Go to the next error.
ctrl+k, p : Go to previous error
ctrl+k, a :  Show all errors.


Now we are ready to go to Selenium.