yii2-extensions/app-base 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

yii2-extensions/app-base

Composer 安装命令:

composer require yii2-extensions/app-base

包简介

Shared Yii2 backend scaffold: models, controllers, migrations, RBAC, mail templates, and CLI.

README 文档

README

Yii Framework

App Base


Build Codecov PHPStan

Shared Yii2 backend distributed as a yii2-extensions/scaffold provider
User model, auth, RBAC, migrations, mail, console, web entrypoints.

Features

Feature Overview

What is a scaffold provider?

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.

Requirements

  • PHP >=8.3
  • yiisoft/yii2 ^22.0@dev
  • yii2-extensions/scaffold ^0.1@dev
  • A frontend overlay provider for views, CSS, and JS ; see docs/frontend-overlays.md.

Quick start

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 server

Full walkthrough: docs/installation.md.

What ships

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.

Not included (by design)

  • 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 dedicated yii2-extensions/server-* providers.

Documentation

For detailed configuration, scaffold internals, and consumer setup.

Package information

PHP Yii 22.0.x Latest Stable Version Total Downloads

Quality code

PHPStan Level Max Super-Linter StyleCI

Our social networks

Follow on X

License

License

统计信息

  • 总下载量: 33
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 10
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2026-04-22