Skip to content

ui — Overview

Updated View as Markdown

Transport-agnostic PHP contract builders for contract-driven UI. Describe a page once — its regions, forms, tables, blocks, navigation and actions — as an immutable value object, then let any host or adapter render it. The library produces a JSON page contract; it never produces HTML.

Describe the page once. Render it anywhere.

The builders carry no transport and no host knowledge: the same contract renders standalone, inside a Moodle plugin, or inside WordPress, by swapping the renderer downstream. See Architecture for how the contract system is built and organized.

Who it is for

  • Developers of middag-io/framework, the host adapters and any renderer that consumes the page contract.
  • Developers who build pages for a MIDDAG-based product and want them to render on any host.
  • Authors of a client, such as @middag-io/react, that codegens against the published JSON schemas.

Requirements and install

Item Value
Package middag-io/ui (middag-php-ui), Apache-2.0
PHP ^8.3: 8.3, 8.4 and 8.5
Symfony none: ui depends on no Symfony component
Sibling libraries none: ui is the bottom of the stack and requires no other library
Host none: ui runs with no host
composer require middag-io/ui

The platform rules behind these values are in Platform and Versioning and compatibility. A first page is built in Getting Started.

Public surface

  • Support covers the types tagged @api only. Every type in src/ carries exactly one class-level tag, @api or @internal; a type with neither is @internal. An @internal type may change in any release.
  • The @api surface is the interfaces in each concern’s Contract/ sub-namespace (suffix Interface), the concern builders and the value objects they produce, and the cross-cutting types under Shared/.
  • The emitted JSON is a second, stronger contract. A PHP rename that leaves the JSON unchanged is not a wire break; a change to the JSON shape is, and follows the same versioning rules (Versioning and compatibility).
  • API-STABILITY.md in the repository lists the public surface and the rules for changing it.
  • The contract reference is on this hub: Page Composition Contract, UI Wire Contract and UI Stack & Design System.
  • The JSON schemas the library emits (schema/page-contract.json, schema/fragment.json) are published artifacts of each release.
  • In progress: the generated reference of the @api surface (Documentation publication) and the PHP-React correspondence map (Documentation publication) are not published yet.

Changelog and releases

  • Releases are cut only by release-please from Conventional Commits; there are no manual tags.
  • CHANGELOG.md records every release.
  • Releases on GitHub carry the tags, and Packagist serves them to Composer.

Decision records

The records live in the repository, in docs/decisions. This hub explains the design they record; it does not host them.

Id Decision
UI-001 UI contracts are a separate zero-dependency package at the bottom of the stack
UI-002 A versioned data contract, published as schema
UI-003 The first-party UI client is React + TypeScript + Inertia + ReUI

Help

Open source and MIDDAG

middag-io/ui, middag-io/framework, the Moodle and WordPress adapters and middag-io/demo-standalone are open source under Apache-2.0 — the generic plumbing, free, forever. The governed domain infrastructure built on top lives in MIDDAG’s internal (proprietary, not free) libraries, opt-in; product features live in the products. See OSS and internal libraries. This library has zero dependencies and never points at the internal libraries.

Licensing note

Apache-2.0. Support starts at 2.0.0, the first stable release of the library family: from there breaking changes land only in a MAJOR. Earlier releases are pre-stable and unsupported. See Versioning and compatibility.

Navigation

Type to search…

↑↓ navigate↵ selectEsc close