-
Notifications
You must be signed in to change notification settings - Fork 0
Style guidelines
Laravel Pint is an automatic code formatting and styling tool developed by the Laravel community. It is designed to consistently apply a set of coding style rules to the PHP files in a project, ensuring that the code is readable, maintainable, and adheres to recommended coding standards.
Laravel Pint is based on PHP-CS-Fixer, a popular PHP code formatter, and it follows the PSR-12 (PHP Standard Recommendation 12) guidelines. This standard is widely accepted in the PHP community and defines how code should be formatted to maintain consistency and clarity.
The main rules include:
- Indentation: Use of 4 spaces for indentation.
- Line Length: Keeping lines of code to a maximum of 120 characters.
- Spacing: Spaces around operators, after commas, and around parentheses in control statements.
- Braces: Consistent placement of opening and closing braces in control statements and functions.
- Variable Names: Use of camelCase for variable and method names.
- Namespace and Imports: Consistent and ordered import of namespaces.
To format the code in the project, Laravel Pint can be run with the following command on the root of the project:
./vendor/bin/pint
Before pushing to the repository, be sure to use the corresponding Laravel pint command to follow the code style.
If you want to know more information about Laravel Pint you can access to its official documentation.