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

Abandoned → [marcorieser/statamic-livewire](/?search=marcorieser%2Fstatamic-livewire)ArchivedStatamic-addon[Utility &amp; Helpers](/categories/utility)

jonassiewertsen/statamic-livewire
=================================

A Laravel Livewire integration for Statamics Antlers engine.

v3.8.1(1y ago)90179.6k↓32.9%14[1 issues](https://github.com/jonassiewertsen/statamic-livewire/issues)2MITPHPPHP ^8.1

Since May 25Pushed 1y ago3 watchersCompare

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

READMEChangelog (10)Dependencies (3)Versions (43)Used By (2)

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

[](#statamic-livewire)

[![Statamic 4.0+](https://camo.githubusercontent.com/2cc64d3b07e997a278a3800cc454b8e9382ec21957956193dd1d6cfc7f0fa078/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f53746174616d69632d342e302b2d4646323639453f7374796c653d666f722d7468652d6261646765266c696e6b3d68747470733a2f2f73746174616d69632e636f6d)](https://camo.githubusercontent.com/2cc64d3b07e997a278a3800cc454b8e9382ec21957956193dd1d6cfc7f0fa078/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f53746174616d69632d342e302b2d4646323639453f7374796c653d666f722d7468652d6261646765266c696e6b3d68747470733a2f2f73746174616d69632e636f6d)[![Latest Version on Packagist](https://camo.githubusercontent.com/c0d121d6d92eae47720d3d242a7819b15361f6e3879a0d8c51e7fc7c692cf924/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6a6f6e61737369657765727473656e2f73746174616d69632d6c697665776972652e7376673f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/jonassiewertsen/statamic-livewire)

New Maintainer
--------------

[](#new-maintainer)

Please switch to  instead. Switching is easy and there is no breaking change. Please check the Guide in the new repo.

Thanks for your support ❤️

Description
-----------

[](#description)

A third-party [Laravel Livewire](https://laravel-livewire.com/) integration for Statamic.

It's as easy as it gets to get started with Livewire if using Statamic.

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

[](#installation)

Pull in the Livewire package with composer

```
composer require jonassiewertsen/statamic-livewire
```

### 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 or Blade directives:

```

        {{ livewire:styles }}

        @livewireStyles

        ...

        {{ livewire:scripts }}

        @livewireScripts

```

### 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 or Blade directive. Do not forget to include the Livewire styles as well.

```

        {{ livewire:styles }}

        @livewireStyles

        ...

        {{ livewire:scriptConfig }}

        @livewireScriptConfig

```

### 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' => [
    \Jonassiewertsen\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();
}
```

Upgrade
-------

[](#upgrade)

Make sure to read the Livewire upgrade guide, in case you're updating to `Statamic Livewire` 3, as there are breaking changes:

General documentation
---------------------

[](#general-documentation)

[Livewire Docs](https://livewire.laravel.com/docs/quickstart)

### 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:

```

    {{ 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" }}

```

### @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 }}

```

### Blade or Antlers? Both!

[](#blade-or-antlers-both)

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');
    }
}
```

More Information: ()

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?

### Passing Initial Parameters

[](#passing-initial-parameters)

You can pass data into a component by passing additional parameters

```

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

```

To intercept with those parameters, mount them and store the data as public properties.

```
use Livewire\Component;

class ShowContact extends Component
{
    public $name;
    public $email;

    public function mount($contact)
    {
        $this->name = $contact->name;
        $this->email = $contact->email;
    }

    ...
}
```

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 }}

@foreach ($contacts as $contact)

@endforeach
```

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

### Multi-Site

[](#multi-site)

When using Livewire in a Multi-Site context, the current site gets lost between requests. There is a trait (`\Jonassiewertsen\Livewire\RestoreCurrentSite`) to solve that. Just include it in your component and use `Site::current()` as you normally do.

```
class ShowArticles extends Component
{
    use \Jonassiewertsen\Livewire\RestoreCurrentSite;

    protected function entries()
    {
        return Entry::query()
            ->where('collection', 'articles')
            ->where('site', Site::current())
            ->get();
    }

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

### 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 similar. Make sure to use the `Jonassiewertsen\Livewire\WithPagination` namespace for your trait if working with Antlers.

In your Livewire component view:

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

{{ links }}
```

```
use Jonassiewertsen\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());
    }
}
```

### EXPERIMENTAL: Statamic Support

[](#experimental-statamic-support)

As a little experiment, support for an Entry or EntryCollection has been added, so you can make an entry or a entry collection simply a public property and it just works.

Supported types:

- Statamic\\Entries\\EntryCollection;
- Statamic\\Entries\\Entry;

```
namespace App\Livewire;

use Livewire\Component;
use Statamic\Entries\EntryCollection;
use Statamic\Entries\Entry;

class Foo extends Component
{
    public EntryCollection $entries;
    public Entry $entry;

    // normal livewire stuff
}
```

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

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

### Entangle: Sharing State Between Livewire And Alpine

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

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

```

```

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).

```

```

### This: Accessing the Livewire component

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

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')
    })

```

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')
    })

```

### 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" }}
```

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

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

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

- [Statamic live search](https://github.com/jonassiewertsen/statamic-live-search)
- [Statamic Livewire Forms](https://github.com/aerni/statamic-livewire-forms)
- [Antlers Components](https://github.com/Stillat/antlers-components)

Did I miss a link? Let me know!

Credits
-------

[](#credits)

Thanks to:

- [Marco Rieser](https://github.com/marcorieser) to help maintaining this package
- [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

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

[](#requirements)

- PHP 8.1
- Laravel 10 or 11
- Statamic 4 or 5

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/jonassiewertsen/) 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

51

—

FairBetter than 96% of packages

Maintenance39

Infrequent updates — may be unmaintained

Popularity48

Moderate usage in the ecosystem

Community26

Small or concentrated contributor base

Maturity77

Established project with proven stability

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

Recently: every ~28 days

Total

39

Last Release

594d ago

Major Versions

v1.1.4 → v2.0.02020-09-28

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

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

v2.3.0PHP ^7.4 || ^8.0

v3.0.0-beta.1PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/12e4999ec3d072e6275c45ab3d408fad0a9c94c4c44448d19c61e1973ed9972f?d=identicon)[jonassiewertsen](/maintainers/jonassiewertsen)

---

Top Contributors

[![jonassiewertsen](https://avatars.githubusercontent.com/u/38906163?v=4)](https://github.com/jonassiewertsen "jonassiewertsen (52 commits)")[![aerni](https://avatars.githubusercontent.com/u/23167701?v=4)](https://github.com/aerni "aerni (25 commits)")[![marcorieser](https://avatars.githubusercontent.com/u/2395800?v=4)](https://github.com/marcorieser "marcorieser (22 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)")[![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)")[![taylorcammack](https://avatars.githubusercontent.com/u/2514935?v=4)](https://github.com/taylorcammack "taylorcammack (1 commits)")[![Beaudinn](https://avatars.githubusercontent.com/u/3606046?v=4)](https://github.com/Beaudinn "Beaudinn (1 commits)")[![jolora](https://avatars.githubusercontent.com/u/4901960?v=4)](https://github.com/jolora "jolora (1 commits)")

---

Tags

laravellivewireaddonstatamic

### Embed Badge

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

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

###  Alternatives

[livewire/flux

The official UI component library for Livewire.

9475.0M86](/packages/livewire-flux)[marcorieser/statamic-livewire

A Laravel Livewire integration for Statamic.

2381.5k10](/packages/marcorieser-statamic-livewire)[mediconesystems/livewire-datatables

Advanced datatables using Laravel, Livewire, Tailwind CSS and Alpine JS

1.2k711.3k8](/packages/mediconesystems-livewire-datatables)[livewire/volt

An elegantly crafted functional API for Laravel Livewire.

4205.3M84](/packages/livewire-volt)[spatie/laravel-livewire-wizard

Build wizards using Livewire

4061.0M4](/packages/spatie-laravel-livewire-wizard)[bezhansalleh/filament-google-analytics

Google Analytics integration for FilamentPHP

205144.8k5](/packages/bezhansalleh-filament-google-analytics)

PHPackages © 2026

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