Description

Statamic 3.0+ Latest Version on Packagist

A Laravel Livewire integration for Statamics Antlers template engine.

Help wanted!

This version it fully experimental right now and I am still tinkering around with it.

Feel free to contribute to this addon, to make the integration for Statamics Antlers engine great and fun to use.

requires

  • PHP 7.4
  • Laravel 7
  • Statamic V3

Installation

Pull in your package with composer

composer require jonassiewertsen/statamic-livewire

General documentation

Laravel Livewire Docs

How to be used with the Antlers template engine

Include the JavaScript (on every page that will be using Livewire).

...
    {{ livewire:styles }}
</head>
<body>

    ...
    {{ livewire:scripts }}
</body>
</html>

Include components with Antlers

You can create Livewire components as described in the general documentation. To include your Livewire component:

<head>
    ...
    {{ livewire:styles }}
</head>
<body>
    {{ livewire:your-component-name }}

    ...

    {{ livewire:scripts }}
</body>
</html>

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

License

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


Important Links
Details
Released July 14, 2020
Updated 2 weeks ago
Version dev-master
Downloads 25
Requires Statamic 3

Jonas Siewertsen

More by Jonas Siewertsen

Similar Addons

See All
Autolinks content wrapped in [braces], just like a wiki.

Wikilinks

by Statamic in Spam, Tag
Autolinks content wrapped in [braces], just like a wiki.
Save time, rank better. Redirect management. Schema generation. On-page optimisation. $49

Aardvark SEO

by Candour in Enhancement, Integration, JavaScript, Tag
Save time, rank better. Redirect management. Schema generation. On-page optimisation.