This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

JimRed
JimRed

Hello All,

What do you think, it would be possible to make Laravel Livewire work with OctoberCMS?
Livewire was built on top of Laravel controller structure and Blade templating system so it is a bit far from OctoberCMS ecosystem but it would be useful to have its features. What do you think, is it possible to make them work together?

Thanks in advance!

JeffGoldblum
JeffGoldblum

It's not really necessary in our point of view, Livewire is basically the AJAX framework / component system that already exists in October. I would recommend you play around with that a bit to understand how it works and then you'll probably find that you don't need Livewire over and above that.

JimRed
JimRed

Hi Luke,

Thanks for your super-fast reply. :)
You are totally right, we can achieve the same results by AJAX framework / component but built-in functions and attributes are just simply not enough in several cases so we end up writing pure javascript (jquery) codes and yeah, it does the job but using JS these days... I do not know. It makes me feel my code is lost its modularity and clean structure, you know.

OctoberCMS AJAX and component system is really good and you are right, it can be used instead of Livewire but I think it would require some improvements.
For example data-request and data-track-input attribute is a gem but what if I would like to call AJAX request onBlur? (write pure JS). Also data-request-data attribute is very helpfull but as far as I know it is not possible to refer a DOM element/value in it without pure JS code. Or maybe my knowledge is too few about OctoberCMS. :)

joseph.d
joseph.d

When I first discovered Livewire, yeah, my first thought was that it's very similar to the way that October's Data Attributes API works. I've used this the Data Attributes API in October for years and I really love it.

But I agree with JimRed, October's Data Attributes system just isn't as fully featured as Livewire and I don't like the idea of having to write JS in an October or Laravel app for something that should really be quite straightforward to stick in an HTML tag. If I wanted to write JS, I guess I'd learn Angular, Vue or React. But, personally, I like PHP and I'd rather write that and HTML and let a framework deal with the JS for me. I think a lot of PHP devs are like me and feel uncomfortable with JS.

From the October docs: "The data attributes API lets you issue AJAX requests without any JavaScript. " -- well, yes, it does, and this was pretty cutting edge when it was first added. I was blown away with how easy it was to use. But people expect a lot more from an AJAX framework these days. JimRed mentioned onBlur. How about the History API as another example?

I'm not saying that I necessarily want to see Livewire integrated into October (although I wouldn't mind!) but I do think that the October Data Attributes API could do with updating. The expectation to be able to wield real JS power on the client without writing any actual JS is becoming more and more common in PHP development now. Laravel's Jetstream is an example of this.

It's beyond my skillset but if anyone wants to propose a PR to add decent History API support to October's AJAX framework then I'd definitely be willing contribute a little bit financially.

LeMaX10
LeMaX10

JimRed said:

Hello All,

What do you think, it would be possible to make Laravel Livewire work with OctoberCMS?
Livewire was built on top of Laravel controller structure and Blade templating system so it is a bit far from OctoberCMS ecosystem but it would be useful to have its features. What do you think, is it possible to make them work together?

Thanks in advance!

Yes! I have ported livewire to octobercms 1.1. The version is still in development without documentation, but this should not prevent it from being used in your work.

https://github.com/LeMaX10/oc-livewire

JenniferLopez
JenniferLopez

joseph.d said:

It's beyond my skillset but if anyone wants to propose a PR to add decent History API support to October's AJAX framework then I'd definitely be willing contribute a little bit financially.

@joseph.d I realise you posted this a few months back, sorry that I've only just seen it. What sort of History API functionality are you looking to implement?

While I think Livewire is something best relegated to a plugin (such as what LeMaX10 is working on), I'm very interested in trying to modernise the October AJAX framework a bit and make it as extendable as the PHP side is. I've been doing some work on this when I've had some time available and am hoping to bring it forward as a proposal soon.

edit: It looks like the core team have recently built a Livewire Plugin for October CMS. Amazing!

Last updated

1-6 of 6

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.