PHPackages                             marcorieser/statamic-livewire - 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. marcorieser/statamic-livewire

ActiveStatamic-addon[Utility &amp; Helpers](/categories/utility)

marcorieser/statamic-livewire
=============================

A Laravel Livewire integration for Statamic.

v5.3.0(2mo ago)2381.5k—8%4[1 PRs](https://github.com/marcorieser/statamic-livewire/pulls)6MITPHPPHP ^8.2CI passing

Since May 25Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/marcorieser/statamic-livewire)[ Packagist](https://packagist.org/packages/marcorieser/statamic-livewire)[ GitHub Sponsors](https://github.com/marcorieser)[ RSS](/packages/marcorieser-statamic-livewire/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (14)Versions (61)Used By (6)

Statamic Livewire
=================

[](#statamic-livewire)

A third-party [Laravel Livewire](https://laravel-livewire.com/) integration for Statamic. It aims to make it as easy as possible to use Livewire in Statamic.

Table of Contents
-----------------

[](#table-of-contents)

- [Requirements](#requirements)
- [Installation](#installation)
- [Upgrade](#upgrade)
- [Livewire documentation](#livewire-documentation)
- [Features](#features)
    - [Blade or Antlers? Yes, please!](#blade-or-antlers--yes--please-)
    - [Include components](#include-components)
    - [Passing Initial Parameters](#passing-initial-parameters)
    - [Keying Components](#keying-components)
    - [Manually including Livewire's frontend assets](#manually-including-livewire-s-frontend-assets)
    - [Manually bundling Livewire and Alpine](#manually-bundling-livewire-and-alpine)
    - [Static caching](#static-caching)
    - [`@script` and `@assets`](#--script--and---assets-)
    - [Computed Properties](#computed-properties)
    - [Cascade](#cascade)
    - [Multi-Site / Localization](#multi-site---localization)
    - [Lazy Components](#lazy-components)
    - [Paginating Data](#paginating-data)
    - [Synthesizers](#synthesizers)
    - [Entangle: Sharing State Between Livewire And Alpine](#entangle--sharing-state-between-livewire-and-alpine)
    - [This: Accessing the Livewire component](#this--accessing-the-livewire-component)
- [Other Statamic Livewire Packages](#other-statamic-livewire-packages)
- [Credits](#credits)
- [Support](#support)
- [License](#license)

Requirements
------------

[](#requirements)

- PHP 8.2+
- Laravel 11+
- Statamic 5+

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

[](#installation)

Install the addon via composer:

```
composer require marcorieser/statamic-livewire
```

Upgrade
-------

[](#upgrade)

Below is a list with specific upgrade instructions.

- [Upgrade from v4 to v5](docs/upgrade-4-to-5.md)
- [Upgrade from v3 to v4](docs/upgrade-3-to-4.md)
- [Addon ownership transfer (v3)](docs/addon-ownership-transfer.md)

Livewire documentation
----------------------

[](#livewire-documentation)

In general, all Livewire specific information can be found in the official [Livewire Docs](https://livewire.laravel.com/docs/quickstart).

Features
--------

[](#features)

### Blade or Antlers? Yes, please!

[](#blade-or-antlers-yes-please)

If creating a Livewire component, you need to render a template file

```
namespace App\Http\Livewire;

use Livewire\Component;

class Counter extends Component
{
    public function render()
    {
        return view('livewire.counter');
    }
}
```

Normally your template file would be a blade file, named `counter.blade.php`. Great, but what about Antlers? Rename your template to `counter.antlers.html`, use Antlers syntax and do whatever you like. **No need to change** anything inside your component Controller. How cool is that?

More Information: ()

### Include components

[](#include-components)

You can create Livewire components as described in the [general documentation](https://livewire.laravel.com/docs/components). To include your Livewire component in Antlers, you can use the `livewire` tag:

```
{{ livewire:your-component-name }}
```

If you want to include a component from a dynamic variable, you can use the `livewire:component` tag:

```
{{ livewire:component :name="variable" }}
```

### Passing Initial Parameters

[](#passing-initial-parameters)

You can pass data into a component by passing additional parameters:

```
{{ livewire:your-component-name :contact="contact" }}
```

The [Official Livewire documentation](https://livewire.laravel.com/docs/components#rendering-components) provides more information.

### Keying Components

[](#keying-components)

Livewire components are automatically keyed by default. If you want to manually key a component, you can use the `key` attribute.

```
{{ contacts }}
    {{ livewire:your-component-name :key="id" }}
{{ /contacts }}
```

The [Official Livewire documentation](https://livewire.laravel.com/docs/components#adding-wirekey-to-foreach-loops) provides more information.

### Manually including Livewire's frontend assets

[](#manually-including-livewires-frontend-assets)

By default, Livewire injects the JavaScript and CSS assets it needs into each page that includes a Livewire component. If you want more control over this behavior, you can [manually include the assets](https://livewire.laravel.com/docs/installation#manually-including-livewires-frontend-assets) on a page using the following Antlers tags:

```

        {{ livewire:styles }}

        {{ livewire:scripts }}

```

### Manually bundling Livewire and Alpine

[](#manually-bundling-livewire-and-alpine)

If you need to include some custom Alpine plugins, you need to [manually bundle the Livewire and Alpine assets](https://livewire.laravel.com/docs/installation#manually-bundling-livewire-and-alpine) and disable the automatic injection by using the following Antlers tag. Remember to include the Livewire styles as well.

```

        {{ livewire:styles }}

        {{ livewire:scriptConfig }}

```

### Static caching

[](#static-caching)

This addon adds an `AssetsReplacer` class to make Livewire compatible with half and full static caching. You may customize the replacers in the config of this addon:

```
'replacers' => [
    \MarcoRieser\Livewire\Replacers\AssetsReplacer::class,
],
```

If you are using full measure static caching, and you're manually bundling Livewire and Alpine as per the instructions above, you need to make sure to only start Livewire once the CSRF token has been replaced.

```
if (window.livewireScriptConfig?.csrf === 'STATAMIC_CSRF_TOKEN') {
    document.addEventListener('statamic:nocache.replaced', () => Livewire.start());
} else {
    Livewire.start();
}
```

### `@script` and `@assets`

[](#script-and-assets)

Antlers versions of [@script](https://livewire.laravel.com/docs/javascript#executing-scripts) and [@assets](https://livewire.laravel.com/docs/javascript#loading-assets) are provided:

```

    {{ livewire:script }}
	console.log('hello')
    {{ /livewire:script }}

```

```

    {{ livewire:assets }}

    {{ /livewire:assets }}

```

### Computed Properties

[](#computed-properties)

When using Antlers, the computed properties are loaded automatically and only resolve when accessed. Simply access them as you would access a regular variable in the cascade. Read more about [Computed Properties in the Livewire Docs](https://livewire.laravel.com/docs/computed-properties).

```
#[Computed]
public function entries() {
    return Entry::all();
}
```

```
{{ entries }}
    {{ title }}
{{ /entries }}
```

### Cascade

[](#cascade)

Normally all the variables in the Cascade are only available on initial render and get lost between Livewire requests. This means you'd need pass in the required ones into the component yourself. To make our lives a bit easier, you can add the `#[Cascade]` attribute to your component.
 This is only needed for Antlers views and mirrors the logic of Blade's [`@cascade`](https://statamic.dev/blade#cascade-directive) directive.

```
use Livewire\Component;
use MarcoRieser\Livewire\Attributes\Cascade;

#[Cascade]
class ShowArticle extends Component
{
    ...
}
```

Now you can access the variables from the Cascade directly in your Antlers view, even on subsequent renders:

```
{{ title }}
{{ seo_title }}
```

You can also limit which cascade keys are exposed (and provide defaults):

```
#[Cascade([
    'title',
    'seo_title' => 'Fallback title',
])]
class ShowArticle extends Component {}
```

For subsequent requests, the addon restores the Cascade using the original Livewire URL, so site, request, and content data resolve as expected.

### Multi-Site / Localization

[](#multi-site--localization)

By default, your current site is persisted between Livewire requests automatically.
In case you want to implement your own logic, you can disable `localization` in your published `config/statamic-livewire.php` config.

### Lazy Components

[](#lazy-components)

Livewire allows you to [lazy load components](https://livewire.laravel.com/docs/lazy) that would otherwise slow down the initial page load. For this you can simply pass `lazy="true"` as argument to your component tag.

```
{{ livewire:your-component-name :contact="contact" lazy="true" }}
```

### Paginating Data

[](#paginating-data)

You can paginate results by using the WithPagination trait.

#### Blade

[](#blade)

To use pagination with Blade, please use the `Livewire\WithPagination` namespace for your trait as described in the [Livewire docs](https://livewire.laravel.com/docs/pagination#basic-usage).

### Antlers

[](#antlers)

Pagination with Antlers does work similarly. Make sure to use the `MarcoRieser\Livewire\WithPagination` namespace for your trait if working with Antlers.

In your Livewire component view:

```
{{ entries }}
    ...
{{ /entries }}

{{ links }}
```

```
use MarcoRieser\Livewire\WithPagination;

class ShowArticles extends Component
{
    use WithPagination;

    protected function entries()
    {
        $entries = Entry::query()
            ->where('collection', 'articles')
            ->paginate(3);

        return $this->withPagination('entries', $entries);
    }

    public function render()
    {
        return view('livewire.blog-entries', $this->entries());
    }
}
```

### Synthesizers

[](#synthesizers)

You can use the built-in Synthesizers to make your Livewire components aware of Statamic specific data types.

```
use Statamic\Entries\Entry;

class Foo extends Component
{
    public Entry $entries;
}
```

Currently, the following types are supported:

- `Statamic\Entries\EntryCollection`;
- `Statamic\Entries\Entry`;
- `Statamic\Fields\Field`;
- `Statamic\Fields\Fieldtype`;
- `Statamic\Fields\Value`;

To make it work, you need to enable that feature first.

1. Run `php artisan vendor:publish`
2. Select `statamic-livewire` in the list
3. Enable synthesizers

#### Augmentation

[](#augmentation)

By default, the Synthesizers augment the data before it gets passed into the antlers view. You can disable this by setting `synthesizers.augmentation` to `false` in your published `config/statamic-livewire.php` config.

### Entangle: Sharing State Between Livewire And Alpine

[](#entangle-sharing-state-between-livewire-and-alpine)

It's worth mentioning that, since Livewire v3 now builds on top of Alpine, the `@entangle` directive is not documented anymore. Instead, it's possible to entangle the data via [the `$wire` object](https://livewire.laravel.com/docs/javascript#the-wire-object).

```

```

In case you want to share state between Livewire and Alpine, there is a Blade directive called `@entangle`. To be usable with Antlers, the addon provides a dedicated tag:

```

```

### This: Accessing the Livewire component

[](#this-accessing-the-livewire-component)

It's worth mentioning that, since Livewire v3 now builds on top of Alpine, the `@this` directive is not used widely anymore. Instead, it's possible to [access and manipulate the state directly via JavaScript](https://livewire.laravel.com/docs/properties#accessing-properties-from-javascript) / [the `$wire` object](https://livewire.laravel.com/docs/javascript#the-wire-object).

```

    document.addEventListener('livewire:initialized', function () {
        // `{{ livewire:this }}` returns the instance of the current component
        {{ livewire:this }}.set('name', 'Jack')
    })

```

You can access and perform actions on the Livewire component like this:

```

    document.addEventListener('livewire:initialized', function () {
        // With Antlers
        {{ livewire:this set="('name', 'Jack')" }}

        // With Blade
        @this.set('name', 'Jack')
    })

```

Other Statamic Livewire Packages
--------------------------------

[](#other-statamic-livewire-packages)

If using Livewire, those packages might be interesting for you as well:

- [Livewire Forms](https://statamic.com/addons/aerni/livewire-forms)
- [Livewire Filters](https://statamic.com/addons/reach/statamic-livewire-filters)
- [Antlers Components](https://statamic.com/addons/stillat/antlers-components)
- [Live Search](https://statamic.com/addons/marcorieser/live-search)

Did I miss a link? Let me know!

Credits
-------

[](#credits)

Thanks to:

- [Jonas Siewertsen](https://jonassiewertsen.com/) for building the addon and give me the permission to take it over
- [Caleb](https://github.com/calebporzio) and the community for building [Livewire](https://laravel-livewire.com/)
- [Austenc](https://github.com/austenc) for the Statamic marketplace preview image

Support
=======

[](#support)

I love to share with the community. Nevertheless, it does take a lot of work, time and effort.

[Sponsor me on GitHub](https://github.com/sponsors/marcorieser/) to support my work and the support for this addon.

License
=======

[](#license)

This plugin is published under the MIT license. Feel free to use it and remember to spread love.

###  Health Score

63

—

FairBetter than 99% of packages

Maintenance88

Actively maintained with recent releases

Popularity42

Moderate usage in the ecosystem

Community28

Small or concentrated contributor base

Maturity82

Battle-tested with a long release history

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~36 days

Recently: every ~47 days

Total

59

Last Release

61d ago

Major Versions

v1.1.4 → v2.0.02020-09-28

v2.12.0 → v3.0.0-beta.12023-09-10

v3.9.0 → v4.0.02025-01-27

v4.5.3 → v5.0.02025-09-09

PHP version history (4 changes)1.0.0-beta.1PHP ^7.4

v2.3.0PHP ^7.4 || ^8.0

v3.0.0-beta.1PHP ^8.1

v4.4.3PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/182dfd043559a726306414781777e7c5960164230ca44e2703607194c296d54b?d=identicon)[marcorieser](/maintainers/marcorieser)

---

Top Contributors

[![marcorieser](https://avatars.githubusercontent.com/u/2395800?v=4)](https://github.com/marcorieser "marcorieser (74 commits)")[![jonassiewertsen](https://avatars.githubusercontent.com/u/38906163?v=4)](https://github.com/jonassiewertsen "jonassiewertsen (51 commits)")[![aerni](https://avatars.githubusercontent.com/u/23167701?v=4)](https://github.com/aerni "aerni (25 commits)")[![ryanmitchell](https://avatars.githubusercontent.com/u/51899?v=4)](https://github.com/ryanmitchell "ryanmitchell (5 commits)")[![laravel-shift](https://avatars.githubusercontent.com/u/15991828?v=4)](https://github.com/laravel-shift "laravel-shift (2 commits)")[![robdekort](https://avatars.githubusercontent.com/u/69107412?v=4)](https://github.com/robdekort "robdekort (2 commits)")[![johncarter-](https://avatars.githubusercontent.com/u/3776888?v=4)](https://github.com/johncarter- "johncarter- (1 commits)")[![jacksleight](https://avatars.githubusercontent.com/u/126740?v=4)](https://github.com/jacksleight "jacksleight (1 commits)")[![leganz](https://avatars.githubusercontent.com/u/3373530?v=4)](https://github.com/leganz "leganz (1 commits)")[![flavius-constantin](https://avatars.githubusercontent.com/u/23703860?v=4)](https://github.com/flavius-constantin "flavius-constantin (1 commits)")[![MrMooky](https://avatars.githubusercontent.com/u/3603346?v=4)](https://github.com/MrMooky "MrMooky (1 commits)")[![the-pulli](https://avatars.githubusercontent.com/u/112799107?v=4)](https://github.com/the-pulli "the-pulli (1 commits)")[![Beaudinn](https://avatars.githubusercontent.com/u/3606046?v=4)](https://github.com/Beaudinn "Beaudinn (1 commits)")[![taylorcammack](https://avatars.githubusercontent.com/u/2514935?v=4)](https://github.com/taylorcammack "taylorcammack (1 commits)")[![jolora](https://avatars.githubusercontent.com/u/4901960?v=4)](https://github.com/jolora "jolora (1 commits)")

---

Tags

livewirestatamicstatamic-addonlaravellivewireaddonstatamic

###  Code Quality

TestsPHPUnit

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/marcorieser-statamic-livewire/health.svg)

```
[![Health](https://phpackages.com/badges/marcorieser-statamic-livewire/health.svg)](https://phpackages.com/packages/marcorieser-statamic-livewire)
```

###  Alternatives

[livewire/volt

An elegantly crafted functional API for Laravel Livewire.

4205.3M84](/packages/livewire-volt)[ramonrietdijk/livewire-tables

Dynamic tables for models with Laravel Livewire

21147.4k](/packages/ramonrietdijk-livewire-tables)[aerni/livewire-forms

A Statamic forms framework powered by Laravel Livewire

2912.8k](/packages/aerni-livewire-forms)[visuellverstehen/statamic-classify

A useful helper to add CSS classes to all HTML tags generated by the bard editor.

20116.8k](/packages/visuellverstehen-statamic-classify)[tomshaw/electricgrid

A feature-rich Livewire package designed for projects that require dynamic, interactive data tables.

116.6k](/packages/tomshaw-electricgrid)[withcandour/aardvark-seo

Save time and get your Statamic site to rank better with the SEO addon for Statamic.

13128.3k](/packages/withcandour-aardvark-seo)

PHPackages © 2026

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