Reputation: 10664
I'm looking for a indent application to fix all aspects of PHP code formatting - convert spaces, perform indentation in PHP and HTML code, leave HEREDOC alone, etc.
Please recommend a decent indenter for PHP.
Upvotes: 5
Views: 5604
Reputation: 10664
Since originally finding solution, I've moved on to use https://styleci.io/. I am not affiliated with them, but I really like the simplicity and it keeps the project nice and tidy. Doesn't cost anything for my open-source project either.
Upvotes: 0
Reputation: 1050
Squizlabs has develop PHP_CodeSniffer, which tokenizes PHP, JavaScript and CSS files to detect and fix violations of a defined set of coding standards. It have phpcbf
cli, that ensures your code remains clean and consistent. By their definition it should satisfied your need. Consider read their wiki, for further step.
Upvotes: 0
Reputation: 10664
I have found few things. First, the best way to mass-edit files is to use bash scripting and vim.
Second, vim indentation is not perfect and is not working always. So I had to rather do "=G" manually then review the source.
Finally, vim's command "retab" in collaboration with tab settings is great if only looking to change white-spaces into tabs.
I'd like to also point towards an awesome podcasts where I learned more about Vim:
Upvotes: 3
Reputation: 6155
I'd recomment PHPStorm, its not a command-line per se, but it does allow to specify custom code formatting and apply it to multiple files
Upvotes: -1