# Magento Coding Standard

Magento Coding Standard is a set of PHP_CodeSniffer rules that check Magento 2 code against Magento's coding conventions, usable via Composer in a Magento project or as a standalone tool.

Magento Coding Standard defines a Magento2 ruleset for the PHP_CodeSniffer static-analysis tool, letting a Magento 2 project check its code, typically an extension, against Magento's own coding conventions. It installs as a Composer dev dependency, with post-install and post-update scripts that register the ruleset's path with phpcs automatically, or as a standalone application cloned directly or created with composer create-project.

Once installed, running phpcs -i confirms the Magento2 standard is registered, and phpcs --standard=Magento2 checks a given extension's code, printing any rule violations. A companion phpcbf command automatically fixes the subset of violations marked as fixable. Contribution paths include documenting existing rules, fixing bugs, and proposing or building new PHP_CodeSniffer rules for the standard.

Website: https://github.com/magento/magento-coding-standard
