Prettier PHP plugin

(( gitHubWatchers )) (( gitHubStars )) (( gitHubForks ))

Prettier PHP plugin adds support for the PHP language to Prettier, an opinionated code formatter.

Prettier enforces a consistent style by parsing your code and re-printing it with its own rules that take the maximum line length into account, wrapping code when necessary.

Note: this plugin can also be integrated with php-cs-fixer. See docs/recipes/php-cs-fixer for integration help, code can also be found in https://gist.github.com/Billz95/9d5fad3af728b88540fa831b73261733

Installation

Install from a Node package as a dev dependency (with npm or yarn)

Make sure you have npm or yarn installed.

Require it as a dev dependency:
yarn add --dev prettier@latest @prettier/plugin-php@latest
or
npm install --save-dev prettier@latest @prettier/plugin-php@latest
Run it:
yarn run prettier path/to/file.php --write
or
npm run prettier -- path/to/file.php --write

Install from a Node package as a global dependency (with npm or yarn)

Make sure you have npm or yarn installed.

Require it as a global dependency:
yarn global add prettier@latest @prettier/plugin-php@latest
or
npm install --global prettier@latest @prettier/plugin-php@latest
Run it:
yarn run prettier path/to/file.php --write
or
npm run prettier -- path/to/file.php --write