PHPackages                             shlinkio/php-coding-standard - 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. shlinkio/php-coding-standard

ActivePhpcodesniffer-standard[Utility &amp; Helpers](/categories/utility)

shlinkio/php-coding-standard
============================

Coding standard used by shlink PHP projects

v2.5.0(7mo ago)381.7k↓33.3%2[1 issues](https://github.com/shlinkio/php-coding-standard/issues)14MITShell

Since Nov 26Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/shlinkio/php-coding-standard)[ Packagist](https://packagist.org/packages/shlinkio/php-coding-standard)[ Docs](https://shlink.io)[ RSS](/packages/shlinkio-php-coding-standard/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (3)Versions (15)Used By (14)

Shlink coding standard
======================

[](#shlink-coding-standard)

This repository provides a [PHP\_CodeSniffer](https://github.com/PHPCSStandards/PHP_CodeSniffer) ruleset with the rules used by shlink PHP projects.

Usage
-----

[](#usage)

First, install this package using composer:

```
composer require shlinkio/php-coding-standard --dev

```

Then, update your `phpcs.xml` file, adding a rule with the reference to **Shlinkio**.

```

    Coding standard

```

Rules
-----

[](#rules)

This ruleset extends [PSR-12](https://www.php-fig.org/psr/psr-12/) rules, and includes:

- Do not allow array long syntax \[`array(...)`\].
- Make sure string concatenation operator is surrounded by spaces.
- Do not allow superfluous whitespaces.
- Do not allow unused use statements.
- Require alphabetically ordered use statements.
- Require strict comparisons (`===` and `!==` instead of `==` and `!=`).
- Require trailing comma on every element of multi-line arrays.
- Require trailing comma on every element of multi-line function calls.
- Require trailing comma on every element of multi-line function declarations.
- Enforce all global namespace classes, functions and constants to be explicitly imported.
- Require comments with single line written as one-liners \[`/* @var SomeType **/`\].
- Make all class constants to have a visibility modifier (`public`, `protected` or `private`).
- Require function arguments with a default `null` value to be defined as nullable (`?string $foo = 'foo'`).
- Require function arguments to have a native type hint whenever possible.
- Require functions to have a native return type hint whenever possible.
- Require properties to have a native type hint whenever possible.
- Require non-capturing catch when the exception variable is not used.
- Format union types without spaces (`foo|bar`) and enforcing null at the end for nullables (`foo|bar|null`).

###  Health Score

52

—

FairBetter than 96% of packages

Maintenance71

Regular maintenance activity

Popularity35

Limited adoption so far

Community21

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor1

Top contributor holds 96.8% 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 ~192 days

Recently: every ~292 days

Total

14

Last Release

225d ago

Major Versions

v1.2.2 → v2.0.02019-10-05

### Community

Maintainers

![](https://www.gravatar.com/avatar/73480af83259e096d154a8c4333e550c186b28ccb7a0d11f537b9aa57ad35392?d=identicon)[acelaya](/maintainers/acelaya)

---

Top Contributors

[![acelaya](https://avatars.githubusercontent.com/u/2719332?v=4)](https://github.com/acelaya "acelaya (30 commits)")[![rodrigoprimo](https://avatars.githubusercontent.com/u/77215?v=4)](https://github.com/rodrigoprimo "rodrigoprimo (1 commits)")

---

Tags

codestylestandardsniffercodingcs

### Embed Badge

![Health badge](/badges/shlinkio-php-coding-standard/health.svg)

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

###  Alternatives

[doctrine/coding-standard

The Doctrine Coding Standard is a set of PHPCS rules applied to all Doctrine projects.

31914.1M739](/packages/doctrine-coding-standard)[leroy-merlin-br/coding-standard

The coding standard for PHP projects on LMBR

2137.0k10](/packages/leroy-merlin-br-coding-standard)[consistence/coding-standard

Consistence - Coding Standard - PHP Code Sniffer rules

75833.3k94](/packages/consistence-coding-standard)[mnapoli/pretty

Run all code formatting tools with one command: pretty

1085.1k9](/packages/mnapoli-pretty)

PHPackages © 2026

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