I
I
Igor N.2015-12-07 21:03:45
PHP
Igor N., 2015-12-07 21:03:45

How to make friends Atom Beautify and PHP?

Good day, dear ones. Tell me how to make friends with the wonderful Beautify plugin and PHP ? I fought yesterday, fought, but I could not. In accordance with the recommendations on the site, in the php-cs-fixer settings, I specified the path to the executable file

.atom\packages\php-cs-fixer\php-cs-fixer.phar
, registered the latter in PATH, but it did not help, it still gives such an error

Could not find 'php-cs-fixer'. The program may not be installed.
See https://github.com/FriendsOfPHP/PHP-CS-Fixer for program installation instructions.
You can configure Atom Beautify with the absolute path to 'php-cs-fixer.phar' by setting 'PHP - CS Fixer Path' in the Atom Beautify package settings.
Your program is properly installed if running 'where.exe php-cs-fixer' in your CMD prompt returns an absolute path to the executable. If this does not work then you have not installed the program correctly and so Atom Beautify will not find the program. Atom Beautify requires that the program be found in your PATH environment variable.
Note that this is not an Atom Beautify issue if beautification does not work and the above command also does not work: this is expected behavior, since you have not properly installed your program. Please properly setup the program and search through existing Atom Beautify issues before creating a new issue. See https://github.com/Glavin001/atom-beautify/search?... for related Issues and https://github.com/Glavin001/atom-beautify/tree/ma... for documentation. If you are still unable to resolve this issue on your own then please create a new issue and ask for help.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
S
Sergey Gromov, 2017-01-23
@reskwer

The problem is in the global variable php
1. Download the php-cs- fixer.phar file from cs.sensiolabs.org (there is a large install button)
2. Write the path to the beautifier settings and check the "Beautify On Save" checkbox
3. Go to System Properties> Environment Variables >
in the PATH variables and the Path variable we add the path to your PHP серверуnote that before writing the path, you need to put ;
I have OpenServer on this C:\OpenServer\modules\php\PHP-7.0-x64,
If you also have OpenServer, please note that it has many versions of php, in order to accurately determine which version you have, go in OpenServer > Настройки > модулиand specify the one you have.
Restart Atom and try to save any php file, everything should work.
Check if you did everything right.
We start cmd(WIN + R we write cmd) in the started window we write PATHand Path
if your paths are at the end of the lines, then you did everything right, try restarting the computer and starting the atom again.
Run cmd(WIN + R write cmd) in the window that starts up, write phpif you get a message:

"php" не является внутренней или внешней
командой, исполняемой программой или пакетным файлом.

This means that the path to the PHP server is not correctly specified, check if you specified the path correctly in the PATH and Path variables.

O
ocatoll, 2016-01-11
@ocatoll

On ubuntu 15 this helped me:
curl get.sensiolabs.org/php-cs-fixer.phar -o php-cs-fixer
sudo chmod a+x php-cs-fixer
sudo mv php-cs-fixer /usr/local /bin/php-cs-fixer

X
X1m1k, 2016-03-20
@X1m1k

I, just like you, struggled with the installation ....
My solution:

  1. Place php-cs-fixer.phar ( cs.sensiolabs.org/) in C:\Users\pc_username\AppData\Roaming\Composer\vendor\fabpot\php-cs-fixer
  2. Install atom-beautify
  3. In the atom-beautify settings (PHP line - PHP-CS-Fixer Path) specify the path to the patch: C:\Users\pc_username\AppData\Roaming\Composer\vendor\fabpot\php-cs-fixer\php-cs-fixer. phar
  4. Install php-cs-fixer
  5. In the php-cs-fixer (PHP-CS-Fixer Path) settings, specify the same path as in point 3
  6. Check all paths in the File-Config menu (they must match the points 3 and 5)

M
mrdragon9000, 2019-07-29
@mrdragon9000

1) Download the fixer by clicking on the big button Install cs.sensiolabs.org
2) Put the fixer anywhere
3) In the environment variables, write the path to php
4) In the Atom Beautify settings, in the Executable in PHP-CS-FIXER, write the absolute path to the fixer (eg C:\Users\Username\AppData\Roaming\Atom\php-cs-fixer-v2.phar)
!!! In the Atom Beautify settings in the PHP settings, you do not need to fill in anything! PHP-CS-FIXER PATH does not need to be written, you can only check the Beautify on save checkbox. If you do not set, then beautify is enabled when you press ctrl + alt + B

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question