PHPackages                             pdga/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. [Utility &amp; Helpers](/categories/utility)
4. /
5. pdga/coding-standards

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

pdga/coding-standards
=====================

Coding standard rulesets to be used to assist in styling code at the PDGA.

1.1.0(2mo ago)0131[2 PRs](https://github.com/PDGA/coding-standards/pulls)1MITPHP

Since Jun 7Pushed 2mo ago3 watchersCompare

[ Source](https://github.com/PDGA/coding-standards)[ Packagist](https://packagist.org/packages/pdga/coding-standards)[ RSS](/packages/pdga-coding-standards/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (4)Versions (14)Used By (1)

The `src/ruleset.xml` file in this directory is the rule set for PDGA coding standards.

Adding to a repository
----------------------

[](#adding-to-a-repository)

- Edit composer.json, add these sections:

```
  "scripts": {
    "sniff": "bin/codesniffer phpcs",
    "format": "bin/codesniffer phpcbf",
    "format-verbose": "bin/codesniffer phpcbf -v"
  },
```

```
    "repositories":[
        {
            "type": "vcs",
            "url": "https://github.com/PDGA/coding-standards.git"
        }
    ],
```

```
  "require-dev": {
    "pdga/coding-standards": "^1.0"
  }
```

**Note: If any section already exists, add the new information under/inside of it.**

- Run `composer install` from that repository to install.
- Copy `example/script` to `bin/codesniffer` in that repository and modify the script to use the proper container.

Using in a repository
---------------------

[](#using-in-a-repository)

Once you have the repository's `composer.json` file set up and have run `composer install` to install the new dependency, you can run using `composer run` and choose either `sniff`, `format` or `format-verbose`.

Running Unit Tests
------------------

[](#running-unit-tests)

From the root directory, run `bin/phpunit`.

VSCode Plugin Setup
-------------------

[](#vscode-plugin-setup)

### Clone main repo

[](#clone-main-repo)

`git clone https://github.com/PDGA/coding-standards.git`

`cd coding-standards && ./bin/composer install`

### Plugin

[](#plugin)

Set up VSCode with this plugin:

Add the JSON configuration below to your `settings.json` file, usually in:

- Windows `%APPDATA%\Code\User\settings.json`
- macOS `$HOME/Library/Application\ Support/Code/User/settings.json`
- Linux `$HOME/.config/Code/User/settings.json`

**Note**: you will have to change the path to where you cloned `coding-standards`.

Thus, if you installed it at `~/Code/coding-standards`, the full path on a Mac would be `/Users//Code/coding-standards`

```
    "phpsab.snifferEnable": true,
    "phpsab.snifferMode": "onType",
    "phpsab.snifferArguments": ["-n", "--ignore=tests/*"],
    "phpsab.fixerArguments": ["-n", "--ignore=tests/*"],
    "phpsab.executablePathCBF": "/coding-standards/vendor/bin/phpcbf",
    "phpsab.executablePathCS": "/coding-standards/vendor/bin/phpcs",
    "phpsab.standard": "/coding-standards/src/ruleset.xml",
    "phpsab.autoRulesetSearch": false,
```

### Debugging the Codesniffer plugin configuration

[](#debugging-the-codesniffer-plugin-configuration)

To enable debugging, add to settings.json:

```
    "phpsab.debug": true,
```

Then open `Terminal -> New Terminal` in vscode, after it opens click 'OUTPUT' and from the dropdown, choose `PHP Sniffer & Beautifier`.

### Per Repo or VSC workspace specific configuration

[](#per-repo-or-vsc-workspace-specific-configuration)

Open the `.code-workspace` file for that workspace and add:

#### Disable

[](#disable)

```
    "phpsab.snifferEnable": false,
```

This should override the settings for that one workspace, turning off the file.

#### Rules

[](#rules)

```
    "phpsab.standard": "/coding-standards/src/.xml",
```

PhpStorm PHP\_CodeSniffer Setup
-------------------------------

[](#phpstorm-php_codesniffer-setup)

PhpStorm has native support for configuring PHP\_CodeSniffer as a Quality Tool per project.

Follow the setup instructions here: [PhpStorm Setup](https://www.jetbrains.com/help/phpstorm/using-php-code-sniffer.html#installing-configuring-code-sniffer)

### Configuring for a project that runs on a Docker image

[](#configuring-for-a-project-that-runs-on-a-docker-image)

The setup instructions will use a local PHP interpreter and local file paths for the CodeSniffer configuration. When setting this up for a project that runs within a Docker image, there are some things to be aware of. Since `Composer` commands should run on the image instead of locally, you will need everything configured from the perspective of the image.

- Use the interpreter from the Docker image. (eg Use the `pdga-api-php` interpreter instead of `System PHP`)
- Use the file paths from the Docker image (eg Use soemthing like `/var/www/html/vendor/squizlabs/php_codesniffer/bin/phpcs` for the PHP\_CodeSniffer path).

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance86

Actively maintained with recent releases

Popularity6

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 66.7% of commits — single point of failure

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.

###  Release Activity

Cadence

Every ~91 days

Recently: every ~157 days

Total

8

Last Release

69d ago

Major Versions

0.9.0 → 1.0.02024-06-13

### Community

Maintainers

![](https://www.gravatar.com/avatar/9806d5f419b90980d81095a16b1be2b698f203e92e74ea0e27e5b7ffd05d1ed1?d=identicon)[pdga](/maintainers/pdga)

---

Top Contributors

[![pdga-ha](https://avatars.githubusercontent.com/u/270233422?v=4)](https://github.com/pdga-ha "pdga-ha (24 commits)")[![ha17](https://avatars.githubusercontent.com/u/201188?v=4)](https://github.com/ha17 "ha17 (5 commits)")[![drew-acheson](https://avatars.githubusercontent.com/u/96074290?v=4)](https://github.com/drew-acheson "drew-acheson (4 commits)")[![timallen527](https://avatars.githubusercontent.com/u/3316521?v=4)](https://github.com/timallen527 "timallen527 (3 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[flyeralarm/php-code-validator

A custom coding standard for FLYERALARM

2226.9k6](/packages/flyeralarm-php-code-validator)

PHPackages © 2026

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