Tag: beautifier

2009-08-02

Komodo Editor: PHP Code Beautifier

by Charles — Categories: PHP — Tags: , , , Leave a comment

So I’ve been playing around with Komodo Edit (the free editor available from the people who make the not-free Komodo IDE), and one thing I found missing was a code beautifier (or automatic formatting, if you prefer). It’s not a feature I use a lot, but can be really useful when importing code from someone else.

So after a bit of Googling, I found this article: PHP Code Beautifer Macro+Script. I followed the instructions to install the PEAR PHP_Beautifier package, saved the provided phpbeautifer.php script in my PHP directory, installed the macro file into the Komodo Edit “Toolbox” and edited it so that it pointed to where I’d put the PHP script (using double back-slashes for the directory separators since I’m on Windows), and it worked! All you have to do is double click the phpBeautifier icon in the Toolbox window, and it formats the currently active file.

The only change I’ve made so far is to edit the phpbeautifier.php file to remove the addfilter() instruction to insert a newline before functions, as that messed up classes with any access keywords before the function keyword. I also changed the indention to 3 spaces, and added the filter for PEAR styling.
(more…)

© 2012 PHP Musings All rights reserved - Wallow theme v0.46.4 by ([][]) TwoBeers - Powered by WordPress - Have fun!