scafera/scaffold
Composer 安装命令:
composer require scafera/scaffold
包简介
Composer plugin that scaffolds framework files into Scafera projects
README 文档
README
Composer plugin that scaffolds framework-owned files into Scafera projects.
Provides: Composer plugin that copies framework-owned files (entry point, kernel bootstrap,
.gitignore, config examples) into Scafera projects oncomposer install/update. Files are always overwritten (exceptinitial-files, copied once) to keep framework and project in sync.Depends on: Composer 2+ (
composer-plugin-api ^2.0). Activates automatically for any installed package that declaresextra.scafera-scaffold.Extension points:
composer.json→extra.scafera-scaffold.files— logical keys mapped to source paths in the declaring package; always overwritten on installextra.scafera-scaffold.initial-files— literal target paths; copied once, never overwritten (intended for user-editable configs)extra.scafera-scaffold.target-map— architecture packages remap logical keys to project-specific paths (e.g.index.php→public/index.php)extra.scafera-scaffold.file-mapping— project-level opt-out ("public/index.php": falseto disable a scaffolded file)- Convention — package-side scaffold sources live under
support/scaffold/at the package rootNot responsible for: Code generation (use
scafera make:controller,make:service,make:commandfrom the architecture package — e.g.scafera/layered) · application scaffolding (only framework-owned files are copied) · modifying user-authored code · conflict resolution beyond last-package-wins for duplicate logical keys.
How It Works
Scafera packages declare which files they provide. The plugin collects these declarations from all installed packages and copies the files into the project.
composer install
→ plugin reads declarations from installed packages
→ copies files to project
→ creates directories as needed
Package Declaration
Packages declare scaffold files in their composer.json under extra.scafera-scaffold.
files — Always Overwritten
Use a logical key (not a path) to identify each file. The key decouples the file identity from its target location.
{
"extra": {
"scafera-scaffold": {
"files": {
"index.php": "support/scaffold/public/index.php"
}
}
}
}
The logical key is used as the default target path. To place the file elsewhere, an architecture package provides a target-map (see below).
initial-files — Created Once
Files that are only copied if the target does not already exist. Useful for configuration files that the developer is expected to modify.
{
"extra": {
"scafera-scaffold": {
"initial-files": {
"config/config.yaml": "support/scaffold/config/config.example.yaml"
}
}
}
}
Unlike files, initial files use literal target paths (not logical keys).
target-map — Control Placement
Architecture packages can remap where a logical key is placed without duplicating the source file.
{
"extra": {
"scafera-scaffold": {
"target-map": {
"index.php": "public/index.php"
}
}
}
}
This tells the plugin: place the file identified by index.php at public/index.php. The source remains in the kernel — no duplication.
A different architecture package could remap the same key:
{
"target-map": {
"index.php": "web/index.php"
}
}
Project-Level Overrides
Projects can disable specific scaffolded files via file-mapping:
{
"extra": {
"scafera-scaffold": {
"file-mapping": {
"public/index.php": false
}
}
}
}
Disabled files are skipped during scaffolding with a console message.
File Placement Convention
Packages that provide scaffold files should place them under support/scaffold/ at the package root:
my-package/
├── src/
├── support/
│ └── scaffold/
│ └── public/
│ └── index.php
└── composer.json
Conflict Resolution
If multiple packages declare the same logical key, the last package processed wins. Package order is determined by Composer's dependency resolution.
Console Output
The plugin logs every action during scaffolding:
Scafera: scaffolding project files...
.gitignore → .gitignore (from scafera/layered)
config/config.example.yaml → config/config.example.yaml (from scafera/kernel)
index.php → public/index.php (from scafera/kernel)
Skipped: .gitignore (already exists)
Scafera: 3 file(s) scaffolded.
Requirements
- PHP >= 8.4
License
MIT
scafera/scaffold 适用场景与选型建议
scafera/scaffold 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 15 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 04 月 13 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「scaffold」 「composer-plugin」 「scafera」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 scafera/scaffold 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 scafera/scaffold 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 scafera/scaffold 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Extend Laravel's generators scaffold.
Composer plugin for preserving custom paths and supporting nested packages
Composer plugin
Composer plugin that automatically creates directories defined in your composer.json.
Allows you to defined CMS form structure via config.yml
Composer plugin that verifies GitHub build-provenance attestations for the packages you install
统计信息
- 总下载量: 15
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 28
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-04-13