You are developing with PHP 5 and you’ve got the free Zend Server Community Edition on OS X installed? Now you want more, you want a great IDE for free too? Sure the newly released Zend Studio 7 looks nice, but it’s not cheap. Luckily it’s based on Eclipse PDT 2.1, and this one is free. Of course there’s some things missing when you get stuff for free, like PHPUnit Integration and Zend Framework integration.
The good thing about Eclipse is that it can be customized easily to work with external tools. Making it really easy to add features to your editor. Let’s see an example:
PHP_CodeSniffer
PHP CodeSniffer is a tool that analyze your code and give you error and warning about what to change in it to make it standard compliant. It is a great learning to as it force you to understand, and it doesn’t make any change to your source code.
If you have installed Zend Server CE, PEAR will be already installed and ready to go. It should be the latest version, but you may want to make sure by running
/usr/local/zend/bin/pear channel-update pear.php.net
/usr/local/zend/bin/pear upgrade pear
Now you can install PHP_CodeSniffer:
sudo /usr/local/zend/bin/pear install --alldeps PHP_CodeSniffer
The external tool can be added from this menu entry:
menu > Run > External Tools > Open External Tools Dialog...
Select ‘Program’ and press the ‘New’ button to create a configuration.
name: PHP_CodeSniffer
main > Location: /usr/local/zend/bin/phpcs
main > Arguments: --standard=PEAR "${resource_loc}"
Common > check the 'Allocate Console'
The last step is to add this tool to your ‘External Tools Favorites’ by selecting
menu > Run > External Tools > Organize Favorites...
Click add and then choose you PHP_CodeSniffer tool. Now it should be available in the Run > External Tools menu, and in the corresponding icon in the toolbar (green circle with a white triangle in it, and a suitcase).
Setting up an external tools could be more user friendly, but keep in mind that your gonna do this configuration only once, as you will be able to launch it with a single click once configured.
Sky is the limit
This was just a simple example with PHP_CodeSniffer, but it can easily be applied to your zf.php script if you’re into the Zend Framework, or the phpunit or doctrine command, or anything you can think of.



RSS Feed