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
4 changes: 2 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ indent_style = space
indent_size = 4
trim_trailing_whitespace = true

[*.js]
[*.{cjs,js,mjs}]
indent_size = 2

[*.scss]
Expand All @@ -26,7 +26,7 @@ indent_size = 2
indent_size = 2

[*.md]
indent_size = 2
indent_size = unset
trim_trailing_whitespace = false

[*.php]
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ composer.lock
.github/prompts/**
.github/skills/**

# internal notes (if present)
internal

# mac ds_store (if present)
.DS_Store

Expand Down
5 changes: 1 addition & 4 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,8 @@ vendor/**
# Dependency lockfile ignored by git.
composer.lock

# Invalid JSON fixture intentionally cannot be parsed by Prettier.
tests/fixtures/providers/malformed-manifest/scaffold.json

# License texts ship verbatim.
**/LICENSE*

# Auto-generated by yii2-extensions/scaffold.
# Auto-generated by php-forge/scaffold.
scaffold-lock.json
10 changes: 9 additions & 1 deletion .prettierrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"printWidth": 80,
"overrides": [
{
"files": ["**/*.{yml,yaml}"],
"files": ["**/*.{cjs,css,js,mjs,yml,yaml}"],
"options": {
"tabWidth": 2
}
Expand All @@ -15,8 +15,16 @@
"files": "**/*.md",
"options": {
"embeddedLanguageFormatting": "off",
"printWidth": 120,
"proseWrap": "always",
"tabWidth": 2
}
},
{
"files": "CHANGELOG.md",
"options": {
"proseWrap": "preserve"
}
}
]
}
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ 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.2.1 Under development
## 0.3.0 Under development

- feat!: rename package to `php-forge/scaffold` with namespace `PHPForge\Scaffold`; update `require`, `allow-plugins` and class references.

## 0.2.0 July 04, 2026

Expand Down
62 changes: 30 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,31 @@
<!-- markdownlint-disable MD041 -->
<p align="center">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://www.yiiframework.com/image/design/logo/yii3_full_for_dark.svg">
<source media="(prefers-color-scheme: light)" srcset="https://www.yiiframework.com/image/design/logo/yii3_full_for_light.svg">
<img src="https://www.yiiframework.com/image/design/logo/yii3_full_for_light.svg" alt="Yii Framework" width="80%">
</picture>
<a href="https://github.com/php-forge/scaffold" target="_blank">
<img src="https://avatars.githubusercontent.com/u/103309199?s=400&u=ca3561c692f53ed7eb290d3bb226a2828741606f&v=4" width="30%" alt="PHP Forge">
</a>
<h1 align="center">Scaffold</h1>
<br>
</p>
<!-- markdownlint-enable MD041 -->

<p align="center">
<a href="https://github.com/yii2-extensions/scaffold/actions/workflows/build.yml" target="_blank">
<img src="https://img.shields.io/github/actions/workflow/status/yii2-extensions/scaffold/build.yml?style=for-the-badge&logo=github&label=Build" alt="Build">
<a href="https://github.com/php-forge/scaffold/actions/workflows/build.yml" target="_blank">
<img src="https://img.shields.io/github/actions/workflow/status/php-forge/scaffold/build.yml?style=for-the-badge&label=PHPUnit&logo=github" alt="PHPUnit">
</a>
<a href="https://github.com/yii2-extensions/scaffold/actions/workflows/mutation.yml" target="_blank">
<img src="https://img.shields.io/github/actions/workflow/status/yii2-extensions/scaffold/mutation.yml?style=for-the-badge&logo=github&label=Mutation" alt="Mutation">
<a href="https://dashboard.stryker-mutator.io/reports/github.com/php-forge/scaffold/main" target="_blank">
<img src="https://img.shields.io/endpoint?style=for-the-badge&url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.com%2Fphp-forge%2Fscaffold%2Fmain" alt="Mutation Testing">
</a>
<a href="https://github.com/yii2-extensions/scaffold/actions/workflows/static.yml" target="_blank">
<img src="https://img.shields.io/github/actions/workflow/status/yii2-extensions/scaffold/static.yml?style=for-the-badge&logo=github&label=PHPStan" alt="PHPStan">
<a href="https://github.com/php-forge/scaffold/actions/workflows/static.yml" target="_blank">
<img src="https://img.shields.io/github/actions/workflow/status/php-forge/scaffold/static.yml?style=for-the-badge&label=PHPStan&logo=github" alt="PHPStan">
</a>
<a href="https://github.com/yii2-extensions/scaffold/actions/workflows/security.yml" target="_blank">
<img src="https://img.shields.io/github/actions/workflow/status/yii2-extensions/scaffold/security.yml?style=for-the-badge&label=Security&logo=github" alt="Security">
<a href="https://github.com/php-forge/scaffold/actions/workflows/security.yml" target="_blank">
<img src="https://img.shields.io/github/actions/workflow/status/php-forge/scaffold/security.yml?style=for-the-badge&label=Security&logo=github" alt="Security">
</a>
</p>

