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.

1
  • "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. Oct 25, 2019 at 6:18

1 Answer 1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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