Run Laravel Pint on Save with VS Code
To automatically run laravel pint in VS Code when saving PHP files, follow these steps:
-
Install the
emeraldwalk
"Run on Save" extension from the VS Code Extensions Marketplace. -
In your
settings.json
file, Configure the "Run on Save" extension to run the pint command every time you save a PHP file :
"emeraldwalk.runonsave": {
"commands": [
{
"match": "\\.php$",
"cmd": "${workspaceFolder}/vendor/bin/pint ${file}"
}
]
}
-
Open a PHP file in your Laravel project, make a change, and save it (
Ctrl+S
). -
Witness the
php artisan pint
command's output in the terminal at the bottom of the VS Code window.