Documentation menu

Comparisons

php-via is a PHP framework. The realistic question for a PHP developer is: when should I use this instead of Livewire, htmx, Inertia, or LiveView? This page answers that honestly — including where php-via falls short.

Feature comparison

~ means partial support. Hover the markers for details.

Feature php-via Livewire htmx + Alpine Inertia.js LiveView
Native real-time push ~Requires Laravel Reverb + Echo for server push; native Livewire uses HTTP round-trips. ~SSE extension available but requires manual wiring.
Multiplayer / shared state
Scoped state system ~PubSub topics achieve similar results without a declarative scope system.
No JS to author ~Alpine.js is bundled; complex interactions may need JS hooks. ~JS hooks needed for some client-side interactions.
No build step
File uploads
Form validation ~HTML5 constraint API only; no built-in server-side validation.
Auth / middleware coming soon
Multi-server scaling
Ecosystem & community Early Large Medium Large Large
Framework required No Laravel No AnyPrimarily targets Laravel but also supports Rails, Django, and Phoenix. Phoenix
Language PHP PHP PHP + JS PHP + JS Elixir
Runtime OpenSwoole PHP-FPM PHP-FPM PHP-FPM BEAM VM

One connection. Brotli dictionary. Near-zero incremental bytes.

Every alternative in this table works by making a new HTTP request when something changes. php-via keeps a single SSE connection open for the entire session and pushes incremental DOM patches down it — not full re-renders, not state trees, just the changed fragment. Because Brotli's sliding-window dictionary spans the whole session, patch compression improves as the connection ages: 100× compression ratios are achievable on high-frequency updates. On slow or metered connections (mobile, satellite) that gap is significant. The tradeoff is a persistent OpenSwoole process instead of stateless PHP-FPM.

Full explanation in Design decisions →

vs Livewire

Livewire is the most direct PHP alternative. It's mature, well-documented, and has a large ecosystem.

Choose Livewire when: you're in a Laravel project, need built-in form validation, file uploads, auth scaffolding, or the safety net of a large community and years of production use.

Choose php-via when: you need real-time push without bolting on Reverb, or you want multiplayer state synced across users without writing pub/sub infrastructure — and you're comfortable with an early-stage library.

vs htmx + Alpine

htmx + Alpine is not a framework — it's a composition of two libraries. It works with any PHP backend and lets you stay on PHP-FPM.

Choose htmx + Alpine when: you want to add interactivity incrementally to an existing app, need full control of the request/response cycle, or aren't comfortable running a persistent OpenSwoole process.

Choose php-via when: you want reactive state that live-updates without request/response cycles, and need the scope system to broadcast changes across users.

vs Inertia.js

Inertia is a protocol layer that connects a server-side framework (typically Laravel) to a React, Vue, or Svelte frontend. It requires a build step and JavaScript knowledge.

Choose Inertia when: your team already knows React/Vue/Svelte, you want SPA-style navigation with a PHP backend, or you need the full power of a JS component ecosystem.

Choose php-via when: you want to stay in PHP entirely and push DOM patches server-side — no client-side routing, no JavaScript build pipeline.

vs Phoenix LiveView

Phoenix LiveView is the clearest inspiration for php-via's architecture: persistent server-side state over a live connection, with DOM diffing pushed to the client.

Choose LiveView when: you work in Elixir, need the fault tolerance and distributed capabilities of the BEAM VM, or require production-grade multi-server deployment with PubSub baked in.

Choose php-via when: you work in PHP. The scope system (Scope::ROUTE, Scope::SESSION, Scope::GLOBAL) intentionally mirrors LiveView's PubSub model with a simpler declarative API.

The Datastar ecosystem

Datastar is the underlying SSE + DOM-morphing library that php-via builds on top of. Several other frameworks in other languages use the same protocol:

  • Datapages (Go + Templ) — a code-generation framework with built-in CSRF, typed auth, a full CLI, and NATS-based multi-instance broadcasting. The better choice if you're working in Go or need multi-server deployments today.
  • Stario (Python 3.14+) — a stateless async handler framework with rich HTTP primitives (cookies, redirects, compression), full HTTP method routing, and request tracing. The better choice if you're working in Python or need fine-grained HTTP control.

These are different languages targeting different teams. Comparing php-via to Datapages or Stario is less useful than comparing it to Livewire — you don't switch languages because of a framework comparison.

Next steps

  • Scopes — the state scoping model that differentiates php-via
  • Components — sub-contexts with isolated state
  • API Reference — complete method signatures