Skip to content

Blog

Magewire 3 - A Different Kind of Blog

This time, a slightly different kind of blog than what you might be used to from me. No deeply detailed code snippets, no breakdowns of new features, just a few thoughts I wanted to put into words. Maybe you’ll find it interesting, maybe you couldn’t care less. Either way, that’s fine by me.

Picking Up Magewire V3 Again

Recently, I finally picked up Magewire V3 again. I had set it aside for a couple of weeks to focus on other things. But now that I’m back at it, I immediately remember how great it feels to work with Magewire V3. It gives me so much energy to build things in a way that feels closer to frameworks like Laravel. It’s not overcomplicated, it’s refreshing, and above all, it’s just fun to build with.

The Challenge of Building in Open Source

I’ve said this before, especially when people ask me why I spend so much time on something that, for all sorts of reasons, might never really take off. And honestly, they might be right. In our community, it’s tough to get an open source project off the ground.

Sometimes I wonder if I should just start charging money for it; maybe then people would take it more seriously.
The skepticism often seems to outweigh the curiosity and passion.

But that’s okay. Let this project fail, or maybe, who knows, become a success. The truth is, Magewire has already helped make several major commercial products successful, even if that’s not widely known or mentioned. And knowing that others benefit from it, in whatever way, genuinely makes me happy.

It’s not about money for me. Magewire is my passion project, a space where I’m completely free to create and share my vision on programming.

Not Perfect, But Honest Work

Of course, it’s not perfect. Many of the things people expect from a “good” package are still missing. I’ve repeatedly asked for help on that.
If you think you know better, and especially if you spend your time criticizing others, then stand up and show us something useful instead of recording endless podcasts and screencasts talking about what’s right and wrong. Roll up your sleeves and build something.

It’s such a waste of time to compete in an already small and fragmented community like ours. Let’s, for once, actually pull in the same direction. Stop reinventing the wheel over and over again and trying to sell every little thing as the next big thing.

Why It Takes Time

That’s never been what Magewire is about. And yes, I know, V3 is taking a long time. Maybe that’s because I’m never satisfied. Or maybe it’s because I just enjoy building new things too much. I don’t know.

What I do know is that I’m genuinely doing everything I can to get it out of beta. But working on something mostly alone, while constantly hearing people ask when it will be ready, can be discouraging at times.

If you really want to see it released, then help. I truly believe that, even beyond the successful products already built with Magewire, we’re still at the very beginning of what Magewire could mean for Magento. Especially now that Hyvä has gone open source and Magewire fits it perfectly.

Finding Joy in the Process

No, I’m not shouting for help. I’m already incredibly grateful to the sponsors who make this even remotely possible. The cost-benefit ratio doesn’t really make sense, but as I’ve said before, that doesn’t matter.

I find happiness in working on Magewire. It helps me clear my head and spend a few enjoyable hours building something I’ve been turning over in my mind during a nice walk with my family.
Happiness lies in the small things. That’s what matters to me, not competing, not forcing people to use Magewire, not yelling that what I do is better than everything else.

Meet Magento Netherlands

One side story that perfectly fits these thoughts came out of nowhere during Meet Magento Netherlands. Working at and witnessing a company visionary enough to take the bold step of open sourcing one of their core products was already a highlight for me on its own.

But then, out of the blue, two developers walked up to me and told me how much they already love Magewire V3. That simple moment was another highlight. It reminded me how much just a few kind words can mean to someone.

On top of that, they mentioned they’ve been using another small side project of mine called Portman, which actually played a big role in making Magewire V3 possible. They showed me what they’ve built with it, which honestly amazed me... especially since Portman isn’t something I’ve talked about much. It’s so fun to see people recognize its potential.

Proud of Open Source

I couldn't leave out a word of pride and acknowledgment for Hyvä open sourcing their theme product.

As I said, it makes me proud knowing I work for a company that sees the value of open source and really tries to grow the movement, inviting all those small and starting merchants into our ecosystem.

Not to forget the new pool of developers we can potentially reach. My mission with Magewire has been from the start to reach a new and young pool of developers, creating a package that is maybe different, but aims to make Magento refreshing.

Hyvä has been doing something similar and has become very successful doing so. Agencies can now onboard less experienced developers and get them up to speed with Magento without endlessly sending them to costly training days, which already tells me that Magento is too complex.

Magento should embrace open source even more and focus, in my opinion, less on committees, groups, and boards, and more on code, repositories, and contributions in whatever form. Every time I see a Association presentation at a Magento-driven event, it’s mostly about who joined the board and when the next election takes place.

Don’t get me wrong, these things are very much needed, but I really miss those diamonds on GitHub being exposed. Please, try to see the value in those efforts.

A Final Thought

In the end, I just hope Magewire inspires others to build, to explore, and to contribute in their own way. Open source thrives on shared passion, not competition.

If we can create more by working together than by standing apart, then every line of code, every late night, and every small step forward will have been worth it.

Magewire 3 - Beta Release

Yes, it’s been a while

