millipress / millibase
Declarative WordPress settings framework. Define your settings page in PHP arrays — sections, fields, tabs, validation — and get a React UI automatically.
v1.2.1
2026-03-12 09:47 UTC
Requires
- php: >=7.4
Requires (Dev)
- pestphp/pest: ^2.0
- php-stubs/wordpress-stubs: ^6.0
- phpstan/extension-installer: ^1.3
- phpstan/phpstan: @stable
- szepeviktor/phpstan-wordpress: ^1.3
- wp-coding-standards/wpcs: ^3.0
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
composer require millipress/millibase
use MilliBase\Manager; $manager = new Manager([ 'slug' => 'my-plugin', 'option_name' => 'my_plugin_settings', 'page_title' => 'My Plugin', 'menu_title' => 'My Plugin', 'rest_namespace' => 'my-plugin/v1', 'basename' => plugin_basename(__FILE__), 'header' => ['title' => 'My Plugin Settings'], 'tabs' => [ [ 'name' => 'general', 'title' => 'General', 'sections' => [ [ 'id' => 'main', 'title' => 'Main Settings', 'fields' => [ [ 'key' => 'general.enabled', 'type' => 'toggle', 'label' => 'Enable Feature', '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
- 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
- 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 — save, reset, restore, status, and custom action endpoints
Documentation
Full documentation is in the docs/ directory:
- Introduction
- Installation
- Configuration
- Schema Definition
- Programmatic Access
- Custom Field Types
- Custom Tab Components
- Extending with Filters
- Reference: Field Types · Settings API · Hooks & Filters
License
GPL-2.0-or-later