phpindent is a source code indenter for PHP, written in Perl. It's more a proof of concept than anything - it does not really work as one would expect.


Fetch the source or marvel at the syntax highlighted version


phpindent is licensed under the GNU General Public License version 2 as published by the Free Software Foundation or at your option any later version.


Q: Does it work?

A: Probably not. Really.

Q: So why did you write it?

A: It was an ad hoc quick hack which went out of control but was real fun.

Q: So are there any real php indenters?

A: We didn't find any which is why we tried this nonsense at all. If you find any just let us know and we will link to them.

Q: Will you improve this indenter/fix bugs I report?

A: Probably not. But if you happen to have lots of time we would welcome a patch or two.

Q: You know your grammar sucks?

A: yepp.

Bugs and Caveats

  • It might corrupt your code
  • It might not even work at all
  • It does not understand all of php
  • It only parses one block of <? .. ?>
  • It's damn slow (several hours for one of our 800 line examples on a gHz CPU)
  • But it was fun to write and merely to test out Parse::RecDescent

Mon May 20 15:01:47 CEST 2002