Bloggings

Back

Prettier when it works

24-08-2023

Prettier is a great code beautifier for PHP, once you get it to work.

Update 14 may 2025

For Archlinux:

pacman -S prettier yay -S prettier-plugin-php

edit ~/.prettierrc

{ 
   "plugins": ["/usr/lib/node_modules/@prettier/plugin-php/src/index.mjs"]
}
    

In order to use it in the Micro text editor, download micro-prettier:

    git clone https://github.com/claromes/micro-prettier.git
    cd micro-prettier
    make
    

If you would rather not have it running on every save, in micro:
Ctrl+e > set prettier.onsave false

 


ยง