PhpStorm's External Tools feature allows users to run command-line formatters like Laravel Pint on demand. This approach provides intentional control over when Pint rewrites code, unlike auto-save watchers. To set up Laravel Pint in PhpStorm, users need to have a Laravel project with Pint installed and PhpStorm 2023.2 or later. The first step is to configure Laravel Pint in PhpStorm, which is explained in the PhpStorm Docs. Next, users need to create an external tool by going to Preferences, Tools, and External Tools, and setting up the tool with the correct program, arguments, and working directory. The tool can be bound to a keyboard shortcut, such as ⌥ ⌘ L, by going to Preferences, Keymap, and adding a shortcut to the external tool. This allows users to intentionally format their code with Pint using a keyboard shortcut. The setup has zero overhead and provides more control over code formatting. By unchecking "Open console for tool output", users can avoid annoying pop-ups. Overall, this setup provides a convenient and intentional way to format code with Laravel Pint in PhpStorm.
dev.to
dev.to
Create attached notes ...