Skip to content

Properties

Laravel Livewire Documentation Reference

Since Magewire is heavily inspired by Laravel Livewire, many concepts are either identical or very similar. To avoid duplicating documentation, this page only covers Magewire-specific and platform-specific details. For all general concepts and in-depth explanations, you can refer to the corresponding Laravel Livewire documentation.

Livewire Reference

Template access

In the PHTML, the component instance is available as $magewire. Always escape output with Magento's $escaper:

view/frontend/templates/magewire/counter.phtml
<div>
    <?= $escaper->escapeHtml($magewire->label) ?>: <?= (int) $magewire->count ?>
</div>

Supported types

Magewire registers a \Magento\Framework\DataObject synthesizer in addition to Livewire's scalar, array, \stdClass, and backed-enum handling.

DataObject round trips in Magewire 3.6

The current synthesizer casts the object to an array instead of serializing getData(). That does not provide a dependable round trip for normal Magento DataObject state. Keep a plain array as the public property and reconstruct the DataObject inside the component until the synthesizer is corrected.

Custom value objects require a synthesizer.

wire:model defaults to deferred

Migrating from Magewire V1

V1's wire:model was live-by-default and .lazy meant blur. V3 flips the default: wire:model defers. Use .live for instant sync. See Upgrade.