Why not do the same small project using both techniques, and see which one you like working with?
Vue vs livewire
Just curious as to what everyones personal preference is and why? Since I've been using laravel i haven't used either or and I'm wanting to do a small project to learn one of them but im curious to the pros and cons of each.
For me, It depends on what I'm doing.
If I'm doing an AJAX request + lots of interactivity/DOM manipulation, I prefer using Vue components. Sometimes I use Alpine too.
If it's just a simple AJAX request that needs to be in its own component, I prefer using Livewire. I don't have to mess with and compile steps and everything is done in PHP.
I say learn both as they are both incredibly useful. Maybe learn Vue first as it can be beneficial in other front end non Laravel projects. You'll also appreciate the magic that is happening once you start using Livewire.
My personal preference is Livewire + Alpine. Vue is a really great tool, but I'm just amazed at all the things I can do with Livewire + Alpine that used to take me ages in Vue or React.
My personal opinion using Laravel - I like to use livewire with Laravel projects Because the code is almost the same used on Laravel, when I use it I really like that it blends very well with the code, even with the tags done by Taylor like @if(...) that works very well, another thing is that making a test for me is faster than vue because I don't need to compile it so I can see the changes faster on the browser... Another thing I really like is that I don't need to include the tag
<div id="app"> </div>
just throw the component into Laravel and that's it.
This is from a noob view. I think it boils down to whether you want it to be rendered server-side or client-side with all the pros & cons:
https://developers.google.com/web/updates/2019/02/rendering-on-the-web
This article shows how you can use Vue and SSR with Laravel but needs to use (and learn) Google V8 JS?:
https://vuejsdevelopers.com/2017/11/06/vue-js-laravel-server-side-rendering/
I conclude as a beginner, I will focus on utilizing Livewire with Alpine.js until I'm very familiar with Laravel as a framework and then trying out Vue.js/Inertia.js as a transitory front-end framework if I need to move away from Laravel later for other projects or particular part of an app. Essentially, Laravel is a backend framework and Livewire is tightly-coupled with blade template which seems like easier to me to take on.
Just for the context, I'm actually working on a project I have made the MVP with vanilla PHP and JS, and am feeling so confused with all the framework stacks. Hence landing on this thread.XD
@wanahmadfiras you have to remember the stacks are there I believe because that's what Taylor likes.
Just saying as example if he had liked react more than vue then react would have been the big one that works with the framework mostly.
But Stacks are optional, I myself use fetch Js and regular JavaScript.
But just my opinion on this.
I did study livewire for a little just to get the basics, but decided fetch Js is more for me.
Thank you for the suggestion. As a beginner, I just want the best support out of the box before going to shopping for stacks.XD
Maybe after I do this one project V1, I'll go into the rabbit hole of frameworks. Checking out 'non-official' frameworks have made me stalling a bit.
@wanahmadfiras This conversation was 3 years ago. What do you do now? Just interesting.
Just my $2, I've taken 2 production projects (and a dozen or so personal projects) from Vue / React to Livewire + Alpine, without losing anything the clients needed (and while making it much easier to have better, faster testing for everything).
I'm sure there are some instances where Vue is a more appropriate choice, but I was shocked at just how much could be done with Alpine + Livewire. The biggest benefits have been putting almost ALL of the complex logic for both frontend/backend into Laravel, which makes it a breeze to test / debug / wrap my head around without context switching.
If you've got all the time in the world, then learn both! If you're time-constrained, I'd say learn Livewire first (it's quick, Andre has a GREAT course on it here, and for $14/month you can sponsor Caleb directly and get more amazing content). If you run into situations where you cannot achieve what you need with Alpine + Livewire, then by all means learn something like Vue, but from sheer ROI on time spent if you want to get something done fast, I'd say go with Livewire!
@shawnyv So, my thinking here ....
For v1 (prototype production0 use Livewire/Alpine
For v2 (advanced UI/UX requireements) consider using Vue as it has a lower learning curve than going the React route
So, I am creating a v1 app and need to get into users hands ASAP, I am going the Livewire/Alpine route and honestly, may never even bring Vue into the project.
@shawnyv Great story! Thanks!
Isn't LW very consumptive of DB queries?
@cleargoal Maybe?? I guess it depends on your application and how you structure it.
Maybe you're thinking of high network requests vs. DB requests? But even there, there are plenty of strategies to reduce that (most coming out of the box with Livewire 3, like forcing you to use .live or .blur to indicate that you want to update the server state).
I have been using Livewire and Vue both. I agree that Livewire is way simple and can handle almost anything you will expect from Vue.js
However, I would like to tell you one scenario where I have to use Vue over Livewire. I am pretty much sure there are other scenarios as well.
I wanted to have the feature to upload GBs of the video file and of course, for such a thing the optimum solution is you need to chunk the file and then upload it.
With Livewire it is a bit difficult but with Vue it is simple. With Vue, it is simple to send each chunk after the previous chunk is uploaded. With Livewire I needed to spin my head around to do this but ultimately ended up with Vue.
As Andre said, both of these frameworks are very powerful and super amazing. I would suggest trying to learn both helps so that you can build a robust application.
For me TIME is my most valuable asset, and to that end, I judge the documentation, tutorials and community support as being critical to the learning exercise. So far I find the Vue documents substantially superior to LiveWire, and therefore easier to get on with.
@vincej I agree totally. I wish we could use both livewire and vue at the same time easely without having to rewrite a layout for each.......I think I am gonna drop livewire as I find it too restrictive.
This post has been initiated 6 months ago, but I'd like to say something.
I use Livewire and VueJS too. One day a friend told me : "Why are you using Livewire ? Don't you know VueJS ? It's easier, better and faster. Livewire is slow."
So I tried VueJS on two projects, and to compare with Livewire, I again tried another project with Livewire.
I feel that both technologies are good technologies and it's above all in which one you can code easily. And perhaps sometimes Livewire is sufficient, other times VueJS is better. If you have to develop some application with great reactivity like in facebook for example, perhaps VueJS is better ; but if you have to develop some application to manage datas (billings, stock, ...), Livewire is perhaps more convenient.
But when I tried again with Livewire, I had some feeling about the ease to code : all in one place, nothing to compile again and again, ... the great advantage for Livewire is to gather at the same place both front and back, to offer reactivity, to be secure with all Laravel functionalities (gates, middlewares, policies, form requests, ...).
So I think Laravel is very powerful by itself and is convenient and sufficient for a majority of projects.
But some else who loves VueJS could perhaps say something else ;).
This short discussion was very informative. Thanks.
I have used Livewire and Alpine.js to build the user area..... Currently, I am thinking of using Vue.js and Vuetify.js for the admin panel.
Let me know what are your thoughts!
Edit: Maybe I would use the https://github.com/livewire/vue plugin
@zainali I don't understand what benefit to use both livewire and vuejs together.
@vincent15000 Cancelled that plan of using VueJs for the admin panel... Now, I am using alpine.js and livewire for the admin panel.
Please or to participate in this conversation.