How to make Atom Beautify Work with PHP and PHP-CS-Fixer on Windows

How to make Atom Beautify Work with PHP and PHP-CS-Fixer on Windows

Published 02/22/2022
Updated 08/14/2022
Categories
Tags

Atom Beautify with PHP and PHP-CS-Fixer on Windows

Sometimes making Atom Beautify work with PHP on Windows can be complicated. At least in my experience, it can happen that the Beautifier on Atom might stop working, or maybe with time there might be something not working well anymore, and it is a bit hard to understand which is the problem.

Let's see a possible solution, quite an easy one, that does not require to install either EasyPHP nor XAMPP.

Here are the steps and settings instructions to follow in order to make the Beautifer work with PHP and PHP-CS-Fixer.

  1. Download the PHP package based on your Windows version, like the VS16 x64 Thread Safe
  2. Download the .phar file for PHP-CS-Fixer by going on the website of Symfony and clicking on "Install now", the file name will be similar to "php-cs-fixer-v3.phar"
  3. Unzip the PHP archive downloaded at step 1, inside a folder called something like D:\Programs\php
  4. Put theĀ php-cs-fixer-v3.phar file inside the same folder D:\Programs\php
  5. On Atom, install the Atom Beautify package
  6. Go to the settings of the Atom Beautify Package (on Atom) and at Executables write the absolute paths for PHP and PHP-CS-Fixer:
    • for PHP it will be similar to D:\Programs\php\php.exe
    • for PHP-CS-Fixer: D:\Programs\php\php-cs-fixer-v3.phar
  7. Close Atom and open it again. By pressing ALT+B on a PHP file the code will be formatted as for the standards.
    In case of an error message, check that there are no other packages on Atom conflicting with Beautify, or try to double check that the settings of Atom Beautify are correct.

Let me know in the comments if this worked for you or not!

Comments

All comments will be subject to approval after being sent. They might be published after several hours.

*