Skip to content

Latest commit

History

24 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Egeniq Coding Standard

The Egeniq Coding Standard is a set of PHP_CodeSniffer rules that we use at Egeniq. The standard is heavily based on Doctrine Coding Standard.

Installation

You can install the Egeniq coding standard as a composer dependency to your particular project. Just run the following command to add it to your project:

php composer require --dev egeniq/php-coding-standard

Then you can use it like:

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

You might also do automatic fixes using phpcbf:

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

Project-level ruleset

To enable the Egeniq coding standard for your project, create a phpcs.xml.dist file with the following content:

<?xml version="1.0"?>
<ruleset>
<argname="basepath"value="."/>
<argname="extensions"value="php"/>
<argname="parallel"value="80"/>
<argname="cache"value=".phpcs-cache"/>
<argname="colors"/>
<!-- Ignore warnings, show progress of the run and show sniff names -->
<argvalue="nps"/>
<!-- Directories to be checked -->
<file>app</file>
<file>tests</file>
<!-- Include full Egeniq coding standard -->
<ruleref="Egeniq">
<!-- sniffs to exclude --><!-- by default strict types are required, but if you wish to disable this, exclude the following sniff: <exclude name="SlevomatCodingStandard.TypeHints.DeclareStrictTypes"/>-->
</rule>
</ruleset>

This will enable verbatim the Egeniq coding standard with all rules included with their defaults. From now on you can just run vendor/bin/phpcs and vendor/bin/phpcbf without any arguments 🙌.

About

PHP coding standards (PSR2 + additional strict checks)

Topics

Resources

Stars

1 star

Watchers

8 watching

Forks

Releases

Packages

Used by

Contributors