Skip to content

Instantly share code, notes, and snippets.

@tuanpht
Last active October 17, 2017 04:37
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save tuanpht/98da682333dd1bc8e4516417653158aa to your computer and use it in GitHub Desktop.
Save tuanpht/98da682333dd1bc8e4516417653158aa to your computer and use it in GitHub Desktop.
Using PHPCS with Sublime Text

Sử dụng PHP-Code-Sniffer kiểm tra code convention với Sublime Text

  1. Cài đặt PHP-Code-Sniffer

    composer global require "squizlabs/php_codesniffer=*"
  2. Thêm bộ quy tắc Framgia PHP https://github.com/wataridori/framgia-php-codesniffer

  3. Cài đặt Sublime Text package https://packagecontrol.io/packages/Phpcs.

    Cấu hình: Preferences => Package Settings => PHP Code Sniffer => Settings User

    {
    	"phpcs_executable_path": "ABSOLUTE_PATH_OF_phpcs",
    	"phpcs_additional_args": {
            "--standard": "Framgia",
            "-n": ""
        },
    }
  4. Other Sublime Text setting

    {
        // End of file is always newline
    	"ensure_newline_at_eof_on_save": true,
    	// Using space
    	"translate_tabs_to_spaces": true,
    	// Strip whitespace
    	"trim_trailing_white_space_on_save": true
    	"rulers":
    	[
    		80, // Soft limit
    		120 // Hard limit
    	],
    	"indent_guide_options":
    	[
    		"draw_normal",
    		"draw_active"
    	],
    	"show_encoding": true,
    	"show_line_endings": true,
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment