百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
V

vscode-php-cs-fixer

> 编程语言
开源

适用于 VS Code 的 PHP CS Fixer 扩展

395 stars0 点赞1 次浏览
访问官网GitHub

工具介绍

适用于 VS Code 的 PHP CS Fixer 扩展

PHP CS Fixer for Visual Studio Code

This extension simply provides PHP CS Fixer command.

Installation

Open command palette F1 and select Extensions: Install Extension, then search for PHP CS Fixer.

Usage

F1 -> php-cs-fixer: fix this file

or keyboard shortcut alt+shift+f vs code default formatter shortcut

or right mouse context menu Format Document

or right mouse context menu Format Selection

or right mouse context menu on explorer php-cs-fixer: fix

Install php-cs-fixer

  1. this extension has included php-cs-fixer.phar for beginner, maybe performance lower.

  2. if you want to install php-cs-fixer by yourself, see: php-cs-fixer Installation guide

Configuration

…

TIPS: If you are using other formatters like Prettier, you can get some conflicts with auto save or other features. To fix it, you have to add this line:

json5
// Set PHP CS Fixer as the default formatter for PHP files
// It will avoid conflict with other formatters like prettier etc.
"[php]": {
    "editor.defaultFormatter": "junstyle.php-cs-fixer"
},

install php-cs-fixer by composer

json
    "php-cs-fixer.executablePath": "php-cs-fixer"

TIP: try "php-cs-fixer.bat" on Windows.

or use phar file

json
    "php-cs-fixer.executablePath": "/full/path/of/php-cs-fixer.phar"

You also have executablePathWindows available if you want to specify Windows specific path. Useful if you share your workspace settings among different environments.

executablePath can use ${workspaceFolder} as workspace first root folder path.

[executablePath, executablePathWindows, config] can use "~/" as user home directory on os.

Additionally you can configure this extension to execute on save.

json
    "php-cs-fixer.onsave": true

you can format html at the same time.

json
    "php-cs-fixer.formatHtml": true

You can use a config file from a list of semicolon separated values

json
    "php-cs-fixer.config": ".php-cs-fixer.php;.php-cs-fixer.dist.php;.php_cs;.php_cs.dist"

config file can place in workspace root folder or .vscode folder or any other folders:

json
    "php-cs-fixer.config": "/full/config/file/path"

Relative paths are only considered when a workspace folder is open.

config file .php-cs-fixer.php example

…

If you have installed other PHP related extensions to VS Code it may happen that another formatter is used per default. You can force this extension to be used per default by adding this to your settings:

json
    "[php]": {
        "editor.defaultFormatter": "junstyle.php-cs-fixer"
    }

Auto fix

1. by Bracket, when press down the key } auto fix the code in the brackets {}
2. by Semicolon, when press down the key ; auto fix the code at the current line

For more information please visit: https://github.com/FriendsOfPHP/PHP-CS-Fixer

License

MIT

If you love this extension

Issues· 50 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

JavaScript

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言