Sublime Text 3 php fmt赢得';不起作用


Sublime Text 3 php-fmt won't work

我正在尝试为ST3使用php-fmt插件,我安装了它,但当我使用密钥时,它什么都不做。我认为我设置得很正确,但php文件没有任何格式。我可以在命令行上使用PHP。。。我遵循了设置。我在OSX上,使用MAMP php 5.5.10

如果我使用命令"analyze"我收到的消息

Autocomplete and autoimport need building a database of terms.
Please, fill in below with the proper location for this database.
Keep in mind that the best location is always the root of the project, therefore limiting the size and ensuring speed.

如果你知道为什么它不起作用,请帮助或建议一种格式PHP代码的替代方案谢谢

在菜单上转到"首选项">"包设置">"phpfmt">"设置-用户"

编辑将作为上一操作的结果打开的文件。

根据您的php二进制位置指定"php_bin"

它应该包含这样的内容:

{
    "enable_auto_align": false,
    "indent_with_space": true,
    "passes":
    [
    ],
    "php_bin": "/Applications/MAMP/bin/php/php5.5.10/bin/php",
    "psr1": true,
    "psr2": true,
    "version": 2

}

此答案适用于较新版本。

SublimeText 3和PHPfmt 4

在菜单上,转到"首选项">"包设置">"phpfmt">"设置-用户"并添加以下代码,请确保PHP>=5.6安装在路径C:''PHP/PHP.exe上,或者您可以用下面的PHP.exe路径替换:

{
 "version": 4,
 "php_bin":"C:/php/php.exe",
 "format_on_save":true,
}