定制 yii2-extensions/app-base 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱: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

yii2-extensions/app-base 适用场景与选型建议

yii2-extensions/app-base 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 33 次下载、GitHub Stars 达 1, 最近一次更新时间为 2026 年 04 月 22 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「sqlite」 「backend」 「scaffold」 「rbac」 「yii2」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 yii2-extensions/app-base 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 yii2-extensions/app-base 我们能提供哪些服务?
定制开发 / 二次开发

基于 yii2-extensions/app-base 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

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