There ist this package called atom-beautify for the atom text editor. It can, amongst many different languages, also beautify php. But if will not work out of the box on windows (see screenshot below).
-
Install the php-cs-fixer.phar file and add it to your path.
Go to this github page and download the php-cs-fixer.phar file. Next you need to add it to your path. Check cmdecho %PATH%
to see which folders are being watched. I choseC:\Windows
. Important: Now you need to remove the ending.phar
or atom won't find the file. -
Install php and add it to your path.
Official php windopws download-page. Grab the VC11 x86 Non Thread Safe package. See here why: https://stackoverflow.com/questions/1623914/what-is-thread-safe-or-non-thread-safe-in-php. Extract it somewhere, I choseC:\Windows\php
. Add this location to path (userprofile) with command (in cmd window):setx PATH "%PATH%;C:\Windows\php"
(for system path usesetx /M ...
). -
Restart Atom (to load new environment variables).
I've created a script which will do this for you. Copy the following code into a powershell with elevated privileges and hit enter. For script execution directly in powershell you need to set Set-ExecutionPolicy Bypass
first. If you wish to not touch your execution policy use cmd command from further below. Tested with powershell version:
> $PSVersionTable.PSVersion
Major Minor Build Revision
----- ----- ----- --------
5 0 10240 16384
POWERSHELL: iex ((new-object net.webclient).DownloadString('https://gist.githubusercontent.com/tairun/19b0176b687bb320df90/raw/fd09327d62a4142a0463fa386372cd301df799e0/php-cs-fixer_install_script.ps1'))
CMD: @powershell -NoProfile -ExecutionPolicy unrestricted -Command "(iex ((new-object net.webclient).DownloadString('https://gist.githubusercontent.com/tairun/19b0176b687bb320df90/raw/fd09327d62a4142a0463fa386372cd301df799e0/php-cs-fixer_install_script.ps1'))) >$null 2>&1"
Here is the link to the script: https://gist.github.com/19b0176b687bb320df90
This script assumes one thing: that you have wget installed.