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

ActiveLibrary

magicsunday/coding-standard
===========================

Shared coding standard, static-analysis, test and CI configuration for the magicsunday/\* projects.

1.2.0(today)046↑2834.8%MITPHPPHP 8.3 - 8.5CI passing

Since Jul 23Pushed todayCompare

[ Source](https://github.com/magicsunday/coding-standard)[ Packagist](https://packagist.org/packages/magicsunday/coding-standard)[ RSS](/packages/magicsunday-coding-standard/feed)WikiDiscussions main Synced today

READMEChangelog (3)Dependencies (8)Versions (4)Used By (0)

magicsunday/coding-standard
===========================

[](#magicsundaycoding-standard)

Shared coding-standard, static-analysis, test and CI configuration for the `magicsunday/*` projects. One source of truth for the PHP and JS/TS toolchain so the individual repositories stop carrying near-identical config copies that drift.

The PHP configs are consumed through **Composer** (Packagist). The Biome/TypeScript configs are consumed as a **GitHub git dependency** — the package is never published to the npm registry, exactly like `webtrees-chart-lib`.

Installation
------------

[](#installation)

```
composer require --dev magicsunday/coding-standard
```

For the JS/TS configs, add a GitHub git dependency (no npm-registry account needed — the same mechanism `webtrees-chart-lib` uses):

```
npm install --save-dev github:magicsunday/coding-standard#1.2.0
```

which records in `package.json`:

```
{
    "devDependencies": {
        "@magicsunday/coding-standard": "github:magicsunday/coding-standard#1.2.0"
    }
}
```

Layout
------

[](#layout)

The directory a file lives in states how it is meant to be consumed:

LocationKindHow a consumer uses it`php-cs-fixer/`, `phpstan/`, `rector/`, `biome/`, `tsconfig/`**importable**referenced straight out of `vendor/` or `node_modules/` — `includes:`, `require`, `extends``templates/`**copy-and-adapt**copied into the consumer's own repository; these formats (PHPUnit, phplint, Infection, jscpd, editorconfig) cannot be imported, their tools expect the file at the repo rootrepository root**this package's own dev config**`.phplint.yml`, `.github/`, `tests/` — all `export-ignore`d, so a consumer never receives them. The package lints itself with its own template.PHP configs
-----------

[](#php-configs)

### php-cs-fixer — `php-cs-fixer/base.php`

[](#php-cs-fixer--php-cs-fixerbasephp)

A factory that returns a configured `PhpCsFixer\Config`; the consumer supplies its own file header and finder.

```
// .php-cs-fixer.dist.php
$factory = require __DIR__ . '/vendor/magicsunday/coding-standard/php-cs-fixer/base.php';

return $factory(setFinder(
        PhpCsFixer\Finder::create()
            ->exclude(['.build', 'node_modules'])
            ->in([__DIR__ . '/src/', __DIR__ . '/tests/'])
    );
```

A repository that lints PHTML views appends `->name('*.php')->name('*.phtml')` to its finder.

### PHPStan — `phpstan/base.neon`, `phpstan/strict.neon`

[](#phpstan--phpstanbaseneon-phpstanstrictneon)

`base.neon` sets `level: max`, `treatPhpDocTypesAsCertain: false`, and pulls in the rule extensions (phpstan-strict-rules, deprecation-rules, phpstan-phpunit, phpat) through explicit relative `includes`. That is deliberate: `phpstan/extension-installer`does not reach Rector's bundled PHPStan, so a base relying on it makes `rector.php`'s `phpstanConfig` fail on an unknown parameter.

```
# phpstan.neon
includes:
    - vendor/magicsunday/coding-standard/phpstan/base.neon

parameters:
    phpVersion: 80300
    paths:
        - src
        - tests

services:
    -
        class: Vendor\Namespace\Test\Architecture\ArchitectureTest
        tags:
            - phpat.test
```

### The two tiers

[](#the-two-tiers)

`base.neon` is the **floor** — every repository runs it, no exceptions.

`strict.neon` (which includes `base.neon`) is the **target** — the tier every repository is expected to reach, not a permanent alternative. It adds the shipmonk/symplify rule packs and the extra-strict report parameters. The reason it is staged rather than folded into the base is cost, not preference: turning it on surfaces real findings that need triaging per repository, so forcing it into the base would block every adoption on an unrelated backlog.

To keep that staging from becoming drift, **a repository that runs only `base.neon`carries an open issue for reaching `strict.neon`**. The gap stays visible and terminated instead of quietly permanent.

```
composer require --dev shipmonk/phpstan-rules symplify/phpstan-rules
```

Adopt via the `adopt-strict-phpstan-ruleset` workflow, triaging each finding.

### Rector — `rector/base.php`

[](#rector--rectorbasephp)

```
// rector.php
use Rector\Config\RectorConfig;

return static function (RectorConfig $config): void {
    $config->paths([__DIR__ . '/src/', __DIR__ . '/tests/']);
    $config->phpVersion(80300);
    $config->phpstanConfig(__DIR__ . '/phpstan.neon');

    (require __DIR__ . '/vendor/magicsunday/coding-standard/rector/base.php')($config);
};
```

Templates (copy-and-adapt)
--------------------------

[](#templates-copy-and-adapt)

Files under `templates/` are not importable — copy them into the consumer and adjust the paths. A lockstep check keeps them from drifting from this package.

TemplateCopy toNotes`templates/phpunit.xml.dist``phpunit.xml.dist`strict flag set incl. `requireCoverageMetadata``templates/infection.json5``infection.json5``timeoutsAsEscaped: true`; set the MSI floor per repo`templates/editorconfig``.editorconfig`4-space, tab for Makefiles`templates/gitattributes``.gitattributes``export-ignore` dist hygiene`templates/phplint.yml``.phplint.yml`the `ci:test:php:lint` gate the reusable workflow invokes — path-driven, never a hand-kept file list`templates/jscpd.json``.jscpd.json`zero-tolerance copy-paste gate`templates/ArchitectureTest.php``tests/Architecture/ArchitectureTest.php`phpat layering + `Abstract*` naming + `beFinal`JS/TS configs
-------------

[](#jsts-configs)

```
// biome.json
{ "extends": ["@magicsunday/coding-standard/biome/base.json"] }
```

```
// tsconfig.json
{ "extends": "@magicsunday/coding-standard/tsconfig/base.json" }
```

Lint with `biome ci --error-on-warnings` so every warning is CI-fatal.

License
-------

[](#license)

MIT — see [LICENSE](LICENSE).

###  Health Score

45

—

FairBetter than 91% of packages

Maintenance100

Actively maintained with recent releases

Popularity11

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~0 days

Total

3

Last Release

0d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1979dde7200fccc0e21e18a29b5566f22fa01ad104e577254fe74e14ae04a297?d=identicon)[magicsunday](/maintainers/magicsunday)

---

Top Contributors

[![magicsunday](https://avatars.githubusercontent.com/u/564393?v=4)](https://github.com/magicsunday "magicsunday (14 commits)")

---

Tags

PHPStanstatic analysisrectorphp-cs-fixerCoding Standardphpat

### Embed Badge

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

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

###  Alternatives

[wp-cli/wp-cli-tests

WP-CLI testing framework

423.1M143](/packages/wp-cli-wp-cli-tests)[ssch/typo3-rector

Instant fixes for your TYPO3 PHP code by using Rector.

2603.2M442](/packages/ssch-typo3-rector)

PHPackages © 2026

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