<p align="center">
<strong>Declarative multi-layer file scaffolding for PHP projects<br>via Composer providers and a Console CLI</strong>
<strong>Declarative multi-layer file scaffolding for PHP projects</strong><br>
<em>Distribute project files through Composer providers and manage them with a standalone Console CLI.</em>
</p>

## Features
Expand All @@ -39,18 +38,19 @@
## Installation

```bash
composer require yii2-extensions/scaffold:^0.1
composer config allow-plugins.yii2-extensions/scaffold true
composer config allow-plugins.php-forge/scaffold true
composer require php-forge/scaffold:^0.3
```

Declare the providers that are permitted to write files into your project:
Install your scaffold providers, then declare which are permitted to write files into your project:

```json
{
"extra": {
"scaffold": {
"allowed-packages": [
"yii2-extensions/app-base"
"php-forge/baseline",
"php-forge/coding-standard"
]
}
}
Expand All @@ -67,31 +67,31 @@ To opt out of auto-trigger and manage updates manually via `vendor/bin/scaffold`
"extra": {
"scaffold": {
"auto": false,
"allowed-packages": ["yii2-extensions/app-base"]
"allowed-packages": ["php-forge/baseline", "php-forge/coding-standard"]
}
}
}
```

## Configuration

Minimal `composer.json` for a project using one scaffold provider:
Scaffold configuration for a project with `php-forge/baseline` and `php-forge/coding-standard` already installed:

