Ruling arrays, finding arrays, and surfacing validation errors
Download MP3This is the Laravel News Podcast, your one stop podcast to find out about Laravel related news, tutorials, packages, and more. Here are your hosts, Jake Bennett and Michael Dyrynda.
Jake:Howdy ho, all you lovely people out there. My name is Jake Bennett. And with me as always is the amazing, the illustrious, the Aussie, mister Michael Dyrynda. How's it going, Michael?
Michael:Hello. Yeah. Going going well. Going well. Big call.
Jake:I see you got your you got your Lakers, your Lakers wear on there?
Michael:I'm celebrating the Nuggets getting knocked out of the 2nd round.
Jake:There you go. There you go. I should be keeping up more with it. Give me the latest. Give me give me what's going on.
Jake:What's the drama?
Michael:So the Lakers got knocked out in the 1st round in 5 games to the Nuggets. Okay. New York made the biggest push they've made in a long time. The Knicks, made it to the 2nd round. And, coach Tibbs is, likes to play his players lots of minutes, and that kind of caught up with him in the end, I think.
Michael:They had Julius Randle got injured during the season. He was out. So they were, you know, not playing a man down, but also only going, like, 7 deep, on the bench. So, unfortunately, they they lost to Indiana. Indiana and Celtics will play in the Eastern Conference finals, and, Dallas overcame Oklahoma City to go to the Western Conference finals and face the Minnesota Timberwolves, who despite being
Jake:down wolves.
Michael:Yeah. Despite being down by 26 odd points against the Nuggets in Denver, came back on, like, a 58 to 22 run or something like that and Yeah. Ended up with a with a good win. So, I mean, it's
Jake:Who's the team to watch? Who you who do you, who do you predict?
Michael:Well, I think Boston will come out of the East. I mean, I would prefer they don't. As a Lakers fan, I think they've gotten close enough to to getting one up on the Lakers already. But I think Boston will probably come out of the East in in 6. I reckon, Indy will will push them a little bit in a couple of games.
Michael:And how to tell in in the west? Like, Luka and the Mavs are very good. Kyrie Irving, very good. But, Minnesota have just been hunting all year, really. And and they hunted like they figured out what the Lakers figured out in in 2020 when when we won the as some call it Mickey Mouse ring that, you know, you need to have 3 bigs to throw different looks at at, Jokic.
Michael:And that's what they did with Kat and Naz Reid and, and Rudy Gobert. So they've got 3 big guys that are playing really well. But Luka Luka is a superstar. So
Jake:Yes. I'm I'm happy with either
Michael:of those those two teams. I've got I've got a soft spot for Dallas because a lot of a lot of the guys I went to to high school with were Dallas fans. And so I've got a bit of a soft spot for them. But Minnesota haven't been to the the the Western Conference finals in 20 odd years. So take a pic.
Jake:I think you need another podcast. I think you need another podcast talking about NBA. Talking
Michael:about NBA.
Jake:Yeah. Seriously.
Michael:No. No. There are plenty of people out there who know what they're talking about. I just
Jake:It sounds like you know what you're talking about to me, dude. It sounds sounds good to me. It all sounds great. I know Luka, we went to see a Bulls game and versus the Mavs because we really wanted to watch Luca play, and he was out that game, of course. But that was Graham's Graham's birthday last year.
Jake:So, oh, no worries. It was fun, though. We got to see the Bulls, and that that was really fun. But it'll be interesting. I'm sure we'll start watching, once it gets a little bit closer to the end.
Jake:This
Michael:is this is it. Is there's 2 rounds left. There's the these are the conference finals now.
Jake:I'm saying, like, the end end. Oh, June. The end end. Well, yeah.
Michael:June 6th, I think. I think June 6th, the the finals will start with whoever wins these these 2 series. So
Jake:We get a we usually get a couple, couple dudes together with our sons and go to Buffalo Wild Wings and go watch some of the finals. And so, yeah, it's always a fun time. It's always a fun time. Well, hey, folks. Before I get too much further, I did want to mention quickly that this episode is sponsored by MailTraps.
Jake:We'll talk to you about them a little bit later in the show. But this is episode 215, and the date today is May 21st. So thanks for hanging out and joining us. If you love the NBA, glad you got to get a little debrief of that. And, if you ever have questions you should not ask me, you should definitely ask mister Dorinda, who though though he lives in Australia, knows much more about the NBA than many of the people that I know.
Jake:So with that in mind, why don't we get into it, shall we?
Michael:Yeah.
Jake:Okay. We are gonna start with releases. So we've got Laravel 11.7, which was released to the week of May 7th with a new rule array validation method and where JSON overlaps method for MySQL, a Slack open ID provider for Socialite, and more. So let's talk about that rule array method. So Jacob Pataki contributed the rule array method.
Jake:And what this does is it validates multiple array keys using the array validation rule. So it enables, using this rule with arrays and collections without having the concatenation of dynamic values. And so, for example, before, what you might have had to do is you would have had to say array, and then I want a backed enum value or a backed enum value 2. Right? So it needs to be one of these values.
Jake:And then afterwards, what you could do now is you can just say rule array, and then you specify the values that you're looking for. And so you can do this with enums as well. It supports that as well. Pull request 5,1250 for full details on that. So that's a nice it's it's definitely nice to not have to concatenate all those together with little string concatenations.
Jake:It looks kinda messy. This definitely looks a lot cleaner. So nice job on that, Jacob. Thank you so much. Stringable support in blank and filled helpers.
Jake:So, what this allows you to do is it allows you to take a stringable value and then pass it into the filled or blank helper. So filled or blank are just sort of global helpers that allow you to determine if a value is blank or filled as is, you know, as it would as you would assume. But it's nice because it does things like if it's an empty string or if it's a null value or if it's a false or if it's a 0. Right? There's some rules around which one should be blank, which one shouldn't be blank.
Jake:Right? So I use these typically, quite a bit. But this now allows you to do if you had, like, STR, like if you're making something a stringable STR and then you pass a string in there, you can now pass those stringables into the filled or the blank, and it will handle them correctly. So that's a nice little, contribution there by Stefan R. Thank you for that.
Jake:Benjamin Ayliss contributed support for MySQL's JSON overlaps feature that compares 2 JSON documents. And so you can say user, double colon, where JSON overlaps, languages, and then you can say en or French, like English or French and check to see if it exists or where JSON doesn't overlap. So you can look to see if there's basic it seems to me almost like a array intersection. Like an intersection. Almost like yeah.
Jake:Exactly. Is there an intersection between these 2 JSON fields? And so you're specifying the one by saying this is the column I'm looking for. And then in the second one, you're basically saying here's the here's the values that I'm looking for. If it's any of these and it's in that JSON column and it exists, then that's what this helps for.
Jake:So JSON overlaps. It's a feature of MySQL, but you can now use it inside of Laravel.
Michael:Can I We have a we we move on? Yep. I I would be remiss if I didn't correct you. His last name is Ailes, Benjamin Ailes.
Jake:Ailes. I'm gonna say Ailes.
Michael:Yeah. Used to work with Penn. So
Jake:Benjamin Ailes.
Michael:Benjamin Ailes.
Jake:Thanks, Benjamin. So next one then, we have Matt Matt Jonas? I'm just kidding. Matt Jones. I used to work with Matt.
Jake:It's a good it's an inside joke. Not really. Matt Jones contributed a new event called password reset link sent. I bet you can't guess when this fires, Michael.
Michael:Woah. It's a tricky one, man. Is it is it when the password reset link is sent?
Jake:You nailed it. You must have been looking at the pull request. Pull request 5123. Yeah. Exactly right.
Jake:Yep. So this, this event gets fired when a password re reset link is sent. Okay. Socialite then. Moving on to Socialite.
Jake:So Socialite is a Laravel first party package that helps to ease the burden of implementing OAuth. And so now we have a Slack, open ID provider for Laravel Socialite. So you can see pull request 704 for that. Martin Pao. Pay Pao?
Jake:I don't know. Maybe? Any any help in that one?
Michael:Help me. Together like that. It's, I'm gonna go with Powell,
Jake:Martin. Powell. K. There it is, Martin Powell. And then you've got the full release notes, of course, and changelog hosted on GitHub under the changelog dotmd.
Jake:So check that one out if you need to. Thanks so much for writing that one up. Everyone's favorite human, mister Paul Redmond.
Michael:Excellent. Moving on to the news. And we're a bit of a news heavy episode this week, a bit of PHP 8.4 rumbling coming on. So the first article here, also by Paul Redmond, is a look at what is coming to PHP 8.4. It's coming soon, which is a stretch of the term.
Michael:I think November is when PHP 8.4 is due for release. But, November 21, 2024. So the release will feature 6 months of pre release phases. We'll go through alphas and betas and release candidates and the official release, But we've been talking lately about PHP property hooks, which we've spoken about on a previous episode. It's inspired by languages like Kotlin and C Sharp and Swift.
Michael:The syntax includes 2 syntax variants that resemble short and multiline closures. The best way to describe the property hooks is if you've ever used Laravel's attribute syntax in your Eloquent models, where you say return attribute colon colon make, and then you have a get and a set method. Very similar kind of thing, but this then hoists that up into a first party sort of PHP native piece of functionality. So we'll include links to property hooks in the documentations. But largely, it helps to remove boilerplate of having to create getters and setters and allows properties to define access and update using hooks.
Michael:And the other sort of big ish feature that is coming is the ability to call new my class, for example, without having to wrap new class in parentheses. So previously, you'd have to do something like open paren new my class close paren arrow method if you wanted to to to call a method directly on that instantiation or you have to assign it to a variable or you'd use like a a makeable trait and create like a static make method on that object in order to go, you know, my class colon colon make. So this gets gets rid of the the need for those extra parentheses. I personally don't really like having that dangling new method there. I'd rather have the parentheses there, but each to their own.
Jake:I'm the option
Michael:of going either or. So this, this update fixes of course you do. Of course you do. This this update fixes a paper cut that makes working with class member access simpler, not having to add the surrounding parenthesis or using a static constructor method. The syntax change also puts PHP more in alignment with other c based languages, like Java, C Sharp, and TypeScript that don't require the surrounding, parentheses.
Michael:So we have links to both of those RFCs in the show notes if you want to dive deeper into what's coming.
Jake:Do you wanna talk about the next one too? Just because it kind of has a lot to do with what you were talking about already with the property hooks and a dot 4.
Michael:Yeah. Yeah. So it's like the RFC that that we just spoke about amidst the parentheses around the new expression. And and we said specifically around calling methods, but you'll have access to any of those class members. So you could say, you know, new my class colon colon constant or static property or static method or, calling properties directly or methods directly or even calling the invoke method by saying new my class, open paren, close paren, open paren, close paren.
Michael:So there's there's a number of different things that it that it tackles. We will have links to to both that both of those things in the show notes to kind of go into a bit more detail.
Jake:So I think I might have messed you up on what exactly I was talking about. I was looking at the next one, which talks about the fact that the property hooks RFC. Yeah. The property hooks RFC, which is basically just saying this this, this article is essentially just saying that we don't know if we're positive that property hooks are coming to 8 dot 4. It's still possible that it could get voted down, but it's very unlikely that there's it requires a 2 thirds majority vote to pass.
Jake:And right now, there is 34 yes and only one no vote, I think. It's totally possible. Yeah. It's it's very likely it's going to pass. So, I really like
Michael:this. It was approved.
Jake:Oh, perfect. Great. Yeah.
Michael:It was approved. Yeah. Property property looks like it's coming. Mhmm.
Jake:You know what got happened? You know what happened? Mhmm. This was a leftover. Yep.
Michael:No worries. The the my class method stuff is is still in voting at the moment. But that one looks like it'll pass is 225 to 4 at the moment. So I don't think there'll be any any reason for that to not pass.
Jake:There we go. There we go. Excellent. Okay. So let's talk about one other item, or a couple other items I suppose here, but that are coming to 8 dot 4, which is a new proposed array find set of functions in 8.4.
Jake:So there's 4 new array functions that are likely going to be coming to 8.4. We're still again in the RFC voting stage for these ones, But the the four methods that are likely going to be coming are array find, array find key, array any and array all. So let's talk about these in order. So the array find takes an argument. The first argument is the array.
Jake:The second argument is a callback. So what this does is it returns the first element in the array for which the callback returns true. So So if you're thinking in Laravel world, this would be equivalent to doing first. Right? So if you have a collection and you call arrow first and then you pass a closure in there, that would return the very first value in your collection or in your array that matches or that returns true from that closure.
Jake:Then we have the array find key. So this function returns the key of the first element for which the callback returns true, very similar to array find. Right? So pass in the array, pass in the closure, it just returns the key instead of the value. It also will return null if no matching element is is found.
Jake:And then lastly, we have the array any and array all. So this is the second part of the RFC, and so it could it's possible that we can have the array find and array find key without these, but it's likely that they're all gonna get pushed in together. So, you can use these functions if any of the items in the array return true for array any and if all of the items in an array return true for the array all respectively. So, array any basically just it's it's almost like an exists. You know what I mean?
Jake:Is or any of these values present in this array? Array all says every single one of these needs to match, needs to match as true in this, you know, closure, and that will return a true value for you. So, yeah. Makes sense. I I think it's basically just bringing some I I wouldn't be surprised to see in the future, some of these collection, these Laravel collection and array methods just swap out under the hood to use these native implementations of it and still leave the syntax there for people who want to use it, but probably not for quite some time as that would require the 8.4 as the minimum version.
Jake:So we're looking to probably another couple of versions of Laravel before they do that, but there you go. You can use them, as soon as you implement 8 dot 4 if you wanna use the native functionality rather than having to use the Laravel syntactic sugar on top of that. So Yep. 8 dot 4. Laravel 8 dot 4.
Jake:Sorry. PHP dot 4.
Michael:Yeah. Those ones are are still voting at the moment until the end of May, but they're passing 16 to zip and 17 to zip in in the 2 Yeah. To culminate all the 2.
Jake:I love that. I feel like It's there.
Michael:So yeah. Definitely. I think
Jake:it used to be harder. I think it used to be harder to get some of these things pushed in. Yeah. I think I mean,
Michael:some of the some of the stuff previously was a little bit more, complex in terms of what they were trying to achieve. Whereas, you know, adding new functionality is always just a bit simpler than than trying to change existing stuff and things like that. And, and it depends on how much complexity there is behind the scenes in terms of, you know, the the compiler and things like that as well. So
Jake:yeah. Yeah. I do wanna say one thing real quick. Yeah. So, we're on 8 dot 2 currently.
Jake:We were going to make a push to do 8 dot 3, but I looked back at some of the blog posts we had around 8 dot 3, and I'm like, you know, there's just nothing killer that I'm really after in that 8 dot 3 stuff. I don't there's just there's not a lot there. And so the only thing that would push me to 8 dot 3 would be end of life, on 8 dot 2. But that's not gonna happen before 8 dot 4 is released. So I'm going to just skip 8.3 for now and push straight to 8.4.
Jake:That's what we'll probably do. So probably early next year is what we'll be looking at. And, the things that I do really do like those property hooks. I think that looks really cool. I could see myself definitely using that and the ability to, you know, call methods directly on a newed up class instead of having to wrap it parens it like that too.
Jake:So so those are 2. They're not huge things, but it's like, oh, okay. I could see myself using those. So we'll probably just hold off on 8 dot 3 and jump straight to 8 dot 4. Maybe the rest of you looking to, make that decision will do the same.
Jake:We'll see. Yeah. Okay. Moving on.
Michael:STATAMIC 5 was released the week of 10th May, and the major release focuses on performance improvements, developer experience, and continued modernization of the code base. The announcement post for statomic, which we will link in the show notes, goes into greater detail about performance. But for large, complicated sites, you might see anywhere between 56 100% speed increases.
Jake:Dang.
Michael:Small sites might notice a more modest bump of 5 to 10%. But with Static 5, the control panel has multi site management where non technical and technical alike users can edit, add, and remove sites. When using the flat file stash driver, you can now see the equivalent of what SQL queries would be written or run with the flat file fake SQL queries panel, which you can now see approximated SQL queries in tools like Laravel debugbar, telescope, and ray, which is nice to see the kinds of things that you might have if you were not using SQL in your in your static application. Statamic 5 also supports Laravel 11, including integration of Laravel prompts in the command line and support for reverb with support for Laravel 11, Laravel 9, and PHP 8 support were dropped from version 5. We try that again.
Michael:With support for Laravel 11, Laravel 9 and PHP 8 support were dropped from version 5. So if you're still on older versions of Laravel and PHP, hold off unless you're ready to do the Laravel and PHP migrations as well. But there are a whole swag of other features and changes. Proof sites may use offline license validation. There is Laravel Reverb support as mentioned, and and more to cover.
Michael:So I won't go into that all because there is a lot, but we'll have links to the show notes for you as well. Stadamix is open source and free to use within the limits of the Solo license, and the Pro license is $275 US. More details about licensing and pricing can be found on statamic's pricing page. And for full details about statamic version 5, head head over to the official announcement blog post on statamic.com. Congratulations to Jack and the crew.
Jake:Nice job, dudes. Nice job. That's a lot of work going into those things. So nice to see that wrapped up and shipped out in version 5.
Michael:Especially performance unlike significant performance improvements. Performance improvements. Yeah. Right. To eke out.
Jake:You know? 600%. Yeah.
Michael:Yeah. We had, you know, blade a couple of weeks ago, found 20% performance improvements to go, you know, from 50 to 600% depending on the size of your site is pretty incredible. So
Jake:Yeah. That is
Michael:no no small feat there.
Jake:Absolutely. And there's a lot of other yeah. Like you said, there's a lot of other features at the bottom there that weren't that, you know, didn't even talk about. So definitely check out the, blog post for that. Okay.
Jake:We are going to talk about Laravel Octane. So Laravel Octane, basically supercharges the performance of your site for a set of routes that you want to specify. Right? So what it does essentially is it boots your application once, keeps it in memory, and then feeds it requests. So it's really, really fast.
Jake:And up to this point, we've had OpenSwool, Swool, and Roadrunner as drivers, but we now also have FrankenPHP. It's been in beta support for quite some time, but it is now out of the beta status for Octane, the Octane server option. So in there, the Octane 2.3.10. They've removed that beta tag, for the Franken PHP stuff. And you might be asking yourself, what is Franken PHP?
Jake:It's a PHP application server that's written in Golang. It supports modern features, like broadly compression and z standard compression and more. So this was, announced on May 13th. So Phrayon PHP released version 1 dot o, which we covered on the show here near the end of 2023 and around the same time. They're well, Octane integrated that beta support.
Jake:So it's exciting to see that fantastic server option available now in Octane. Thank you so much to, Kevin, Dunglass, and Nuno Maduro for making the Franken PHP Octane server a reality. Franken PHP is really interesting. It's one I've been watching for quite some time. I haven't actually, like, jumped on board yet with anything.
Jake:Some of the features that looked interesting were the ability to do I think it's, like, server sent events, but it's their own sort of, like, brand of it. It's not WebSocket. It's not server sent events. It's something else. I don't remember exactly what it's called, but that was the thing that was most interesting to me.
Jake:So might give it a try here in the near future. We'll see.
Michael:Yeah. It's easy to, spin it up. You know? And not most applications probably won't need that level of concurrency, but it does certainly provide for quicker response times and things like that. And we're looking at it as we move our infrastructure to to just, you know, use Octane because it will it it won't necessarily improve the performance of the application.
Michael:But by using something that consumes less resources, you can downscale the environments that you're running in, You know, smaller EC two instances to get the same throughput, the same performance, and things like that or or what whatever your deployment information is.
Jake:That's a good point. Yep.
Michael:Yeah. Check it out. Laracon AU 2024. We announced, back the beginning of May, on 8th May, that we were heading to Brisbane, Queensland at the QUT Gardens Theatre at the Queensland University of Technology's Gardens Point campus right in the heart of Brisbane CBD. We talked about all of the new things that we're doing this year.
Michael:We're doing catering, which we haven't done in years past. So excited to to be be able to keep everyone together to mingle and network. We're doing watering holes before and after the conference. We've got after dark. We've got official 2nd day networking events.
Michael:We've got accommodation and travel offers and all kinds of good stuff. Tickets are on sale. Blind bird tickets are on sale at the time of this recording. As of right now, there are 8 blindbird tickets left. So potentially, by the time you hear this, the blindbird tickets will be all gone, and we will have announced our first, 3 speakers for this year which I'm excited about.
Michael:So we've if you've got any guesses who it might be, check out the Laracon AU Twitter and send those through. They're being quick because you might we might have already shared by the time this comes out. So very excited to have Laracon AU back, again. You know, nice to not have a 4 year break between events and and, you know, get straight back into it. And, if you are in Australia or you wanted to come for a holiday to Australia, we will be excited to see you all there.
Jake:Absolutely. Well, hey, folks. Speaking of amazing things, we are happy to have Mailtrap sponsoring this episode. This episode is sponsored by Mailtrap, which is an email delivery platform that developers love. It's an email sending solution with industry best analytics, SMTP, and email API SDKs for major programming languages, as well as 247 human support.
Jake:You can try it for free at mailtrap.io. Thank you so much again. Mailtrap is a sponsor of the show. Absolutely. Hey.
Jake:We're gonna talk quickly about validation errors here. So if you were at Laracon Nashville this last year, we had the pleasure of having one of Michael's Aussie buddies, mister Tim McDonald, who is also on the Laravel core team, talk about Laravel precognition, which is this incredible tool to provide really great user experiences, for people on your website, that are going to be dealing with validation errors. And so one of the things that Tim brought up is that a lot of times we completely ignore this user experience of validation errors. In fact, most of the time, what our applications do is they just swallow those errors and you never see them. Right?
Jake:Doesn't doesn't ever make it to your air tracking service because you'd get a lot of them. And we kind of figured to ourselves, like, hey. You know what? That's kind of the user's problem. I've programmed it.
Jake:Like, it's fine. It's gonna work. It's not a big deal. But Tim was like, really, there's a lot of work that we could do to make these so much better. And so Laravel precognition does assist with that.
Jake:But in addition to having Laravel Precognition, one of the things he encouraged us to do was to take a look at what validation errors users are running into a lot. And so he's also created now a validation error card for Laravelpulse that will show you useful metrics for validation errors that are impacting users. So what you, what you could do with this pulse card is it will show how your users are experiencing and interacting with these validation errors. Like for example, you can show the number of times that someone has received the password field must be at least 8 characters. It'll count it up for you, tell you what controller it was hitting and how many times it happened.
Jake:Right? So it summarizes that information for you so you can really target, like, what might be going on here? Was it not clear in my instructions that it needs to be at least 8 characters? Do I need to do I need to clarify this in some help or text? What should I do here?
Jake:Or the fact that the title confirmation does not match the episode title. Again, you know, 626 times this happened. Is that something that we need to take care of? Is it not clear that this has happened? You know, maybe I get some, maybe get some browse not browser tracking, but, like, session recording.
Jake:Right? And kinda watch what's going on there. What see what what happens. This happened 626 times in the last 6 hours. Like, how is that happening?
Jake:Right? So it includes the following main features. With the initial release, it supports supports multiple error bags, session based validation errors. It supports API validation errors, inertia validation errors, and it has fallback for undetectable validation errors that are based on the 4 22 response status code, which is what you'll get, I'm sorry, what you'll send to users in the case that you have a validation error. They get a 422.
Jake:So if you get started with the package, you can install it via composer. It's under tim mcdonald /pulsevalidationerrors. Then you can configure it as a recorder in your pulse PHP config and then add that card to your pulse dashboard. All really simple. All written up in the source code there.
Jake:And, if you've not started with Pulse, you can get started really easily. It's right in the Laravel documentation. We've got it installed in a couple of places, and I gotta tell you it's done a great job of pointing out these slow queries or things that people seem to be hitting a lot, errors that seem people seem to be hitting hitting a lot. And, it's it's really helpful. It does a great job of aggregating this data.
Jake:Right? It's not like a one off. It's not telescope. Right? It's not saying, like, here's this specific request.
Jake:It's saying, give me an aggregate set of information about a number of requests and give me actionable insights into my application. And so Laravel Pulse is awesome. Awesome. I've really liked it. So this is another, great add on that you can use for free with Laravel Pulse.
Jake:Thanks so much, Tim, for, creating that and Paul for writing that one up.
Michael:Nice one. Dash UI is a Laravel blade component library that is inspired by Shopify Polaris, which is the design system used for the Shopify admin. So this is a component library for Blade and it was created using Tailwind CSS, Laravel blade components, and Alpine JS and is designed for ease of integration and customization. The Ikit includes a comprehensive set of UI elements that allow you to quickly start building your app and customizing it with blade components and consists of button and button groups, avatars, thumbnails, badge, cards, empty states, form input UI elements, feedback banners, alert boxes, inline areas, flash messages, circle loaders, popover menus, tooltips, modals, copy to clipboard functionality, navigation. And if that wasn't enough, there's even more.
Michael:All components in Dash UI are customizable by passing classes or by using inline styles. You can get started with the package by checking out the project documentation and also the live demo of an Laravel application if you'd like to see the app the components in use. I I have links to all of that in the show notes.
Jake:Very good. Okay. This last package that we have here is a really useful one, and it is called Mingle. Js. So in, I think it was Livewire 2 and Vue 2.
Jake:Caleb had published this little package that was sort of unknown, but it was allowing you to use Vue inside of a Live Livewire application. And so it worked it worked great. It worked fine. Basically, what it did is with Vue? Yeah yeah yeah.
Jake:It was Vue. View in Livewire. Yeah. That's right. And so, you could do that, and it was great.
Jake:However, when we upgraded to Livewire 3, this was no longer possible. There was no Caleb did not ship an additional one of these little things that would, make sure that view and Livewire could play together nicely. And after asking him, it didn't really seem like he had an appetite to do that, which I totally understand because why would you want to do that? And so Mingle. Js is coming to the rescue here.
Jake:Mingle. Js is a helper for using Vue and React components in a LiveWire or Filament application. So it was created by Joao Patricio, and it's useful for it it's saying landing pages and complex components where we want to use Vue or React, but it's really useful for anybody who can is coming also from a LiveWire system and wants to implement Vue or React or is coming from Vue or React and wanting to implement LiveWire. Right? It kind of goes both ways.
Jake:So, the the mingle. Js works by rendering a div on the server side and then mounting a component on the client side. So the server side Livewire component renders each JS component, so you get JavaScript interactivity on the front end, and it's isolated to that Livewire component. So additionally, the back end can also pass that data to the component on the front end, which is kind of nice. So, this is always one of those things where you would have to in your view, if you wanted to talk to the back end, you'd end up having to make an API, and then you'd have to talk to the back end.
Jake:Right? So that you'd have to request that from the view. You don't really have to do that. You can say LiveWire is going to provide the data, and it could pass it through as a prop to the front end component in Vue, which is really nice. So it goes through some of the documentation here and as well as how you would set it up.
Jake:Mingle includes a LiveWire component that uses this interacts with mingles trait as well as a couple of things. I'm not gonna go through this, exact implementation because it's a little bit code heavy. We've said enough to know whether or not it's something that'd be interesting to you. We consequently ended up ripping out all of our view stuff and just going straight Livewire. We just use this as the motivation to say we're gonna get rid of you and just go strictly Livewire for a particular section of the site.
Jake:And so that works fine, and it and it's worked great. But, it is nice to have the option to do view in the case that I you know, in the case that I don't feel like entangling, like, 5 different variables with the Livewire thing and having that real, you know, front end to back end Yeah.
Michael:Yeah.
Jake:You know, interactivity. So, anyway, this is it seems like a really nice option, and, so you should definitely check that one out. Thanks, Paul Redmond, for writing that one up. And folks, that brings us to the end of the show. Thanks so much for listening.
Jake:Podcast.larabaldashnews.com/2 215 is where you can find shownotes for this episode. If you liked us, rate us up in your podcast show of choice. 5 stars would be amazing. And if you want to talk to us, hit us up on Twitter atmichaelderinda@jacobennettoratlaravelnews. Folks, go buy some of those awesome, Lyricon AU tickets.
Jake:We would love to see you there. At least Michael would. If I, by some miracle, get to make it, that'd be incredible too. But you should definitely go hang out with Michael and all the Aussie crew out there. We'd love to see you.
Jake:Michael, any final words?
Michael:Looking forward to a big and exciting Alaric on AU.
Jake:It's gonna be awesome. It's gonna be awesome. Alright, folks. Until next time. We'll see you.
Michael:Bye.