If you like vim you can invoke its action from the command-line.
echo -e "G=gg\n:wq\n" | vim ./myfile.php
Warning the above command will modify your file without prompting. Do a backup before.
It's possible to find examples integrated with find
to accomplish the same work on a bunch of files [0].
Looking beyond it's possible to find a lot of utilities build for this, and this number will continue to grow in time; you can search for their updated versions on internet and you can start for example from:
- Artistic Style [1],
astyle
, for C, C++, C++/CLI, Objective‑C, C# and Java programming languages. tidy
[2] for Html- IDE solutions invoked by command line starting from
kate
[3] for which there exists just made plug-in; you can built your own indentation scripts [4] too, continuing withUniversalIndentGUI
[5],eclipse
[5]...