millipress/millibase

Declarative WordPress settings framework. Define your settings page in PHP arrays — sections, fields, tabs, validation — and get a React UI automatically.

Maintainers

Package info

github.com/MilliPress/MilliBase

pkg:composer/millipress/millibase

Statistics

Installs: 16

Dependents: 0

Suggesters: 0

Stars: 1

Open Issues: 0

v1.2.1 2026-03-12 09:47 UTC

This package is auto-updated.

Last update: 2026-03-12 09:48:43 UTC


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:

License

GPL-2.0-or-later