Alfonso's Website
1 min read time

Run Laravel Pint on Save with VS Code

To automatically run laravel pint in VS Code when saving PHP files, follow these steps:

  1. Install the emeraldwalk "Run on Save" extension from the VS Code Extensions Marketplace.

  2. 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}"
		}
	  ]
	}
  1. Open a PHP file in your Laravel project, make a change, and save it (Ctrl+S).

  2. Witness the php artisan pint command's output in the terminal at the bottom of the VS Code window.