
Format your PHP files in Laravel projects using Laravel Pint directly from VS Code.
✨ Features
- Format on demand - Use
Shift+Alt+F (Windows/Linux) or Shift+Option+F (Mac)
- Format on save - Automatically format when saving (if
editor.formatOnSave is enabled)
- Auto-detection - Automatically detects Pint in your project's
vendor/bin/pint
- Cross-platform - Works on Windows, macOS, and Linux
📋 Requirements
🚀 Usage
- Open a Laravel project in VS Code
- Open any
.php file
- Format using one of these methods:
- Press
Shift+Alt+F (Windows/Linux) or Shift+Option+F (Mac)
- Right-click → Format Document
- Command Palette (
Ctrl+Shift+P) → Format Document
Enable automatic formatting on save in your VS Code settings:
{
"editor.formatOnSave": true,
"[php]": {
"editor.defaultFormatter": "rtchabodi.laravel-formatter"
}
}
⚠️ Error Messages
| Message |
Solution |
| "No workspace folder found" |
Open a folder/workspace in VS Code |
| "Pint not found in vendor/bin/pint" |
Run composer require laravel/pint --dev |
🔧 How It Works
When you request formatting, the extension:
- Locates
vendor/bin/pint in your workspace
- Creates a temporary copy of your file
- Runs Pint on the temporary file
- Applies the formatted result to your document
- Cleans up the temporary file
Your original file is only modified through VS Code's standard editing mechanism, ensuring undo/redo works as expected.
🛣️ Roadmap
- [ ] Custom Pint path configuration
- [ ] Format selection only (range formatting)
- [ ] Extension icon and branding
- [ ] Marketplace publication
📝 Release Notes
0.0.1
- Initial release
- PHP file formatting using Laravel Pint
- Auto-detection of Pint binary
- Windows, macOS, and Linux support
🤝 Contributing
Contributions are welcome! Feel free to open issues or submit pull requests.
📄 License
MIT
Enjoy coding with perfectly formatted Laravel code! 🎨
| |