Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

28 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Yii Framework

Scaffold


Build Mutation PHPStan Security

Declarative multi-layer file scaffolding for PHP projects
via Composer providers and a Console CLI

Features

Feature Overview

Installation

composer require yii2-extensions/scaffold:^0.1
composer config allow-plugins.yii2-extensions/scaffold true

Declare 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"]
        }
    }
}

Configuration

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"
            ]
        }
    }
}

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).

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 tracking

See docs/console.md for the full reference.

Documentation

Package information

PHP Latest Stable Version Total Downloads

Project status

PHPStan Level Max Quality StyleCI

Our social networks

Follow on X Follow on Facebook Join our Subreddit Join on Telegram

License

License

About

Composer plugin for composable Yii2 application scaffolds: replace / preserve / append / prepend modes, sha256-tracked lock, and scaffold/* CLI commands.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages