Magewire 3 is a full rewrite. Its core is now a port of Laravel Livewire v3, layered onto a Magento-native Mechanisms and Features pipeline. If you're coming from Magewire 1.x, or from Laravel Livewire, this guide covers only the essentials — enough to get an existing component booting on 3.0. For the full reference, see the docs and the magewire-backwards-compatibility skill.
- Magewire 1.x users — existing Magento 2 + Magewire projects. Read the whole document.
- Livewire-aware readers — familiar with Livewire v2/v3 but new to Magewire. Skip to Differences from upstream Livewire.
| 1.x | 3.0 | |
|---|---|---|
| PHP | >=7.4 |
>=8.2 |
| Magento | any 2.x | any 2.x |
| Livewire core | none (hand-written) | ported from livewire/livewire:~3.7.11 |
Update the constraint:
- "magewirephp/magewire": "^1.13"
+ "magewirephp/magewire": "^3.0"Two dependency changes happen automatically:
rakit/validation→magewirephp/validation— drop-in fork, keeps theRakit\Validation\namespace. If yourequire rakit/validationdirectly in your owncomposer.json, remove it; the fork declaresreplace.magento/frameworkis no longer listed inrequire. Your root project should already constrain Magento — Magewire no longer enforces a floor.
After updating, run:
composer update magewirephp/magewire --with-all-dependencies
bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento cache:flushMost v1 components keep working under a BC layer. Opt in per-component:
use Magewirephp\Magewire\Features\SupportMagewireBackwardsCompatibility\Attributes\HandleBackwardsCompatibility;
#[HandleBackwardsCompatibility]
class MyComponent extends \Magewirephp\Magewire\Component
{
// v1-style code keeps working
}The attribute flips a bc memo flag in the component snapshot. Without it, new v3 semantics apply. See the magewire-backwards-compatibility skill for the full behavior matrix.
Livewire v3 changed wire:model to defer updates until an explicit action. For v1 behavior, use wire:model.live:
- <input wire:model="query" />
+ <input wire:model.live="query" />The BC attribute above maps plain wire:model back to live semantics for tagged components.
@entangle('prop') now defers; @entangle('prop').live matches v1 behavior. BC attribute covers the default case.
Component classes are resolved via layout XML blocks by the LayoutResolver (pluggable via ComponentResolverManager). If you used internal APIs to look up components manually in v1, migrate to injecting the resolver.
Templates now flow through a compiler. Preferred:
@json,@if,@foreach,@script,@fragment,@slot,@template,@translate,@child,@auth,@guest@escape.url,@escape.attr,@escape.js,@escape.html,@escape.css@render.parent,@render.child
Raw PHP in PHTML still works. Raw <script> tags are discouraged — use $magewireFragment->make()->script()->start()/end() for CSP-safe inline JS.
LivewireManager→MagewireManager.- v1's bespoke runtime, hydration, and update flow are gone — replaced by Livewire-style snapshots (data + memo + checksum).
- Synthesizers replace ad-hoc property casting. Built-ins:
DataObjectSynth,ArraySynth,EnumSynth,FloatSynth,IntSynth,StdClassSynth.
If you know Livewire v3, these are the Magewire-specific bits:
- No
Livewire::component()registration. Components are discovered through Magento layout XML —<referenceContainer><block class="..."/></referenceContainer>— and resolved byResolveComponents. - Service registration via DI, not a service provider. Mechanisms and Features are registered in area-scoped DI (
etc/frontend/di.xmloretc/adminhtml/di.xml), never globaletc/di.xml. app()bridge. Livewire code that callsapp('livewire')orapp('redirect')works —Containersmaps those lookups to Magento DI bindings.- Update endpoint. POSTs go to
magewire/update(registered as a custom router at sort order 5), not/livewire/update. - Template compiler is opt-in per directive area — extensible via DI virtualTypes, so themes can add their own directive namespaces.
- Theme compatibility modules. Hyvä, Luma, Breeze, and Magento Admin each have their own module under
themes/, registered viacomposer.json'sautoload.files.
composer updateresolves cleanly.bin/magento setup:di:compilesucceeds.- Load a page with a Magewire component — initial render works (
PRECEDINGmode). - Trigger an action — AJAX update works (
SUBSEQUENTmode, POST tomagewire/update). - If a v1 component breaks, add
#[HandleBackwardsCompatibility]and re-test.
- Discussions — questions and migration help.
- Docs — full API reference.
- Upstream Livewire v3 upgrade guide — for semantics not changed by Magewire.