Anonymous Anonymous

Automatic code formatting for PHP in your editor or CVS/SVN

Monday, 28 de May del 2007
filed under , ,

PhpCodeBeautififier is a free tool for PHP programmers that formats PHP files to get a nice presentation and keeps the programmer sanity. We all programmers have our own way of representing code lines, but when the code is shared amongst many programmers it has to be formatted following some conventions.

PhpCodeBeautifier allows you to specify those patterns you'd like to follow and it will format every file for you. The idea is simple, you continue on being that little unchangeable typer and delegate the "boring" part to that tool. You can work for several companies having diferent coding standards, but you keep always programming your way, look at the exagerated non-sense sample:

Sample of phpCodeBeautifier It certainly looks better! So with that tool you and your colleagues can work each one following the personal style and when code has to be merged in the community you pass that final code through the Beautifier for getting an homogeneous code, in the way you all have agreed.

PhpCodeBeautifier is available both for Windows and Linux. In the earlier version (0.77) there is a GUI for windows in addition to the command line (though the command line is the only one I am using). That's a shot on how it might look like the pattern definition: PHPCodebeautifier So, now you are thinking. Ok, that's nice, but I have to invoke all the code through the command line/GUI every time? No, keep on using your favorite IDE and integrate it, or just call the tool directly on the versioning system (CVS/SVN). Beautifier is available under the PHPEdit editor, but as I usually work with Eclipse's PHP Development Tool I followed that simple steps to have it running under the "External Tools" (a couple images are worth thousand words): Eclipse external tools Eclipse external tools

And that's it.

Was this post interesting?

Related posts

Comentarios

I also use eclipse as IDE, but I have a problem using your configuration. If I use the same arguments eclipse prints the generated output in the console, but I want to rewrite my current file and force eclipse to reload it afterwards.

Can you give me a tip how to to this?
Yes Nils,

You only have to chek in the last screenshot the option "File" and write ${resource_loc}. That overwrites the current working file. But BEWARE! sometimes i have lost a file so I would recommend that you write somthing like ${resource_loc}_beautified to prevent file loss. I am not using this, although certainly is useful.

Leave your comment

Leave your comment
You need javascript to be activated on irder to leave comments

Login in OboLog, or create free blog if you don't have one yet.

Then we'll remember your data and show your avatar in your comments.

Sponsors

Comments

Nautilus subversion integration tool. Execute SVN commands with Gnome scripts (guillem)
Just el que estava buscant, vaig a provar-ho. :)...(12 May)
Are you addicted to all things Apple? (charlie)
sadly? i am also addicted to that dam apple brand, i currently own a from the bottom up... a 1st, 2n...(06 May)
De conferencias con una Psion 5mx (Paul Erice)
Hablando de 5mx, tengo una Ericsson 5mx (que es basicamente una Psion 5, y nunca he conseguido conec...(23 Apr)
Cómo reiniciar o resetear un ipod colgado (Carlos)
Muchas gracias. Funciona!!...(21 Apr)
Recovering space on an iphone or ipod touch (ka)
How to Login???...(08 Apr)

Login