VS Code PHP Formatter That Actually Works (Mac/Linux)

Image for post
Image for post
Install the extension by junstyle

Install Extension

Install The PHP Fixer File

$ curl -L https://cs.symfony.com/download/php-cs-fixer-v2.phar -o php-cs-fixer
$ sudo chmod a+x php-cs-fixer
$ ./php-cs-fixer
Image for post
Image for post
You should get the program name and version number.
$ sudo mv php-cs-fixer /usr/local/bin/php-cs-fixer

Create a Config File

$ sublime ~/.php_cs
Image for post
Image for post
If you like your fat arrows aligned change this settings to true

Point VS Code To Your Config File

Image for post
Image for post
Enter your user name, not mine.

Set Extension as Default Formatter

Written by

Front-end Web Developer. Language lover. Traveler. Dude.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store