The months have flown by. On the surface the repo may have seemed quiet, but nothing could be further from the truth.

Behind the scenes, I’ve been working in a separate branch on a hefty list of additions that I absolutely wanted to include in the upcoming beta release.

Critical Security Vulnerability

The biggest strength of Magewire, and one of the main reasons I took on this challenge, is the incredible community already behind Livewire. Livewire has already proven itself as one of the two biggest game changers in the Laravel community.

This means Magewire is not just another new brew of technology in the Magento ecosystem, it’s already a proven solution similar to e.g. AlpineJS.

A good example is security: on July 17th, a critical security issue was fixed in the Livewire repository, and within just 10 minutes, the same fix was applied to Magewire thanks to the way it has been built (ported).

So What's Next?

Feature building has stopped for now. It’s time to focus on improving testing across the board, ensuring everything remains backwards compatible, and writing documentation on how to migrate.

In the meantime, I’m trying to establish a small team to speed things up. But I’ve found that asking for help and getting valuable input is really a struggle—which I totally understand.

Open source in our money-driven community is incredibly difficult, with most people either waiting until something gets released, or creating a clone of what Magewire already is and ending up in the same rabbit hole.

It’s somewhat discouraging, but I suppose that’s the reality :D

So What's New?

I’d like to take you along for a look at what’s been happening, and honestly, these additions are features I’m incredibly excited about.

Fragments

Fragments are a way to convert HTML into what we call a fragment, both inside your template files and even within PHP files. At its core, it’s nothing more than wrapping a piece of HTML so you can give it a name.

The real benefit, however, lies in what you can do with it afterwards. For example, you can treat a fragment directly as a CSP block whenever it involves a <script></script>. And thanks to modifiers, you can centrally manage your fragments without touching a single template.

Fragments were initially intended as a better solution to make scripts CSP-compliant. However, they eventually grew into much more, where they are no longer only needed for CSP or for wrapping <script> elements.

<?php $script = $magewireFragment->make()->script()->start() ?>
<script>
    ...
</script>
<?php $script->end() ?>

Please refer to the documentation for more details.

Template Directives

As you might know from Laravel, Magewire now also supports the use of @ directives inside your Magewire component templates.

Simply put: if you want to display something inside your component only to a logged-in user, you can just wrap it with @auth and @endauth.

The nice part is that this system is built in such a way that you can extend it with your own prefixes.

For example, you could create a @{agencyNameGoesHere}CustomerGroup(1) directive, which ensures content is only shown when the customer is logged in and belongs to customer group 1. This directive would then belong to the agencyNameGoesHere group (area to be specific).

And don’t worry: thanks to the built pre-compiler, everything is precompiled into actual PHP in advance, so nothing happens on the fly.

<div>
    @guest
        <!-- Will only be shown to guests. -->
        <span>Hi guest</span>
    @endguest
</div>

Please refer to the documentation for more details.

Flakes

I really wanted to create a “good” system that lets you easily add re-usable components inside your Magewire components using nothing more than simple HTML syntax. No complicated stuff, no need for additional ViewModels or other workarounds, just like in the following example.

class Dialog extends Component
{
    public string $title = '';

    public function mount(string $fooBar, AbstractBlock $block)
    {
        //
    }
}

Where your template simply looks like this:

<?php $title = 'Hello World'; ?>

<magewire:dialog name="my-component"
                 prop:title="$title"
                 mount:block="$block"
                 mount:foo-bar="baz"
/>

As you can see, you can easily inject public properties, pass mount method arguments, and use template variables as an attribute value.

Please refer to the documentation for more details.

Stream Directive

The Streaming feature has been made compatible and now works within Magewire.

Thanks to the Portman tool we built, it only took about 15 minutes to get it running.

Fortunately, this feature isn’t too complicated, but it does provide you with some cool new options.

Please refer to the documentation for more details.

Rate Limiting

Livewire does not officially support this, but for many reasons I felt it was needed, so I went ahead and built it.

Rate limiting can now be applied in multiple ways. One option is via the frontend using wire:mage:throttle, where most of the handling happens on the client side. This is not bulletproof, though, since a smart user could easily work around it.

That’s why server-side rate limiting has also been added. Based on system configuration, you can now limit the number of subsequent requests within a specific time window.

Cool thing, by default, its cache driven, but you can build your own adapter if you'd like.

Observer Events

It’s not always easy to learn a new framework, I know that. That’s why, wherever possible, we should provide an approach that already feels familiar to you as a Magento developer.

For every hook you can tap into, an observer event is automatically dispatched. This means you don’t have to create a separate Feature for just a small tweak. Instead, you can simply add an event in your events.xml and use the provided Data Transfer Object (DTO) to pass data along to the hook.

Please refer to the documentation for more details.

Backend Compatibility

Yes, Magewire is coming to the backend. All you need to do is require the new module magewirephp/magewire-admin.

I’m currently wrapping up the final details, and then nothing will hold us back from using this powerhouse of a framework in the backend as well.

