Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .ecrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"\\.min\\.css$",
"\\.min\\.js$",
"^vendor/",
"^runtime/"
"^runtime/",
"scaffold-lock\\.json$"
]
}
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,18 @@ trim_trailing_whitespace = true
[*.js]
indent_size = 2

[*.scss]
indent_size = 2

[*.css]
indent_size = 2

[package.json]
indent_size = 2

[package-lock.json]
indent_size = 2

[*.md]
indent_size = 2
trim_trailing_whitespace = false
Expand Down
11 changes: 9 additions & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,21 @@
*.ttf binary

# Exclude files from the archive
/.github/dependabot.yml export-ignore
/.github/workflows export-ignore
/.editorconfig export-ignore
/.gitattributes export-ignore
/.github export-ignore
/.gitignore export-ignore
/.styleci.yml export-ignore
Comment thread
terabytesoftw marked this conversation as resolved.
/codeception.yml export-ignore
/composer-require-checker.json export-ignore
/docs export-ignore
/ecs.php export-ignore
/infection.json* export-ignore
/phpstan*.neon* export-ignore
/phpunit.xml.dist export-ignore
/rector.php export-ignore
/runtime export-ignore
/scaffold-lock.json export-ignore
/tests export-ignore

# Avoid merge conflicts in CHANGELOG
Expand Down
11 changes: 11 additions & 0 deletions .github/linters/.editorconfig-checker.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"Exclude": [
"phpstan-baseline\\.neon$",
"^tests/runtime/",
"\\.min\\.css$",
"\\.min\\.js$",
"^vendor/",
"^runtime/",
"scaffold-lock\\.json$"
]
}
2 changes: 1 addition & 1 deletion .github/linters/.gitleaks.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
title = "gitleaks config"

