These are some guidelines I came up with that we should follow to ensure consistency and readability in our codebase. This guide is a combination of other PHP style guides, Laravel expectations, and preferences. Things like function length and line length aren't required, just sometimes good to follow. Most of these rules can be setup in your editor so you don't have to worry about them.
- Use soft-tabs with a 4 space indent.
- Try to keep lines 100 characters long or less.
- Try to keep functions 10-20 lines long. Don't be afraid to break them into smaller functions, it makes code easier to understand most of the time.
- Remove all trailing whitespace on lines.
- End each file with a blank newline.
- Use spaces around operators, after commas.