Description
Laravel Pint is a code-style fixer that’s included with the latest version of the Laravel framework by default.
To run Pint use the following command while the current directory is set to an existing Laravel framework.
./vendor/bin/pint
To make the command easier to type up I created an alias that I would use.
alias pint="./vendor/bin/pint"
Running the Pint command will automatically go through the Laravel project and apply fixes to the files.
Coding Standards
No configuration is needed as the coding standard set up for Laravel Pint by default is Laravel.
The coding standards supported by Pint are Laravel, PER, PSR-12, and Symfony.
Also, coding rules can be changed but again not needed as default rules will be set up already.
Commands
To apply code style changes.
./vendor/bin/pint
# OR
pint
To apply code style changes and output changes to the terminal add a -v flag.
./vendor/bin/pint -v
# OR
pint -v
To check and view files that fail the code style check.
./vendor/bin/pint --test
# OR
pint --test
To apply changes to uncommitted Git files, if no uncommitted files are available then no file changes.
./vendor/bin/pint --test
# OR
pint --dirty
Extras
There is a VSCode extension that integrates Laravel Pint called vscode-laravel-pint.