NIUCLOUD是一款SaaS管理后台框架多应用插件+云编译。上千名开发者、服务商正在积极拥抱开发者生态。欢迎开发者们免费入驻。一起助力发展! 广告
PHP-CS-Fixer ============= [PHP Coding Standards Fixer][] 是在不破坏相容性的情况下,将 PHP 的代码往 [PSR-2][] 的方向修正。 [PHP Coding Standards Fixer]: http://cs.sensiolabs.org/ [PSR-2]: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md * * * * * ## 安装方法 以下是基于 Linux 环境的安装方法: 直接下载 [php-cs-fixer.phar](http://get.sensiolabs.org/php-cs-fixer.phar) 文件 ``` wget http://cs.sensiolabs.org/get/php-cs-fixer.phar -O php-cs-fixer chmod a+x php-cs-fixer ``` 放到 `/usr/local/bin` 目录下 ## 使用方法 使用 `fix` 命令修正指定的目录或文件 ```shell php-cs-fixer fix /path/to/dir php-cs-fixer fix /path/to/file ``` 预设是 PSR-2 以及一些作者自订的规则,如果要强制只用 PSR-2 的话可以用 `--level=psr2` 。 更多使用说明文档,请查阅官方 [Github](https://github.com/FriendsOfPHP/PHP-CS-Fixer) ## 专用插件 * [PhpStorm](http://tzfrs.de/2015/01/automatically-format-code-to-match-psr-standards-with-phpstorm) * [Sublime Text](https://github.com/benmatselby/sublime-phpcs)