https://github.com/dotninth/hxpint
A bash script that enables integration of Laravel Pint with Helix Editor.
https://github.com/dotninth/hxpint
code-quality fixer formatter formatting helix helix-editor helix-editor-config laravel laravel-pint linter php
Last synced: 4 months ago
JSON representation
A bash script that enables integration of Laravel Pint with Helix Editor.
- Host: GitHub
- URL: https://github.com/dotninth/hxpint
- Owner: dotninth
- License: mit
- Created: 2024-10-23T11:17:12.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-21T16:20:54.000Z (11 months ago)
- Last Synced: 2025-08-28T22:59:33.380Z (4 months ago)
- Topics: code-quality, fixer, formatter, formatting, helix, helix-editor, helix-editor-config, laravel, laravel-pint, linter, php
- Language: Shell
- Homepage:
- Size: 13.7 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
[](https://supportukrainenow.org/)
## 🚀 Introduction
`hxpint` is a simple Bash script that allows you to use [Laravel Pint][link-laravel-pint] as a formatter for PHP files in [Helix Editor][link-helix-editor].
The problem without this script is that [Helix][link-helix-editor] puts the contents of the file into `stdin` and takes the formatted version from `stdout`, and [Laravel Pint][link-laravel-pint] formats the file and saves it. The only way to use it was via `dprint` and `:reload-all` command in [Helix][link-helix-editor]. But it's inconvenient because you should run `:rla` command after each save and should be aware of it all the time.
`hxpint` solves this problem.
## 🏁 Getting Started
### Requirements
- **[PHP 8.2+][link-php-releases]**
- **[Laravel 11.0+][link-laravel]**
- **[Laravel Pint][link-laravel-pint]**
### Installation & Helix Configuration
If you don't have [Laravel Pint][link-laravel-pint] installed yet, install it through the [Composer][link-composer]:
```zsh
composer global require laravel/pint
```
Now clone the repo and install the script. You can install it in any directory you want, I show you an example of the default `$HOME/.local/bin` folder in Linux here.
```zsh
git clone git@github.com:dotninth/hxpint.git
cd hxpint
chmod +x ./hxpint.sh
mv hxpint.sh $HOME/.local/bin
```
> [!IMPORTANT]
> The path to the folder where you put the `hxpint` script should be in your `.bashrc` or `.zshrc`!
Now add `hxpint` to your [Helix][link-helix-editor] `languages.toml` configuration file.
```zsh
hx $HOME/.config/helix/languages.toml
```
```toml
[[language]]
name = "php"
formatter = { command = "hxpint.sh", args = ["--stdin"] }
auto-format = true
```
**And that's it!** Open any PHP file in your [Laravel][link-laravel] project and see if `hxpint` works. You can break the formatting and run the `:fmt` command to make sure everything works as intended.
**Have fun!**
## 📄 License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
[link-laravel-pint]: https://github.com/laravel/pint
[link-helix-editor]: https://github.com/helix-editor/helix
[link-laravel]: https://github.com/laravel/laravel
[link-php-releases]: https://php.net/releases/
[link-composer]: https://getcomposer.org/