1

I want a library that can format my code: indentation, line breaks, how to open and close functions, spaces, etc.

We have a team, 5 people, working on the same project, and while some really take care of code formatting, others seems like never heard about organizing code in life.

The project is developed in Laravel, so I have composer easily available. I am looking for a library or some plugin I can install in the project (we use different IDEs, although we are using Docker) that will format our code, on saving or even by manually running some command. Something like what ESLint + Prettier does for javascript.

I found some, like PHP_CodeSniffer and PHP-CS-Fixer, but none of them solves all my problems. Don't know if I'm not being able to configure it correctly or if they are not what I am looking for.

  • "we use different IDEs" - a very bad idea. Everyone should use the same toolchain. Even if only because it makes it easier to sit at someone's desk and help him. – Mawg says reinstate Monica Oct 25 '19 at 6:18
1

Just about any IDE and some complex text editors (Geany, possibly Notepad++ and VS Code and others) should have code formatting options. And most that do will have that be configurable in some way to define just how to format a given language (just like syntax high-lighting).

Since you are separate devs using separate IDEs the challenge will simply be agreeing on a format and configuring each editor so that things come out identical.

I would instead recommend selecting a single IDE that you all will use, and then just use the default code formatting option/tool.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.