And, now with the new File upload feature, things are become a lot more interesting. You get a very clean API to work with file uploads. Unlike handling a lot things in Ajax for Vue and React, in Livewire the thing is very simple. You just use the file field in your form. And then, handle the file upload like you do in a normal Laravel controller from the Request object. And now, this is what I call a clean API. People had found a lot of ways to upload file using Livewire. However, the creator understood the pain point and created something which is really awesome. You get the option to show an image preview which the user is trying to upload. This is a very neat feature and it also allows you to directly upload files to S3 in case your disk is S3. So, overall I am very happy and highly recommend exploring it.
Working with Livewire does give us certain advantages like:
- We can use secret configurations directly inside components (not the public properties). There have been so many instances, where let’s say the front end application uses an API just to get a secret key / token to poll some service. Or many times, the API server works as a proxy because we can’t share the key. However, with Livewire, that is not a problem.
- With the new File upload, it has become even more interesting. You can upload file along with preview before uploading to the server
- Most important, because this is a PHP based package, you can slowly introduce this pacakge in any running application without too much refactor.
So yes, all in all I think the package looks very promising. I have a whole video series where I build a Laravel application using Livewire components. You can check out the playlist by clicking on this link.