```json
{
"require": {
"yii2-extensions/scaffold": "^0.1",
"yii2-extensions/app-base": "^0.1"
"php-forge/scaffold": "^0.3"
},
"config": {
"allow-plugins": {
"yii2-extensions/scaffold": true
"php-forge/scaffold": true
}
},
"extra": {
"scaffold": {
"allowed-packages": [
"yii2-extensions/app-base"
"php-forge/baseline",
"php-forge/coding-standard"
]
}
}
Expand All @@ -100,8 +100,8 @@ Minimal `composer.json` for a project using one scaffold provider:

## Console commands

After `composer install`, the plugin ships a standalone Symfony Console CLI at `vendor/bin/scaffold`
that works in any PHP project (Yii2, Yii3, Laravel, Symfony, plain PHP).
After `composer install`, the plugin ships a standalone Symfony Console CLI at `vendor/bin/scaffold` that works in any
PHP project (Yii2, Yii3, Laravel, Symfony, plain PHP).

| Command | What it does |
| ------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------ |
Expand Down Expand Up @@ -136,21 +136,19 @@ See [`docs/console.md`](docs/console.md) for the full reference.
## 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)
[![Latest Stable Version](https://img.shields.io/packagist/v/yii2-extensions/scaffold.svg?style=for-the-badge&logo=packagist&logoColor=white&label=Stable)](https://packagist.org/packages/yii2-extensions/scaffold)
[![Total Downloads](https://img.shields.io/packagist/dt/yii2-extensions/scaffold.svg?style=for-the-badge&logo=composer&logoColor=white&label=Downloads)](https://packagist.org/packages/yii2-extensions/scaffold)
[![Latest Stable Version](https://img.shields.io/packagist/v/php-forge/scaffold.svg?style=for-the-badge&logo=packagist&logoColor=white&label=Stable)](https://packagist.org/packages/php-forge/scaffold)
[![Total Downloads](https://img.shields.io/packagist/dt/php-forge/scaffold.svg?style=for-the-badge&logo=composer&logoColor=white&label=Downloads)](https://packagist.org/packages/php-forge/scaffold)

## Project status

[![PHPStan Level Max](https://img.shields.io/badge/PHPStan-Level%20Max-4F5D95.svg?style=for-the-badge&logo=github&logoColor=white)](https://github.com/yii2-extensions/scaffold/actions/workflows/static.yml)
[![Quality](https://img.shields.io/github/actions/workflow/status/yii2-extensions/scaffold/quality.yml?style=for-the-badge&label=Quality&logo=github)](https://github.com/yii2-extensions/scaffold/actions/workflows/quality.yml)
[![PHPStan Level Max](https://img.shields.io/badge/PHPStan-Level%20Max-4F5D95.svg?style=for-the-badge&logo=github&logoColor=white)](https://github.com/php-forge/scaffold/actions/workflows/static.yml)
[![Quality](https://img.shields.io/github/actions/workflow/status/php-forge/scaffold/quality.yml?style=for-the-badge&label=Quality&logo=github)](https://github.com/php-forge/scaffold/actions/workflows/quality.yml)
[![StyleCI](https://img.shields.io/badge/StyleCI-Passed-44CC11.svg?style=for-the-badge&logo=github&logoColor=white)](https://github.styleci.io/repos/1212894073?branch=main)

## Our social networks

[![Follow on X](https://img.shields.io/badge/-Follow%20on%20X-1DA1F2.svg?style=for-the-badge&logo=x&logoColor=white&labelColor=000000)](https://x.com/Terabytesoftw)
[![Follow on Facebook](https://img.shields.io/badge/-Follow%20on%20Facebook-1877F2.svg?style=for-the-badge&logo=facebook&logoColor=white&labelColor=000000)](https://www.facebook.com/wilmer.arambula.9)
[![Join our Subreddit](https://img.shields.io/badge/-Join%20our%20Subreddit-FF4500.svg?style=for-the-badge&logo=reddit&logoColor=white&labelColor=000000)](https://www.reddit.com/r/Yii2/)
[![Join on Telegram](https://img.shields.io/badge/-Join%20on%20Telegram-26A5E4.svg?style=for-the-badge&logo=telegram&logoColor=white&labelColor=000000)](https://t.me/yii_framework_in_english)

## License

Expand Down
6 changes: 3 additions & 3 deletions bin/scaffold
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
declare(strict_types=1);

/**
* Standalone entry point for the `yii2-extensions/scaffold` Symfony Console application.
* Standalone entry point for the `php-forge/scaffold` Symfony Console application.
*
* Resolves its Composer autoloader whether invoked from the plugin's own `bin/scaffold` (development) or from a
* consumer's `vendor/bin/scaffold` (production). Any PHP project that requires `yii2-extensions/scaffold` can run
* consumer's `vendor/bin/scaffold` (production). Any PHP project that requires `php-forge/scaffold` can run
* this binary without needing a framework.
*/

use yii\scaffold\Console\Application;
use PHPForge\Scaffold\Console\Application;

foreach (
[
Expand Down
13 changes: 7 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{
"name": "yii2-extensions/scaffold",
"name": "php-forge/scaffold",
"type": "composer-plugin",
"description": "Declarative multi-layer file scaffolding for PHP projects via Composer providers and a Symfony Console CLI.",
"keywords": [
"yii2-extensions",
"php",
"php-forge",
"composer-plugin",
"scaffold",
"scaffolding",
Expand Down Expand Up @@ -41,16 +42,16 @@
},
"autoload": {
"psr-4": {
"yii\\scaffold\\": "src/"
"PHPForge\\Scaffold\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"yii\\scaffold\\tests\\": "tests/"
"PHPForge\\Scaffold\\Tests\\": "tests/"
}
},
"extra": {
"class": "yii\\scaffold\\Plugin",
"class": "PHPForge\\Scaffold\\Plugin",
"branch-alias": {
"dev-main": "0.3.x-dev"
}
Expand All @@ -66,7 +67,7 @@
"check-dependencies": "./vendor/bin/composer-require-checker check",
"ecs": "./vendor/bin/ecs --fix",
"mutation": "./vendor/bin/infection --threads=4 --ignore-msi-with-no-mutations --min-msi=85 --min-covered-msi=85",
"mutation-static": "./vendor/bin/infection --threads=4 --ignore-msi-with-no-mutations --min-msi=100 --min-covered-msi=100 --static-analysis-tool=phpstan --static-analysis-tool-options='--memory-limit=-1'",
"mutation-static": "php -d memory_limit=-1 ./vendor/bin/infection --initial-tests-php-options='-d memory_limit=-1' --test-framework-extra-args='-d memory_limit=-1' --threads=4 --ignore-msi-with-no-mutations --min-msi=100 --min-covered-msi=100 --static-analysis-tool=phpstan --static-analysis-tool-options='--memory-limit=-1'",
"rector": "./vendor/bin/rector process",
"static": "./vendor/bin/phpstan --memory-limit=-1",
"tests": "./vendor/bin/phpunit"
Expand Down
49 changes: 24 additions & 25 deletions docs/configuration.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Configuration reference

All scaffold configuration lives under the `extra.scaffold` key in the root project's `composer.json`.
Provider packages are never trusted unless they appear in `allowed-packages`.
All scaffold configuration lives under the `extra.scaffold` key in the root project's `composer.json`. Provider packages
are never trusted unless they appear in `allowed-packages`.

## allowed-packages

Expand All @@ -12,17 +12,16 @@ Provider packages are never trusted unless they appear in `allowed-packages`.
"extra": {
"scaffold": {
"allowed-packages": [
"yii2-extensions/app-base",
"yii2-extensions/app-nginx",
"yii2-extensions/app-vue"
"php-forge/baseline",
"php-forge/coding-standard"
]
}
}
}
```

**Ordering matters.** When two providers declare the same destination file, the provider listed **later** wins.
This allows specialised layers to override base-layer defaults without forking them.
**Ordering matters.** When two providers declare the same destination file, the provider listed **later** wins. This
allows specialised layers to override base-layer defaults without forking them.

If the list is empty or absent the plugin writes a notice and exits without modifying any files.

Expand All @@ -42,65 +41,65 @@ If the list is empty or absent the plugin writes a notice and exits without modi
}
```

When `auto: false`, the plugin remains installed and authorised but does not hook into Composer events.
The CLI commands at `vendor/bin/scaffold` continue to work, so the consumer can sync provider templates
on demand:
When `auto: false`, the plugin remains installed and authorised but does not hook into Composer events. The CLI commands
at `vendor/bin/scaffold` continue to work, so the consumer can sync provider templates on demand:

```bash
vendor/bin/scaffold reapply --provider=php-forge/baseline
vendor/bin/scaffold diff <file>
vendor/bin/scaffold status
```

Use this when **explicit, opt-in updates** matter more than continuous synchronisation, for example on
repositories where every change to project standards should be reviewed before being applied.
Use this when **explicit, opt-in updates** matter more than continuous synchronisation, for example on repositories
where every change to project standards should be reviewed before being applied.

Only an explicit `false` disables the auto-trigger; missing, `null`, non-boolean, or any other value defaults to
enabled to avoid silent disable on typo.
Only an explicit `false` disables the auto-trigger; missing, `null`, non-boolean, or any other value defaults to enabled
to avoid silent disable on typo.

## Full annotated example

Scaffold configuration for a project with `php-forge/baseline` and `php-forge/coding-standard` already installed:

```json
{
"require": {
"yii2-extensions/scaffold": "^0.1",
"yii2-extensions/app-base": "^0.1"
"php-forge/scaffold": "^0.3"
},
"config": {
"allow-plugins": {
"yii2-extensions/scaffold": true
"php-forge/scaffold": true
}
},
"extra": {
"scaffold": {
"allowed-packages": ["yii2-extensions/app-base"]
"allowed-packages": ["php-forge/baseline", "php-forge/coding-standard"]
}
}
}
```

## scaffold-lock.json

The plugin writes `scaffold-lock.json` at the project root after every successful run.
It records the SHA-256 hash, provider name, source path, and mode for every file it has written.
The plugin writes `scaffold-lock.json` at the project root after every successful run. It records the SHA-256 hash,
provider name, source path, and mode for every file it has written.

**Commit this file.** It serves the same role as `composer.lock`: it lets collaborators and CI
reproduce the exact scaffold state and detect files that have been modified after scaffolding.
**Commit this file.** It serves the same role as `composer.lock`: it lets collaborators and CI reproduce the exact
scaffold state and detect files that have been modified after scaffolding.

Example lock entry:

```json
{
"providers": {
"yii2-extensions/app-base": {
"php-forge/baseline": {
"version": "0.1.0",
"path": "vendor/yii2-extensions/app-base"
"path": "vendor/php-forge/baseline"
}
},
"files": {
"config/params.php": {
"hash": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"provider": "yii2-extensions/app-base",
"provider": "php-forge/baseline",
"source": "stubs/config/params.php",
"mode": "replace"
}
Expand Down
Loading
Loading