PHP reformat/indent/unobfuscate from shell

I’ve been Googling for an hour or so now, and every PHP "pretty printer" slash reformatter slash indenter is either junk or GUI-based.

I need something that actually works from the shell. If you have actual experience with such a beast, pleast post. I need to unravel some obfuscated PHP, and there’s like 20 files.

I have no idea what you’re trying to do… thus no way to try to help

I need a way to turn

line; line; for (loop) { command; command; } line;

into

line;
line;
for (loop) {
    command;
    command;
}
line;

I have some obfuscated code that I need unobfuscated.

Is it "obfuscated" because it’s just not properly indented with line breaks and all that?

Or is actually obfuscated where functions, variables, and the like all have meaningless or unintuitive names, like "var07FD" or "func0AQ" and all strings are generated either dynamically or by using a series of Chr() (and similar) calls, or nested encoding?

Because obviously the former is a lot easier to manage than the latter. You can find plenty of web-based solutions to handle that. The latter needs to cater specifically to the obfuscation, so it generally needs to be custom-built, unless the programmer used a stock obfuscater, then it’s just a matter of finding its complementary deobfuscator (which may or may not be readily available by the creator of the obfuscator).

Is it "obfuscated" because it’s just not properly indented with line breaks and all that?

Or is actually obfuscated where functions, variables, and the like all have meaningless or unintuitive names, like "var07FD" or "func0AQ" and all strings are generated either dynamically or by using a series of Chr() (and similar) calls, or nested encoding?

Because obviously the former is a lot easier to manage than the latter. You can find plenty of web-based solutions to handle that. The latter needs to cater specifically to the obfuscation, so it generally needs to be custom-built, unless the programmer used a stock obfuscater, then it’s just a matter of finding its complementary deobfuscator (which may or may not be readily available by the creator of the obfuscator).

It’s actually obfuscated with meaningless variable names and the whole shebang, but I’d like a PHP formatter for general use as well.

I know there are online formatters, but I’m looking for something I can do bulk operations with instead of one-off page loads where my code could potentially be saved on someone else’s server.