PHPackages                             vortexphp/live - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. vortexphp/live

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

vortexphp/live
==============

Server-driven Live components (Livewire-style) for Vortex PHP

0.0.2(3mo ago)03↓92.9%1MITPHPPHP ^8.2

Since Apr 5Pushed 3mo agoCompare

[ Source](https://github.com/vortexphp/live)[ Packagist](https://packagist.org/packages/vortexphp/live)[ RSS](/packages/vortexphp-live/feed)WikiDiscussions main Synced today

READMEChangelog (2)Dependencies (4)Versions (3)Used By (1)

vortexphp/live
==============

[](#vortexphplive)

Server-driven Live components (Livewire-style POST + signed snapshot) with a small vanilla client runtime (`resources/live.js`). Public markup uses the `live:*` attribute namespace documented below.

For product direction and parity notes, see [ROADMAP.md](ROADMAP.md).

Installation
------------

[](#installation)

- Require **`vortexphp/framework` ^0.12** and this package.
- Allowlist component FQCNs in app config (`live.components`).
- Register **`Vortex\Live\LivePackage`** in **`config/app.php`** under **`packages`** (it adds the `live_mount` Twig extension and `POST /live/message`).
- Publish the client script: **`php vortex publish:assets`** (declared by **`LivePackage::publicAssets()`** → `public/js/live.js`). Run after **`composer install/update`**, or add a Composer script that calls it.

**Config (example)**

```
// config/app.php (merge)
'packages' => [
    \Vortex\Live\LivePackage::class,
],

// config/live.php
return [
    'components' => [
        \Vortex\vortex\app\Components\Live\Counter::class,
    ],
];
```

**Layout**

```

```

(`publish:assets` places `resources/live.js` there.)

If you do not use application packages, register **`Vortex\Live\Twig\LiveExtension`** via **`app.twig_extensions`**, wire **`POST /live/message`** to **`LiveController::message`**, and copy **`resources/live.js`** into **`public/js/`** yourself.

Component island (server-rendered root)
---------------------------------------

[](#component-island-server-rendered-root)

`live_mount('App\\Live\\Components\\MyComponent', props)` wraps the view in a root element with:

AttributePurpose`live-root`Marks the island boundary.`live-state`Signed snapshot token (HMAC).`live-url`POST endpoint for actions / sync (e.g. `/live/message`).`live-csrf`CSRF token for POST JSON body.**Twig**

```
{{ live_mount('App\\Live\\Components\\Counter', { count: 0 }) }}
```

**Rough HTML shape** (attributes are emitted by PHP; don’t paste `live-state` by hand)

```

  {# your component twig #}

```

All `live:click`, `live:submit`, and `live:model.live` / `live:model.lazy` behavior applies **inside** this subtree.

Actions (server)
----------------

[](#actions-server)

SyntaxMeaning`live:click="methodName"`On click, POST `action: methodName` with `args` from `live:args`. Element must be inside `[live-root]`.`live:submit="methodName"`On form submit, POST that action; merge includes bound fields + `FormData`.`live:args='[1,"a"]'`Optional JSON **array** only. Invalid JSON or non-array → action is not sent. Single argument: `live:args='[0]'`.Methods are invoked on the PHP component with `ReflectionMethod::invokeArgs` — arity must match.

**Button + args**

```
+1
+5
First row
```

**Twig loop**

```
{% for item in items %}
  Remove
{% endfor %}
```

**Form**

```

  Save

```

Model binding modes
-------------------

[](#model-binding-modes)

AttributeBehavior`live:model.local="prop"`Client-only until the next server round-trip; value is merged from the DOM when an action/submit/sync runs.`live:model.live="prop"`Debounced `POST` with `sync: true` (re-render, no named action).`live:model.lazy="prop"`Sync on `change` / commit-style events.Supported controls: `input` (text, checkbox, radio, number, …), `textarea`, `select`.

**Examples**

```

{{ body }}

  Light
  Dark

```

Validation
----------

[](#validation)

SyntaxMeaning`live-error="fieldName"`Node whose `textContent` is filled when the server returns `validation_failed` + `errors[fieldName]`.**Example**

```

  Save

```

Local mirrors
-------------

[](#local-mirrors)

SyntaxMeaning`live-display="prop"`Text node mirroring the formatted value of `live:model.local="prop"` on the same island (updated as the user types).**Example**

```

```

Conditional visibility (`live:show` / `live:hide`)
--------------------------------------------------

[](#conditional-visibility-liveshow--livehide)

Inside a **`live-root`** island, toggle `hidden` from the current value of any bound property (`live:model.local` | `.live` | `.lazy` with the same name).

SyntaxMeaning`live:show="prop"`Visible when `prop` is **truthy** (non-empty string, non-zero number, `true`, checked checkbox, etc.).`live:hide="prop"`Hidden when `prop` is **truthy**.Use **one** of the two per element (not both on the same node). Updates run when the bound control changes and once after bindings init.

**Falsy:** `null`, `undefined`, `false`, `''` / whitespace-only string, `0`.

**Example**

```

Thanks for agreeing.
Please check the box.
```

Scope templates (JSON in DOM)
-----------------------------

[](#scope-templates-json-in-dom)

AttributeMeaning`live:scope='{"path":{"nested":true}}'`JSON object on a container.``For each object key or array index at `path`, clone template content as siblings.`live:slot="key"``value`Runs on load and after each Live HTML swap on the new root. Add `live:model.local` inside cloned nodes if you need bindings.

**Example**

```

    :

```

### Arrays / lists in local state

[](#arrays--lists-in-local-state)

There is no single `live:model` for a JSON array. Use one of:

1. **Flat props** — `item0_title`, `item1_title`, … plus Twig `{% for %}` and `live:model.local="item{{ i }}_title"`.
2. **`live:scope` JSON** — client-side templated list; good for display/expansion; binding to snapshot still uses flat props if you merge to the server.

**Twig: fixed slots**

```
{% for i in 0..2 %}

{% endfor %}
```

Internal attributes (do not hand-author)
----------------------------------------

[](#internal-attributes-do-not-hand-author)

The runtime may set `data-live-model-bound`, `data-live-template-id`, and `data-live-from-template` on nodes it manages.

Source file
-----------

[](#source-file)

- Client: `resources/live.js` (single IIFE, no bundler).

###  Health Score

34

—

LowBetter than 75% of packages

Maintenance82

Actively maintained with recent releases

Popularity3

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity37

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

90d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/69676022?v=4)[Bozhidar](/maintainers/bobicloudvision)[@bobicloudvision](https://github.com/bobicloudvision)

---

Top Contributors

[![bobicloudvision](https://avatars.githubusercontent.com/u/69676022?v=4)](https://github.com/bobicloudvision "bobicloudvision (15 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/vortexphp-live/health.svg)

```
[![Health](https://phpackages.com/badges/vortexphp-live/health.svg)](https://phpackages.com/packages/vortexphp-live)
```

###  Alternatives

[voku/portable-utf8

Portable UTF-8 library - performance optimized (unicode) string functions for php.

52323.5M49](/packages/voku-portable-utf8)[shopware/conflicts

Shopware 6 conflicting packages

149.5M10](/packages/shopware-conflicts)[gpolguere/path-to-regexp-php

PHP port of https://github.com/component/path-to-regexp

2211.8k2](/packages/gpolguere-path-to-regexp-php)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
