Sublime developing PHP Prerequisite Tools Collection (MAC)
RELATED Links: http://benmatselby.github.io/sublime-phpcs/
Goal:
- Run PHP code directly in sublime
- Test code, Code redundancy detection, syntax detection by PSR2 standard
- Automatic Formatting code
1: Install packages control2: Configure the PHP code to run in sublime
1 : Tools -> Build System -> New Build System2 : 粘贴以下代码{ "cmd": ["php", "$file"], "file_regex": "php$", "selector": "source.php"}3:文件保存为php.sublime-build
Attached: After the configuration is complete, open a php file, press COMMAND + B to run the current code
2: Install Phpcs
方法1:Preferences -> Package Control -> Install Package -> Phpcs方法2: $ cd ~/Library/Application\ Support/Sublime\ Text\ {N}/Packages/ $ git clone git://github.com/benmatselby/sublime-phpcs.git Phpcs附:(这里的phpcs只是一个sublime的交互插件)
3: Install the relevant plugin use brew to install some plug-ins (need to install brew first)
brew install phpmdbrew install php-cs-fixer
Install some plug-ins with pear (requires installing pear first)
pear install PHP_CodeSniffer
Related configuration
“phpcs_php_path”“phpcs_executable_path”“phpmd_executable_path”“php_cs_fixer_executable_path”
In order to get the path of the application:
$ which php$ which phpcs$ which phpmd$ which php-cs-fixer$ which phpcbf
4: Other Suggestions
- Turn on automatic PSR Specification detection, automatic formatting, grammar detection
- Turn off redundancy detection (because regular code doesn't pass this test, it's too strict.) Can be opened separately when testing is required)
Sublime developing PHP Prerequisite Tools collection (MAC)