millipress/millibase
Composer 安装命令:
composer require millipress/millibase
包简介
Declarative WordPress settings framework. Define your settings page in PHP arrays — sections, fields, tabs, validation — and get a React UI automatically.
README 文档
README
Declarative WordPress settings framework. Define your settings page in PHP arrays — tabs, sections, fields, validation — and get a React-powered admin UI automatically.
Requirements
| Requirement | Version |
|---|---|
| PHP | >= 7.4 |
| WordPress | >= 6.0 |
Quick Start
⚠ Plugin authors: prefix MilliBase before shipping. If you bundle MilliBase inside a distributed plugin, you must vendor-prefix it with Strauss or php-scoper. Two plugins shipping the unprefixed
MilliBase\namespace will collide at runtime — only one copy will load, and the other plugin runs against a version it wasn't tested with. See Namespace Prefixing for setup and the rationale behind MilliBase's cross-prefix-tolerant typing.
composer require millipress/millibase
use MilliBase\Manager; $manager = new Manager( slug: 'my-plugin', config: fn() => [ 'page_title' => __( 'My Plugin', 'my-plugin' ), 'menu_title' => __( 'My Plugin', 'my-plugin' ), 'header' => [ 'title' => __( 'My Plugin Settings', 'my-plugin' ) ], 'tabs' => [ [ 'name' => 'general', 'title' => __( 'General', 'my-plugin' ), 'sections' => [ [ 'id' => 'main', 'title' => __( 'Main Settings', 'my-plugin' ), 'fields' => [ [ 'key' => 'general.enabled', 'type' => 'toggle', 'label' => __( 'Enable Feature', 'my-plugin' ), 'default' => true, ], ], ], ], ], ], ], ); // Programmatic access: $manager->settings()->get('general.enabled'); // true
Features
- Declarative schema — define tabs, sections, and fields in PHP arrays
- React admin UI — auto-generated from the schema using
@wordpress/components - 9 built-in field types — text, number, password, toggle, select, unit, token-list, color, code
- Custom extensibility — register custom field types and custom tab components from JS
- Provided components — reusable React UI on
window.MilliBase.components(InfoPopover,LabelWithTooltip) for custom tabs - Conditional display — show/hide fields based on other settings values
- Settings priority — constants > config file > database > defaults
- Encryption — automatic sodium encryption for sensitive fields (keys prefixed with
enc_) - Config file sync — write settings to PHP files for pre-WordPress access (blog-aware per-operation;
_network-<id>.phpmirror for network-mode) - Network mode —
'network' => trueroutes storage towp_sitemetaand the admin page to Network Admin - Migrations — declarative
name@versionone-shot runner with per-scope state (site / network) - Backup & restore — transient-based backup with 12-hour expiry
- Import / export — settings serialization with encryption handling
- Tab overrides — add-on plugins can extend or replace tabs and sections via filters
- REST API — namespaced
GET/POST /{namespace}/v1/settings+ custom action endpoints - WP-CLI — auto-registered
wp <slug> configcommands; two Managers sharing acli.slugauto-merge into one tree
Documentation
Full documentation is in the docs/ directory:
- Introduction
- Installation
- Configuration
- Schema Definition
- Programmatic Access
- WP-CLI Commands
- Migrations
- Network Settings
- Custom Field Types
- Custom Tab Components
- Extending with Filters
- Reference: Field Types · Settings API · Hooks & Filters · Namespace Prefixing
License
GPL-2.0-or-later
millipress/millibase 适用场景与选型建议
millipress/millibase 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3.96k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2026 年 03 月 06 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 millipress/millibase 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 millipress/millibase 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 3.96k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 36
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: GPL-2.0-or-later
- 更新时间: 2026-03-06