v0.0.8 — component framework

InstanceIO: PHP Component Framework

A truly extensible PHP component framework that renders reusable components to flat HTML. Compose and extend interfaces in PHP, HTML, and CSS, then use the output with HTMx or your existing UI component framework without adding another client-side component runtime.

HTMx Docker IPFS PHP
Capabilities

A PHP UI Component Framework

Truly Extensible

Extend PHP classes, replace HTML templates, compose child components, and change CSS. Render every component as flat HTML.

HTMx Ready

Server-rendered UI with optional JavaScript. Add HTMx when you need partial updates or interactions.

Docker First

Dev and prod containers. One command.

Static Export

Compile to flat HTML for S3, serverless, or IPFS. Dynamic to static with
php console/cmd.php build.

Framework-Neutral Output

Server-rendered components become ordinary HTML. Use them with React, Vue, Svelte, Alpine, Tailwind, Bootstrap, or your own UI system without a second component runtime.

CLI Tooling

Generate components, controllers, routes from the terminal.

Server-driven UI

Server-rendered components with optional JavaScript for interactions and partial updates.

  • Server-rendered component HTML; JavaScript is optional
  • Swap, morph, or append content with HTML attributes
  • Trigger endpoints with clicks, forms, or custom events
<!-- HTMx in InstanceIO -->
<button hx-post="api/action/"
        hx-target="#result"
        hx-swap="outerHTML">
    Execute
</button>

<div id="result">
    <!-- Server response here -->
</div>

Click a button to load content from the API →

HTMx + API in action

These buttons use HTMx to swap the left panel with HTML returned from backend API endpoints. The API endpoints are included in static builds, so the same request works on the live site and through an IPFS gateway.

# Development
php console/cmd.php Docker build

# Production (dynamic)
php console/cmd.php Docker build prod-app

# Production (static HTML)
php console/cmd.php Docker build prod-html

# Watch + auto-compile
php console/cmd.php Docker watch

One-command containers

Dev, prod-app, and prod-html Docker images out of the box.

  • Local dev environment in one command
  • Production images for dynamic or static apps
  • Auto-compile watcher in container

Decentralized hosting

Compile to flat HTML and pin to IPFS. Each deployment gets an immutable CID that can be retrieved through an IPFS gateway.

# Build and publish in one command
php console/cmd.php Ipfs deploy --build

# Or publish an existing IIO build
php console/cmd.php Ipfs deploy
Example

Component syntax

PHP class + HTML template + CSS. That's a component.

class Hero extends Component {

    public array $defaults = [
        'title' => 'InstanceIO',
        'subtitle' => 'Component-based PHP framework'
    ];

    public function __construct(
        public array $params,
        public string $component = __DIR__ . '/Hero'
    ){
        parent::__construct($this->params, $this->component);
    }

}
<section class="hero">
    <div class="container">
        <h1 class="hero__title">Component syntax</h1>
        <p class="hero__subtitle">PHP class + HTML template + CSS. That's a component.</p>
        <a href="docs/" class="btn btn--primary">Get Started</a>
    </div>
</section>
.hero {
    padding: var(--space-4xl) 0;
    background: var(--surface);
}

.hero__title {
    font-size: 48px;
    font-weight: 700;
    color: var(--text-primary);
}

Start building

Install the framework and scaffold your first component in under a minute.