PHPackages                             tuannda/php-coding-standards - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [PSR &amp; Standards](/categories/psr-standards)
4. /
5. tuannda/php-coding-standards

ActiveLibrary[PSR &amp; Standards](/categories/psr-standards)

tuannda/php-coding-standards
============================

PHP Coding Standards

01PHP

Since Feb 20Pushed 4y ago1 watchersCompare

[ Source](https://github.com/tuannda/PHP-Coding-Standards)[ Packagist](https://packagist.org/packages/tuannda/php-coding-standards)[ RSS](/packages/tuannda-php-coding-standards/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

PHP Coding Standard
===================

[](#php-coding-standard)

Requirements
------------

[](#requirements)

[PHP\_CodeSniffer 3](https://github.com/squizlabs/PHP_CodeSniffer). (3.6 or greater).

### Global install (Recommended)

[](#global-install-recommended)

Globally [install PHP\_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer/blob/master/README.md) with one of the various methods. (Skip this step if you already have it installed.)

Once complete you should be able to execute `phpcs -i` on the command line.

You should see something like:-

`The installed coding standards are MySource, PEAR, PSR1, PSR2, Squiz and Zend.`

(Recommended) use composer...

`composer global require tuannda/php-coding-standard`

or clone this repository...

`git clone -b master --depth 1 https://github.com/tuannda/php-coding-standard.git`.

or download.

Take note of the paths where they were installed.

(Recommended) Create a symbolic link to the 'php-coding-standard/CodingStandard' directory in 'php\_codesniffer/src/Standards/' eg.

`ln -s ~/Documents/Projects/php-coding-standard/CodingStandard ~/.composer/vendor/squizlabs/php_codesniffer/src/Standards/CodingStandard`

or copy the `CodingStandard` directory to `php_codesniffer/src/Standards/`

Executing `phpcs -i` should now show CodingStandard installed eg.

`The installed coding standards are CodingStandard, MySource, PEAR, PSR1, PSR2, Squiz and Zend.`

You should now be able to set 'CodingStandard' as the phpcs standard in the plugin/editor/IDE of your choice.

### Composer install for a single project

[](#composer-install-for-a-single-project)

`cd /Path/To/MyProject`

`composer require tuannda/php-coding-standard`

Set the 'phpcs standard path' and 'phpcbf standard path' in your editor/plugin config to:

'/Path/To/MyProject/vendor/php-coding-standard/CodingStandard/ruleset.xml'

### Command line use

[](#command-line-use)

#### Sniffing errors &amp; warnings (reporting).

[](#sniffing-errors--warnings-reporting)

Single file...

`phpcs /Path/To/MyFile.php --standard='/Path/To/php-coding-standard/CodingStandard/ruleset.xml'`

or if globally installed.

`phpcs /Path/To/MyFile.php --standard=CodingStandard`

Directory (recursive).

`phpcs /Path/To/MyProject --standard='/Path/To/php-coding-standard/CodingStandard/ruleset.xml'`

or if globally installed.

`phpcs /Path/To/MyProject --standard=CodingStandard`

#### Fixing fixable errors.

[](#fixing-fixable-errors)

Single file.

`phpcbf /Path/To/MyFile.php --standard='/Path/To/php-coding-standard/CodingStandard/ruleset.xml'`

or if globally installed.

`phpcbf /Path/To/MyFile.php --standard=CodingStandard`

Directory (recursive).

`phpcbf /Path/To/MyProject --standard='/Path/To/php-coding-standard/CodingStandard/ruleset.xml'`

or if globally installed.

`phpcbf /Path/To/MyProject --standard=CodingStandard`

### Run on Gitlab-CI

[](#run-on-gitlab-ci)

```
stylelint:
stage: stylelint
tags:
- gitlab-runner
only:
- merge_requests
script:
- phpcs --config-set default_standard /Path/To/php-coding-standard/CodingStandard/
- echo CI_COMMIT_SHA=${CI_COMMIT_SHA}
- echo CI_MERGE_REQUEST_TARGET_BRANCH_NAME=${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}
- git fetch origin ${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}
- FILES=$(git diff --name-only ${CI_COMMIT_SHA} origin/${CI_MERGE_REQUEST_TARGET_BRANCH_NAME} | grep '\.php'$)
- if [ ! -z "$FILES" ]; then echo $FILES | xargs phpcs; fi
when: always

```

### Change crlf to lf on windows

[](#change-crlf-to-lf-on-windows)

```
git config --global core.autocrlf input
git config --global core.safecrlf input

```

###  Health Score

14

—

LowBetter than 2% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity1

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity27

Early-stage or recently created project

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/8db09c4d61b609d2304f59b52e49cafb29de91678a3db87786555f96441420a4?d=identicon)[cyou](/maintainers/cyou)

### Embed Badge

![Health badge](/badges/tuannda-php-coding-standards/health.svg)

```
[![Health](https://phpackages.com/badges/tuannda-php-coding-standards/health.svg)](https://phpackages.com/packages/tuannda-php-coding-standards)
```

###  Alternatives

[phpdocumentor/type-resolver

A PSR-5 based resolver of Class names, Types and Structural Element Names

9.2k719.5M166](/packages/phpdocumentor-type-resolver)[pimple/pimple

Pimple, a simple Dependency Injection Container

2.7k130.5M1.4k](/packages/pimple-pimple)[league/container

A fast and intuitive dependency injection container.

86387.8M343](/packages/league-container)[stella-maris/clock

A pre-release of the proposed PSR-20 Clock-Interface

7947.5M2](/packages/stella-maris-clock)[wptrt/wpthemereview

PHP\_CodeSniffer rules (sniffs) to verify theme compliance with the rules for theme hosting on wordpress.org

217736.5k29](/packages/wptrt-wpthemereview)[inpsyde/modularity

Modular PSR-11 implementation for WordPress plugins, themes or libraries.

54383.3k3](/packages/inpsyde-modularity)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
