Brand Embassy Coding Standard

Installs: 85 616

Dependents: 14

Suggesters: 0

Security: 0

Stars: 0

Watchers: 9

Forks: 0

Open Issues: 7


8.5 2021-11-22 10:26 UTC


  • The PHP_CodeSniffer ruleset to check that repositories are following the unified coding standard for Brand Embassy projects.
  • The PHPStan default configuration file.
  • PhpStorm code style and inspections (with Php Inspections (EA Extended) plugin) configuration files.


For full reference of enforcements, go through src/BrandEmbassyCodingStandard/ruleset.xml where each sniff is briefly described.

@TODO list of important sniffs

Skippable sniffs

For example to skip Function comment sniff:

 * @phpcsSuppress BrandEmbassyCodingStandard.Commenting.FunctionComment
  • BrandEmbassyCodingStandard.Commenting.FunctionComment
  • BrandEmbassyCodingStandard.NamingConvention.CamelCapsFunctionName
  • BrandEmbassyCodingStandard.WhiteSpace.MethodSpacing
  • Some sniffs from SlevomatCodingStandards


You can install the Brand Embassy Coding Standard as a composer dependency to your project:

$ composer require --dev brandembassy/coding-standard


You can run PHP_CodeSniffer with this command:

$ ./vendor/bin/phpcs --standard=BrandEmbassyCodingStandard /path/to/some/file/to/sniff.php

You might also do automatic fixes using phpcbf:

$ ./vendor/bin/phpcbf --standard=BrandEmbassyCodingStandard /path/to/some/file/to/sniff.php


To use default configuration include default-phpstan.neon in your project's PHPStan config:

    - vendor/brandembassy/coding-standard/integration-phpstan.neon


This project contains inspections and code style configurations for PhpStorm.

  • BrandEmbassyCodeStyle.xml
  • BrandEmbassyInspections.xml

Importing these configurations reduces number of errors in phpcs check before committing.


This library follows semantic versioning, and additions to the code ruleset are only performed in major releases.


@TODO: inspiration -

If you are contributing to the Brand Embassy Coding Standard and want to test your contribution, you just need to execute PHPCS with the tests folder and ensure it matches the expected report:

$ ./vendor/bin/phpcs tests/input --report=summary --report-file=phpcs.log; diff tests/expected_report.txt phpcs.log