vysker / vscode-php-formatter

Visual Studio Code extension. A wrapper for the Sensiolabs PHP CS Fixer. Analyzes some PHP source code and tries to fix coding standards issues (PSR-1 and PSR-2 compatible).
MIT License
93 stars 11 forks source link

Neither a pharPath or use of Composer was specified. Aborting... #17

Open stereoit opened 7 years ago

stereoit commented 7 years ago

In visual studio code I've started to get the message in subject every time I save the PHP file. I working on older project with symfony 1.4.

Voorivex commented 7 years ago

+1

@haydentech same problem, I reached "not working, but gives no error."

sinandomeng commented 7 years ago

+1 Do you guys have your solutions with this?

calebsmithdev commented 6 years ago

I had this same problem and googled it to here. Yep - reading instructions were key here. Follow the above directions: https://github.com/Dickurt/vscode-php-formatter/issues/17#issuecomment-343574032

duard commented 6 years ago

Same problem "Neither a pharPath or use of Composer was specified. Aborting..." ...

PHP Windows 10 VScode

ArtemLazar commented 6 years ago

In your project press "Ctrl + ,", you will see before you "User Settings", go to "PHP Formatter Settings" and there you must change the value "phpformatter.composer" from "false" to "true"

lloricode commented 6 years ago

@ArtemLazar , nothing change, just removed the error message

GeuntaBuwono commented 6 years ago

this worked well Solution TL; DR

  1. Add Beautify Extension
  2. Go To User Setting CTRL + , (comma) on Windows or Linux / Command + , (comma) on Mac
  3. Find and Copy Beautify Setting to User Setting
  4. On HTML Object Properties Add "php" and "blade.php" for laravel workspace.
  5. On your file edit press CTRL + Shift + I for auto Intentation.
  6. Happy :dancer:
bardware commented 6 years ago

There's another issue in this repo. There's the advice to look into VSCode's developer tools under Help => Toggle Developer Tools

bardware commented 6 years ago

// Add arguments to the executed fix command, like so: ['--level=psr2'

The level argument has been deprecated in the meantime.

My settings now look like

    "phpformatter.composer": true,
    "phpformatter.arguments": [
        ""
    ],

I tried to provide --rules psr2 and got message The rules contain unknown fixers: "psr2" (did you mean "psr0"?). When I provide --rules psr0 it says: The rules contain risky fixers (psr0), but they are not allowed to run. Perhaps you forget to use --allow-risky option?

How do I eventually enable psr2?

marcusedu commented 6 years ago

I solved this problem installing another plugin, the phpfmt

nwaweru commented 6 years ago

The setting "phpformatter.composer": true, worked for me.

nighon commented 4 years ago

I suggest to use phpstorm.

aledc7 commented 4 years ago

Doesnt Work, i recomend the extension "phpfmt" just install and fun!

boythl commented 4 years ago

Hi everyone, i found out when added the setting "phpformatter.composer": true, "phpformatter.arguments":["--rules=@PSR2"] This issue could be solved. If you didn't use composer installed, must to point the "phpformatter.pharPath" path.

Try it! Thanks.

well done!!
thank u!

drgavali9 commented 3 years ago

phpformatter.pharPath

Hii Where I add this code. Please explain in details.

kumargaf commented 3 years ago

extension phpfmt is easiest one to use

Rajansth77 commented 3 years ago

This solved my issue like a charm :1st_place_medal: Just add these lines in settings.json

"php-cs-fixer.executablePath": "${extensionPath}\php-cs-fixer.phar", "[php]": { "editor.defaultFormatter": "junstyle.php-cs-fixer", "editor.formatOnSave": true }, "php-cs-fixer.rules": "@PSR2", "php-cs-fixer.formatHtml": true, "phpformatter.composer": true, "phpformatter.arguments":["--rules=@PSR2"]

ReneAcevedo commented 2 years ago

yo utilicé otra extensión guiándome del siguiente link https://gist.github.com/realrashid/59d0f99ed31103ae44291f3c752240b6

favourdev1 commented 2 years ago

after almost 5 years, this problem hasn't been fixed and the developers are not saying anything about this problem I am also experiencing this problem and there's no way or guidance on a fix. They should just take this extension down if it doesn't work

madhuribadgujar commented 2 years ago

Hi friends i have same issue ,Solved by following steps 1.comment(remove) editor.defaultFormatter from settings.json 2.in code where u want to format press shift+F 3.configure formatter will come select PHPIntelephense which add "editor.defaultFormatter": "bmewburn.vscode-intelephense-client" in [php] object of setting.json file and problem solve

imagicalFantasy commented 2 years ago

Why this plugin need a complex setup when all other plugins in VScode are easy to install ?