Laravel Pint
Introduction
Laravel Pint is an opinionated PHP code style fixer for minimalists. Pint is built on top of PHP-CS-Fixer and makes it simple to ensure that your code style stays clean and consistent.
Pint is automatically installed with all new Laravel applications so you may start using it immediately. By default, Pint does not require any configuration and will fix code style issues in your code by following the opinionated coding style of Laravel.
Installation
Pint is included in recent releases of the Laravel framework, so installation is typically unnecessary. However, for older applications, you may install Laravel Pint via Composer:
composer require laravel/pint --dev
Running Pint
You can instruct Pint to fix code style issues by invoking the pint
binary that is available in your project's vendor/bin
directory:
./vendor/bin/pint
You may also run Pint on specific files or directories:
./vendor/bin/pint app/Models
./vendor/bin/pint app/Models/User.php
Pint will display a thorough list of all of the files that it updates. You can view even more detail about Pint's changes by providing the -v
option when invoking Pint:
./vendor/bin/pint -v
If you would like Pint to simply inspect your code for style errors without actually changing the files, you may use the --test
option:
./vendor/bin/pint --test
If you would like Pint to only modify the files that have uncommitted changes according to Git, you may use the --dirty
option:
./vendor/bin/pint --dirty