Need help with cakephp-codesniffer?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

226 Stars 87 Forks MIT License 762 Commits 1 Opened issues


CakePHP Code Sniffer

Services available


Need anything else?

Contributors list

CakePHP Code Sniffer

Build Status Total Downloads Latest Stable Version Software License

This code works with squizlabs/php_codesniffer and checks code against the coding standards used in CakePHP.

This sniffer package follows PSR-12 completely and ships with a lot of additional fixers on top.

List of included sniffs

Which version should I use?

See version map.


You should install this codesniffer with composer:

composer require --dev cakephp/cakephp-codesniffer
vendor/bin/phpcs --config-set installed_paths /path/to/your/app/vendor/cakephp/cakephp-codesniffer

The second command lets

know where to find your new sniffs. Ensure that you do not overwrite any existing
value. Alternatively, install the
composer package which will handle configuring the
for you.


:warning: Warning when these sniffs are installed with composer, ensure that you have configured the CodeSniffer


Depending on how you installed the code sniffer changes how you run it. If you have installed phpcs, and this package with PEAR, you can do the following:

vendor/bin/phpcs --colors -p -s --standard=CakePHP /path/to/code/

You can also copy the

file to your project's root folder as
. This file will import the CakePHP Coding Standard. From there you can edit it to include/exclude as needed. With this file in place, you can run:
vendor/bin/phpcs --colors -p -s /path/to/code/

If you are using Composer to manage your CakePHP project, you can also add the below to your composer.json file:

    "scripts": {
        "cs-check": "vendor/bin/phpcs --colors -p -s --extensions=php src/ tests/"

Running Tests

You can run tests with composer. Because of how PHPCS test suites work, there is additional configuration state in

that is required.
composer test

Once this has been done once, you can use

phpunit --filter CakePHP
to run the tests for the rules in this repository.


If you'd like to contribute to the Code Sniffer, you can fork the project add features and send pull requests.

Releasing CakePHP Code Sniffer

  • Create a signed tag
  • Write the changelog in the tag commit

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.