Skip to main content

Reactive Magento
written in PHP

Build interactive interfaces with PHP components and PHTML. Magewire handles browser updates; add JavaScript when your feature needs it.

<?php

declare(strict_types=1);

namespace Vendor\Module\Magewire;

use Magewirephp\Magewire\Component;

class Counter extends Component
{
    public int $count = 0;

    public function increment(): void
    {
        $this->count++;
    }

    public function decrement(): void
    {
        $this->count--;
    }
}
<?xml version="1.0"?>
<page
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceContainer name="content">
            <block
                name="vendor.module.counter"
                template="Vendor_Module::magewire/counter.phtml">
                <arguments>
                    <argument
                        name="magewire"
                        xsi:type="object"
                        shared="false">
                        Vendor\Module\Magewire\Counter
                    </argument>
                </arguments>
            </block>
        </referenceContainer>
    </body>
</page>
<div class="counter">

    <p class="count">
        Count: <strong>{{ $magewire->count }}</strong>
    </p>

    <button wire:click="increment">Increment</button>
    <button wire:click="decrement">Decrement</button>

</div>

The {{ }} expression is Magewire's escaped PHTML syntax; ordinary PHP echo works too. Use the same component pattern for forms, filters, pagination, and checkout steps. See template directives.

Get started

Install

Install the core, then add the integration for your storefront or admin area.

Terminal
$ composer require magewirephp/magewire
$ php bin/magento module:enable Magewirephp_Magewire
$ php bin/magento setup:upgrade
✓ Core installed. Choose your integration next.

Using Hyvä, Breeze, or Magento Admin? Add its companion package before building your first component.

Familiar by Design

Know Livewire?
Magewire will feel familiar.

Inspired by Laravel Livewire and intentionally familiar. Magewire brings its component model and wire: directives to Magento 2, while adapting them to a different platform with different edges.

Component class
Laravel · Livewire Counter.php
<?php

namespace App\Livewire;

use Livewire\Component;

class Counter extends Component
{
    public int $count = 0;

    public function increment(): void
    {
        $this->count++;
    }

    public function decrement(): void
    {
        $this->count--;
    }
}
Magento 2 · Magewire Counter.php
<?php

namespace Vendor\Module\Magewire;

use Magewirephp\Magewire\Component;

class Counter extends Component
{
    public int $count = 0;

    public function increment(): void
    {
        $this->count++;
    }

    public function decrement(): void
    {
        $this->count--;
    }
}
A familiar shape, adapted for Magento.
Template
Laravel · Livewire counter.blade.php
<div>

    <h2>{{ $count }}</h2>

    <button wire:click="decrement">−</button>
    <button wire:click="increment">+</button>

</div>
Magento 2 · Magewire counter.phtml
<div>

    <h2>{{ $magewire->count }}</h2>

    <button wire:click="decrement">−</button>
    <button wire:click="increment">+</button>

</div>
Familiar wire: directives, rendered in PHTML.
Platform & theme support

Compatibility

Choose a tested platform combination and the integration package for your theme or admin area.

Platforms

Check the versions you deploy

Magewire V3 requires PHP 8.2 or newer. Magento Open Source and Mage-OS version combinations are exercised in the project's production-build workflow. Check that matrix, your Magento distribution, and your theme integration before upgrading a store.

See the tested build matrix →
Themes and areas
Useful with Magewire

Tools

Handy projects from across the Magento ecosystem that make building with Magewire even more fun.

A robotic bricklayer inspecting Magento runtime connections inside transparent building blocks

Made by Inchoo

Magento Bricklayer

Useful for Magewire development because it gives AI coding agents Magento runtime context that source files cannot show, including dependency injection, plugin chains, EAV, configuration, and diagnostics.

Compatible with Magewire V1 + V3

View on GitHub
Real-world adoption

Magewire in the wild.

Two Hyvä products. Two different relationships with Magewire.