Shared Yii2 backend distributed as a yii2-extensions/scaffold provider
User model, auth, RBAC, migrations, mail, console, web entrypoints.
app-base is not a runtime library; there is no class to extend or service to register.
It is a yii2-extensions/scaffold provider ; a package that declares a set of files to copy into a
consumer project.
On composer install, the scaffold plugin reads scaffold.json from this package and copies src/, config/, rbac/,
resources/, public/ and yii into the consumer root. Files that are marked as preserve (configs, RBAC, runtime
assets) are only written once, so your edits survive subsequent installs.
See docs/scaffold.md for the detailed walkthrough.
- PHP
>=8.3 yiisoft/yii2^22.0@devyii2-extensions/scaffold^0.1@dev- A frontend overlay provider for views, CSS, and JS ; see docs/frontend-overlays.md.
Create a new directory for your app, drop in this composer.json, then run composer install:
{
"name": "my-company/my-app",
"type": "project",
"minimum-stability": "dev",
"prefer-stable": true,
"require": {
"php": ">=8.3",
"yii2-extensions/app-base": "^22.0@dev",
"yii2-extensions/app-jquery": "^22.0@dev"
},
"require-dev": {
"yii2-extensions/scaffold": "^0.1@dev"
},
"extra": {
"scaffold": {
"allowed-packages": [
"yii2-extensions/app-base",
"yii2-extensions/app-jquery"
]
},
"yii\\composer\\Installer::postCreateProject": {
"setPermission": [
{
"runtime": "0775",
"public/assets": "0775",
"yii": "0755"
}
]
},
"yii\\composer\\Installer::postInstall": {
"generateCookieValidationKey": [
"config/web.php"
]
}
},
"config": {
"allow-plugins": {
"yii2-extensions/scaffold": true,
"yiisoft/yii2-composer": true
}
},
"scripts": {
"post-create-project-cmd": [
"yii\\composer\\Installer::postCreateProject",
"yii\\composer\\Installer::postInstall"
],
"post-install-cmd": [
"yii\\composer\\Installer::postInstall"
]
}
}Then:
composer install # scaffold copies the tree in + autogenerates cookieValidationKey
./yii migrate # creates the user table + admin user
php -S localhost:8080 -t public public/router.php # start the dev serverFull walkthrough: docs/installation.md.
After composer install, the consumer project tree looks like this:
your-app/
├── src/
│ ├── controllers/ SiteController, UserController
│ ├── models/ User ActiveRecord + 8 form models + UserSearch
│ ├── migrations/ CreateUserTable, CreateAdminUser
│ └── commands/ HelloController (console entry-point example)
├── config/ [preserve] web.php, console.php, db.php, params.php, test.php, test_db.php
├── rbac/ [preserve] items.php, rules.php, assignments.php
├── resources/
│ ├── mail/ HTML + text templates (emailVerify, passwordResetToken) + layouts
│ └── views/ layouts/main, site/*, user/* ; rendered by the frontend overlay
├── public/ index.php, index-test.php, router.php (built-in server), assets/, images/
├── runtime/ [preserve] .gitignore (cache, logs, db.sqlite land here)
├── yii Console entry point
└── scaffold.json Provider manifest (copy paths, per-file modes)
[preserve] = scaffold writes the file once and never overwrites it on subsequent composer install runs. All other
paths are refreshed from the provider stubs unless you explicitly scaffold eject them.
- CSS, JS, widgets, and asset bundles ; owned by frontend overlays such as
yii2-extensions/app-jquery. - Server configuration (
.htaccess,nginx.conf,Caddyfile,.rr.yaml); lives in dedicatedyii2-extensions/server-*providers.
For detailed configuration, scaffold internals, and consumer setup.