Declarative multi-layer file scaffolding for PHP projects
via Composer providers and a Console CLI
composer require yii2-extensions/scaffold:^0.1
composer config allow-plugins.yii2-extensions/scaffold trueDeclare the providers that are permitted to write files into your project:
{
"extra": {
"scaffold": {
"allowed-packages": [
"yii2-extensions/app-base"
]
}
}
}Run composer install to trigger the scaffold process. Commit scaffold-lock.json to version control.
To opt out of auto-trigger and manage updates manually via vendor/bin/scaffold, set auto: false (see
Configuration Reference):
{
"extra": {
"scaffold": {
"auto": false,
"allowed-packages": ["yii2-extensions/app-base"]
}
}
}Minimal composer.json for a project using one scaffold provider:
{
"require": {
"yii2-extensions/scaffold": "^0.1",
"yii2-extensions/app-base": "^0.1"
},
"config": {
"allow-plugins": {
"yii2-extensions/scaffold": true
}
},
"extra": {
"scaffold": {
"allowed-packages": [
"yii2-extensions/app-base"
]
}
}
}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 |
|---|---|
vendor/bin/scaffold status |
Prints a table comparing every tracked file's on-disk hash to the one recorded in scaffold-lock.json (synced / modified / missing). |
vendor/bin/scaffold providers |
Lists every provider recorded in scaffold-lock.json and how many files each one contributed. |
vendor/bin/scaffold diff <file> |
Shows a line-by-line diff between the provider stub and the current on-disk file. |
vendor/bin/scaffold reapply [file] [--force] [--provider=<name>] |
Re-copies stubs from vendor/ to the project, updating lock hashes on success. Without --force, user-modified files are reported and skipped. |
vendor/bin/scaffold eject <file> [--yes] |
Removes a file entry from scaffold-lock.json without deleting the file from disk. Without --yes only previews the change. |
Typical post-install workflow:
vendor/bin/scaffold status # what changed
vendor/bin/scaffold diff config/params.php # review one file
vendor/bin/scaffold reapply config/params.php --force # accept stub version
# or
vendor/bin/scaffold eject config/params.php --yes # keep yours, stop trackingSee docs/console.md for the full reference.
- π Installation Guide
- βοΈ Configuration Reference
- π¦ Creating Providers
- π File Modes
- π₯οΈ Console Commands
- π§ͺ Testing Guide