[[allowlists]]
[allowlist]
Comment thread
terabytesoftw marked this conversation as resolved.
Comment thread
terabytesoftw marked this conversation as resolved.
description = "Allow test fixture data with dummy credentials"
paths = [
'''tests/support/data/.*\.php''',
Expand Down
12 changes: 9 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# AI agents (if present)
.codex
.claude

# codecoverage (if present)
code_coverage

Expand All @@ -24,13 +28,14 @@ nbproject
# node_modules (if present)
node_modules
package-lock.json

# phpstorm project (if present)
.idea
!src/assets/package-lock.json

# phpactor (if present)
.phpactor.*

# phpstorm project (if present)
.idea

# phpunit (if present)
.phpunit.cache
.phpunit.result.cache
Expand All @@ -52,3 +57,4 @@ Thumbs.db
.buildpath
.project
.settings
phpunit.xml
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@ tests/runtime/**

# Tool configs maintained by hand to keep their array order meaningful.
composer-require-checker.json

# Auto-generated by yii2-extensions/scaffold; never hand-edited.
scaffold-lock.json
2 changes: 1 addition & 1 deletion .styleci.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
preset: psr12
risky: true

version: 8.1
version: 8.3

finder:
exclude:
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## 0.3.0 Under development

- feat!: ship `ecs.php` and `rector.php` wrappers from `src/config/` via `scaffold.json`; metadata moves to `php-forge/baseline`.

## 0.2.0 May 04, 2026

- docs: add social media badge for following on X in `README.md`.
Expand Down
84 changes: 31 additions & 53 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,29 @@
<em>Share one set of rules across multiple repositories via Composer.</em>
</p>

## Features
## System requirements

<picture>
<source media="(min-width: 768px)" srcset="./docs/svgs/features.svg">
<img src="./docs/svgs/features-mobile.svg" alt="Feature Overview" style="width: 100%;">
</picture>
- [`PHP`](https://www.php.net/downloads) 8.3 or higher.
- [`Composer`](https://getcomposer.org/download/) for dependency management.

## Installation

```bash
composer require php-forge/coding-standard:^0.2 --dev
composer require php-forge/coding-standard:^0.3 --dev
```

Or add the dependency manually to `composer.json`:

```json
{
"require-dev": {
"php-forge/coding-standard": "^0.3"
}
}
```

Then run `composer update`.

## Configuration files

This package ships shared ECS and Rector configurations under
Expand Down Expand Up @@ -127,15 +137,11 @@ return static function (RectorConfig $rectorConfig): void {
};
```

## Scaffolded distribution (optional)
## Scaffolded distribution

This package is also a [`yii2-extensions/scaffold`](https://github.com/yii2-extensions/scaffold) provider.

When the scaffold plugin is installed and authorized, `composer install` distributes the canonical metadata and
super-linter configs into your repository root automatically; so the ECS / Rector wrappers above and the shared linter
rules stay in lock-step across every repository that opts in.

Opt in by adding the plugin and authorizing this package as a provider:
This package is a [`yii2-extensions/scaffold`](https://github.com/yii2-extensions/scaffold) provider for the
**root `ecs.php` and `rector.php` wrapper templates** (sourced from `src/config/` via `scaffold.json`). Consumers can
opt in by allowing the plugin and listing this package as an authorised provider:

```bash
composer require yii2-extensions/scaffold:^0.1 --dev
Expand All @@ -150,6 +156,7 @@ composer require yii2-extensions/scaffold:^0.1 --dev
},
"extra": {
"scaffold": {
"auto": false,
"allowed-packages": [
"php-forge/coding-standard"
]
Expand All @@ -158,45 +165,20 @@ composer require yii2-extensions/scaffold:^0.1 --dev
}
```

On the next `composer install` / `composer update`, these files land in your repository root:

| File | Mode | Purpose |
| ------------------------------------ | ---------- | -------------------------------------------------------- |
| `.editorconfig` | `replace` | Editor settings (UTF-8, LF, indent) |
| `.gitattributes` | `replace` | Text/binary handling, archive excludes |
| `.gitignore` | `append` | Common ignore patterns; project-specific lines preserved |
| `.styleci.yml` | `replace` | StyleCI config (PSR-12 + risky) |
| `.ecrc` | `replace` | editor-config-checker exclusions |
| `.prettierignore` | `replace` | Paths Prettier should skip |
| `.prettierrc.json` | `replace` | Prettier formatting rules |
| `.stylelintignore` | `replace` | Paths stylelint should skip |
| `composer-require-checker.json` | `preserve` | Composer require-checker whitelist (project-specific) |
| `.github/linters/actionlint.yml` | `replace` | actionlint config for Super-Linter |
| `.github/linters/.codespellrc` | `replace` | codespell config |
| `.github/linters/.gitleaks.toml` | `replace` | gitleaks config |
| `.github/linters/.markdown-lint.yml` | `replace` | markdownlint config |
| `ecs.php` | `preserve` | ECS wrapper for the project root |
| `rector.php` | `preserve` | Rector wrapper for the project root |

Mode semantics:

- `replace`: lock-step with this package. Local edits trigger a warning and the file is skipped on update.
Use `vendor/bin/scaffold reapply <file> --force` to re-sync.
- `append`: provider content is appended to the existing file. Project lines are never blown away.
- `preserve`: file is written once on first install and never overwritten.

The scaffolded `ecs.php` / `rector.php` ship with `83` as the default PHP target; switch to `81`, `82`, or `84` to match
your minimum PHP version. Mode `preserve` protects your edits across `composer update`.

### Scaffold commands
With `auto: false`, the plugin does not run on `composer install`; sync the wrappers manually:

```bash
vendor/bin/scaffold status # show which files are synced/modified/missing
vendor/bin/scaffold diff <file> # diff between local and provider version
vendor/bin/scaffold reapply [<file>] [--force] # re-apply provider content
vendor/bin/scaffold eject <file> # stop tracking a file (kept on disk)
vendor/bin/scaffold reapply --provider=php-forge/coding-standard
```

Both wrappers ship in mode `preserve`; written once on first install, never overwritten so consumer edits to paths
or PHP target version survive subsequent runs.

## Related packages

For dev environment scaffolding, see [`php-forge/baseline`](https://github.com/php-forge/baseline). The two packages
are independent; adopt either, both, or neither.

## Composer scripts

Follow the same convention used across PHP Forge repositories:
Expand All @@ -210,10 +192,6 @@ Follow the same convention used across PHP Forge repositories:
}
```

## Documentation

- 📚 [Installation Guide](docs/installation.md)

## Package information

[![PHP](https://img.shields.io/badge/%3E%3D8.3-777BB4.svg?style=for-the-badge&logo=php&logoColor=white)](https://www.php.net/releases/8.3/en.php)
Expand Down
41 changes: 16 additions & 25 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "php-forge/coding-standard",
"type": "library",
"description": "Centralized ECS, Rector, and tooling configurations for PHP projects.",
"description": "Centralized ECS and Rector configurations for PHP projects.",
"keywords": [
"coding-standard",
"ecs",
Expand All @@ -10,11 +10,17 @@
"scaffold-provider"
],
"license": "BSD-3-Clause",
"minimum-stability": "dev",
"prefer-stable": true,
"require": {
"php": ">=8.3",
"rector/rector": "^2.1",
"symplify/easy-coding-standard": "^13.0"
},
"require-dev": {
"php-forge/baseline": "dev-main",
"yii2-extensions/scaffold": "dev-main"
},
"autoload": {
"psr-4": {
"PHPForge\\CodingStandard\\": "./"
Expand All @@ -25,33 +31,18 @@
"dev-main": "0.3.x-dev"
},
"scaffold": {
"copy": [
".editorconfig",
".gitattributes",
".gitignore",
".styleci.yml",
".ecrc",
".prettierignore",
".prettierrc.json",
".stylelintignore",
"composer-require-checker.json",
".github/linters/actionlint.yml",
".github/linters/.codespellrc",
".github/linters/.gitleaks.toml",
".github/linters/.markdown-lint.yml",
"ecs.php",
"rector.php"
],
"modes": {
".gitignore": "append",
"composer-require-checker.json": "preserve",
"ecs.php": "preserve",
"rector.php": "preserve"
}
"manifest": "scaffold.json",
"auto": false,
"allowed-packages": [
"php-forge/baseline"
]
}
},
"config": {
"sort-packages": true
"sort-packages": true,
"allow-plugins": {
"yii2-extensions/scaffold": true
}
},
"scripts": {
"ecs": "./vendor/bin/ecs check src --config src/ecs-83.php --fix",
Expand Down
38 changes: 0 additions & 38 deletions docs/installation.md

This file was deleted.

Loading
Loading