Skip to content

u/assertchris

In this archive from Jul 2014 to Apr 2021

88
posts
1.3k
comments
28
media
4.8k
score
4 saved before deletion

Top posts

Top comments

EDIT: since my comment has more Karma, I’m hijacking it to link to a response by Caleb (the creator of Livewire) below: https://www.reddit.com/r/PHP/comments/eu14s8/making_the_case_against_laravel_livewire/ffpcof4?utm_source=share&utm_medium=web2x


I'm probably a little too close to Livewire to respond in depth to this, but I'll point out a few factual inaccuracies, and make a couple suggestions:

  1. Your Separation of Concerns seems more like Separation of Technologies. The Livewire component is the view model layer. The front-end is not the view model layer, in this case.

You shouldn't be putting code you would usually see int he model inside your Livewire component, etc. I can understand the resistance to separating the view model layer between server and client, but that's not an SoC problem, and it's arguable whether it's a problem at all.

Livewire isn't a replacement for your rich front-end layer. It's PHP with some help to make the front-end more responsive. If your PHP server fails (in a JS-free app) then the app fails. Same constraint here.

  1. For this same reason, I don't agree that Livewire forces you to violate SRP.

  2. It can be inefficient, depending on how it is used. It also attempts to reduce that with built-in debounce and lazy binding etc. I'm sure egregious cases can be raised with Caleb...

  3. Nested components can be reactive, by using keys. Caleb demonstrated this on Matt's recent stream, and I've been using keys to make nested components reactive in prod; for a while now.

  4. Your Lack of Support seems more like Doesn't Have The Tools I Want, and probably never will. Caleb is 1 dude, not an entire team and Facebook. Help the guy out with some dev, or...like...understand the fundamental limitations.

  5. Since version 0.6 (I think?) Livewire supports models and collections in public properties. It has supported casts longer than that, which actually solve the same problem in a way that you can pass additional custom types to the view layer. Perhaps this is a problem you encountered in an older version?

Here are the suggestions:

  1. It feels like you could have sent this entire article to Caleb, and he would have told you all these things I've told you, first. The project is really young, and articles like this can do it real harm, by spreading misinformation. If you had his (and the project's best interests) at heart, that seems like something you might have wanted to do in the first place.

  2. Watch Matt's last 2 streams about Livewire. They address some of what you've spoken about here.

39 points

Subreddits

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.