atom-beautify & php-cs-fixer

14.5k views Asked by At

I am a new programmer and I need your help. I'm pretty much new to Atom editor, but setup some nice packages like Atom Beautify. After using it in a html / php file I'm getting the error "Could not find 'php-cs-fixer' . The program may not be installed. The strange thing is, I did install the package php-cs-fixer but nothing happens.

My system is Windows.

Anyone got an idea how I can fix this?

8

There are 8 answers

11
Constantin Guidon On

its because you need to install php cs fixer, the atom extension is trying to use it but its not currently installed on your system, install it here: https://github.com/FriendsOfPHP/PHP-CS-Fixer

2
Jéssica Román Largo On
  1. You must have installed "php" usually when installing the Wamp or Xampp servers are installed by default.     

  2. Download the file "php-cs-fixer.phar" https://github.com/FriendsOfPHP/PHP-CS-Fixer

  3. In the CMD execute this command: php where.exe

  4. You get a path, that path copy in: Open Atom Packages / Atom Beautify / Settings / Executables / PHP

  1. In the same folder where the php.exe is located copy the file "php-cs-fixer.phar"

  2. Redo the previous process with the CMD and the Atom in PHP-CS-Fixer "

0
Ian On

I am not sure about in Windows, but on Mac and Linux, I do the following. You may be able to do this with Git Bash in Windows.

Install php-cs-fixer with Homebrew (via PHP-CS-Fixer Instructions)

brew install php-cs-fixer

Confirm php-cs-fixer was installed

which php-cs-fixer
0
Asad On

Just run this command in terminal, then it will work perfectly:

$ composer global require friendsofphp/php-cs-fixer

Everything will be fixed!

0
Kipng'etich Victor Lang'at On

I suggest you install manually the php-cs-fixer using the following steps:

  • You can use yum, apt, and other methods of installing a software or a .exe for windows
  • Get the path to the installed binary, for example for me i checked using whereis php-cs-fixer and I got /usr/bin/php-cs-fixer
  • Go to Packages > Atom Beautify > Settings > Executables > PHP-CS-FIXER then in the Binary/Script Path give the path of the php-cs-fixer above (/usr/bin/php-cs-fixer)
  • Enjoy beautify.
0
Bryan On

The issue for me was originally installing with composer. Composer does not put a .phar file into the /bin folder.

Download the .phar file (https://github.com/FriendsOfPHP/PHP-CS-Fixer#locally) and place it somewhere explicitly, then put that location in settings->executables->PHP-CS-Fixer path

0
Phemelo Khetho On

The manual way did work for me and this how I went about it;

  1. I download php-cs-fixer manually.
    $ wget https://cs.symfony.com/download/php-cs-fixer-v3.phar -O php-cs-fixer

or with curl

    $ curl -L https://cs.symfony.com/download/php-cs-fixer-v3.phar -o php-cs-fixer
  1. Then I fixed the rights and moved it to the right directory.
    $ sudo chmod a+x php-cs-fixer
    $ sudo mv php-cs-fixer /usr/local/bin/php-cs-fixer
  1. Finally, I ran php-cs-fixer and it worked.

full link

0
Dota2Mods On
  1. make an empty folder somewhere. example: C:\Programs\php-cs-fixer
  2. run composer require friendsofphp/php-cs-fixer
  3. open atom and go to settings -> packages -> atom beautify -> settings -> executables -> php cs fixer input the path there: C:\Programs\php-cs-fixer\vendor\bin\php-cs-fixer.bat
  4. optionally: add C:\Programs\php-cs-fixer\vendor\bin to windows env path so you can use it from cli