Magewire 3 - Hello World

Here We Go!

A promise is a promise. I said Magewire V3 would be released a week after the docs went live, and I'm a man who sticks to his word—even if V3 isn't quite where I'd like it to be yet.

From this point forward, we're going to build this airplane while it's getting ready to take off. Luckily, we're still taxiing on the runway, and as long as that beta tag stays on, we'll keep it grounded until it's ready to fly.

The Journey Is What Matters Most

They say it all the time—the journey itself is more important than the destination, and that's no different with Magewire. I've learned an incredible amount as a professional, but also as a person, during this development process. For me, it's been such a beautiful experience to work on something where I could completely let loose on how I wanted the architecture to be.

Through all the years working with Magento 1 and Magento 2, I've always had an extreme interest in architecture and kept challenging myself to improve, try new things, and sometimes go a bit outside the lines of old-school Magento standards. Not everyone always appreciates that, but I figure—if I don't try it and make mistakes, how are we ever going to make Magento attractive to the new generation of developers who really do think differently?

The road has been pretty long, and fortunately, the endpoint isn't in sight yet. Even though many people ask me why I invest so much free time in something that doesn't pay back in a community like ours. I can't say anything other than—this is completely true. The investment is ridiculous, and sometimes I ask myself that same question: what am I doing all this for?

For me, the answer is simple: it makes me incredibly happy. Working on my own thing, not constantly having to worry about what someone thinks of it, and just being able to pour all my knowledge into an ultimate project that I couldn't imagine working without in my daily work anymore.

Now for the Serious Stuff

V3—a lot of the same, plus some innovations that came about partly through necessary things like CSP and other things I've had on my wishlist for a long time but could never really make happen in Magewire V1.

The architecture is solid now, but not everything that's standard in V1 is in V3 yet. There's still plenty that needs to be ported over, but I expect this will go much faster now that all the tools are available. So over the coming months, that's roughly the plan for the beta—to work (hopefully together) toward a version that at least contains everything V1 has.

What's New?

Good question. There are many new features like Fragments, which let you mark sections in your PHTML and tweak them using modifiers. Fragments came about because of CSP—I wanted a tool I could wrap around a script block and then optionally modify based on different variables, like adding a nonce attribute or creating a hash of the content and passing it to Magento's CSP collection. I've expanded this concept to offer other fragments in the future. You could think of feature flags, for example where you can show part of your PHTML only based on a specific version of another package.

There's also a new @ compiler that allows you to use so-called @-directives in your PHTML that automatically get converted to valid PHP during compilation. This creates cleaner, more readable PHTML, but also means less actual PHP code in the PHTML files. There's much less need for all kinds of View Models and Helpers to get things done. I have some really exciting ideas in the pipeline for this feature that I hope to add soon. The groundwork is already laid.

Of course, the completely new documentation shouldn't be forgotten either. I'm glad I set this up because I can now write about things much more specifically compared to the previous approach where everything was buried on a single page in the Magewire repository itself. The domain name might still change to make it easier to find, but the first steps have been taken.

There's so much innovation that I could write endlessly about it, but I think it's smarter for you to take a look at the documentation to get a good picture of what might be relevant for you.

Finally

I'll try to write a blog post every month about Magewire's progress, but I won't make a LinkedIn post about it every time. So definitely keep an eye on this blog page if you're interested in more reading material about this project!

And if you feel the urge to contribute, whether through code or financially, I invite you to get in touch!

Magewire 3 - Docs Publication

Kicking Off a New Chapter for Magewire

First, I’m excited to share that starting today, all future updates about Magewire will be posted right here in the blog section of the documentation.

This shift is all about keeping things simple and centralized. No more jumping between websites to find the latest news or resources—everything you need will now live alongside the docs.

The Wait Is (Kind of) Over!

For those who’ve been patiently waiting: the long silence is finally breaking—at least in terms of documentation.

I’ve spent months putting together the foundation, and while there’s still some work to be done, I’ve decided to release the docs ahead of the actual beta launch.

My goal is to give you a head start—to inspire, to motivate, and to let you explore what's coming in Magewire V3.

The beta code itself is planned for release by June 1st. I just need a few more evening sessions to get it over the finish line.

A Work in Progress (Literally)

Let me be upfront: the documentation is still very much a work in progress.

You’ll see a few WIP... tags sprinkled throughout. These are simply placeholders and reminders for myself—sections that still need attention.

Why This Release Matters

The main goal right now is to help developers get started with V3 as early as possible. By putting the documentation out there, I’m hoping to lay the groundwork for the community to join in and help shape its future.

That said, this is still a passion project—one I mostly work on during evenings and weekends—so progress might not always be rapid. Thanks in advance for your patience and understanding.

What’s Next?

In about a week, I’ll push the V3 beta under a new beta tag in the Magewire GitHub repository (which you probably already know your way around).

From there, things become a little less predictable. The pace of development will depend on a lot of factors, including time, feedback, and community involvement.

Thanks for being part of this journey. Let’s make something awesome together.