Laracon US recap, keynote highlights, and linen
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:Hello. Hello, all the peoples. It is episode 222 of the Laravel News podcast. Michael Dyrynda, my friend, we really missed you at Laracon this year.
Jake:I am so sorry you were not able to attend, but you were there in spirit even though I didn't bring a flat packed head of yours to the conference. You were there in Disappointed. And so
Michael:Disappointed that that that didn't happen.
Jake:There were so many people, though, who came up and said, hey. We listened to the show. And I took pictures of them with me, and I was going to send them to you, and I still need to do that. So so anyway, I will send along their love to you, and, I tried to do my best Australian accent. Good day, mate.
Jake:I don't know.
Michael:I did. I had a few messages from different people, through through the course of last week. And I saw there were a few, talks and things like that where I saw my name pop up or I saw Yes. A photo, which is, like I think it was you. Someone messaged me, and I'm like, oh, it was nice of Taylor to to pop me into to his, talk there.
Jake:So That's right. Yeah. So I it was, yep. Correct. I think it was Laravel Cloud.
Jake:He was showing something, or maybe it wasn't Laravel Cloud. I think it was actually the Inertia demo. It was the Inertia demo.
Michael:I think. Yeah.
Jake:The Inertia demo. Yep. Yep. And so I was like, oh, there's Dorinda. So I grabbed a picture.
Jake:I was like, Michael, you made it. You're here. You're here with us.
Michael:Yeah.
Jake:You're in Spirit. Yep. Yep. And you had yeah. I mean, I think you had I don't think the only the only shout out I got from stage is when they said, hey.
Jake:Will you run these prizes to people because you're already on the front row? It's like,
Michael:yeah. Sure. Yeah. I saw that. Jake, you've been my forerunner.
Jake:Absolutely. No problem. No problem. Yeah. So that's that's good though, dude.
Jake:I'm I was I was glad to, hear that your name got mentioned at least. For all the hard work that you put in the community in making it awesome, I'm glad that Yeah. You were at least here in in name, if not in in the flesh. So
Michael:Yeah. Hopefully hopefully next year, I've been planting the seed. I said to Reeve.
Jake:Yes.
Michael:I've I've gotta go. It's been a while. You told me 5 years. It's been 6. It will be 7 by the time I get back there.
Michael:So
Jake:And and hopefully, dude, next year, we'll have another basketball game, and you can show us all those skills that you've been working on That's right. For the last decade. You know?
Michael:I can yeah. I can grind out what's left of my cartilage in a in a friendly basketball game.
Jake:Oh my gosh. Yes. Yeah. Officially, you know, there was, like, 2 knee braces 2 knee braces and a cane. Like,
Michael:hilarious. I've been I've been working through it. I feel I feel good, but yeah. It's the it's just that lateral movement's no good for for these old knees anymore, unfortunately. But I'm running.
Michael:I'm back in the gym. I'm, like, doing all the work. So it's good.
Jake:It's a good deal.
Michael:It's just the the sport itself. It's it's no good. But, I'm I'm sure if the opportunity arose, I would, I would love to stand on the court for a couple of minutes.
Jake:For sure. For sure. And, dude, honestly, I feel like that was probably the life like, one of the biggest highlights of the conference for me. It was so fun.
Michael:Like, we even stayed around full of highlights. It's incredible.
Jake:No. Literally. I mean, it was just literally the best way ever to kick off a conference. It was so cool to get to you know, like, I feel like typically, like, the day before the conference, everybody's sort of, like, trying to catch up on some Telegram chat and figure out who's going to dinner where and, like, who you know what I mean? And so Yeah.
Jake:It was like it's just difficult. And so with this, it was like everybody met there. It was at 2 o'clock, so a lot of people met there, and then they just kind of broke off from there, which was really cool. And it was good just to, like, get some good exercise, like, hang out with other people, and, like, of course, you know, basketball is not for everybody. That's fine.
Jake:But we hung out for probably another hour and a half and, like, just, like, played some pickup ball with a couple couple developers there, a couple of guys, I met some good dudes. So, yeah, it was it was really fun. So me me and Hemp got to play for a little bit. Both both got a a shot in at least a shot during the game, so that was fun. Contributed our tiny little piece and then, you know, got to go home with the jersey, which was pretty sweet.
Jake:So that was fun.
Michael:That's pretty good. Very cool. Yeah. We, I didn't realize this, until someone from Brisbane pointed it out. There there is actually outdoor basketball courts at at the, because the theater that we're at this year for Laracon AU is on the grounds of a university.
Michael:So there is actually, like, basketball courts available there. So I'm sure You should do it. Simon Simon out there putting out this Oh
Jake:my gosh. He's just shaking it. Yep. Well, did you see that video of his kid the other day? He brought him a, like, a light up basketball.
Jake:A light
Michael:up a light up light up. Yeah.
Jake:That's pretty cool, actually. I need
Michael:to get one of those.
Jake:I need to find out I need to find out, where he gets one of where where you get those, because that would be super fun. We'd play with that all the time. Oh, anyway, folks, should we move on?
Michael:On the other side there. Literally on the other side of, the the the venue we're at this year has got some bars
Jake:You should do it. Should organize it. That'd be super fun. That'd be fun.
Michael:Let's see. We'll see. Let's do it. Let's move on with this, because we So we don't have lots of stuff in in terms of numbers, but there's lots of content in terms of things to cover. So
Jake:Let's jump in. September 3rd. Yeah. 2024 sponsored by Sentry today. Thanks so much, Sentry, for sponsoring the show.
Jake:Michael, I'll let you take it from here. Releases, dude. Go for it.
Michael:Asset prefetching strategies with Vit in Laravel 11.21. Tim McDonald contributed the ability to prefetch assets generated by Vite eagerly. From the PR description, this PR adds the ability for applications to eagerly prefetch JavaScript and CSS chunks generated by Vite. The goal is to reduce the network delay and costs involved when navigating through an SPA front end. Applications built with Vite will often use code splitting.
Michael:This technique splits the JavaScript and CSS into smaller chunks and when you load any given page, only the chunks required to render that page are loaded which leads to faster load times for applications. For example, when you land on a home page and you do not then you do not pay the cost of downloading and parsing the admin dashboard's JavaScript. So to configure prefetching, you can add one of the following methods to the boot method of a service provider. There is Vite use waterfall prefetching, use aggressive prefetching, or you can use a pre use prefetch strategy option as well. And you can configure these things to do whatever you think would be most suitable for your application context.
Michael:So thanks to Tim. Next up, Jess Archer made updates to the expect choice a search method assertion method when passing an associative array. So this is to make that method in your, choice or expects choice assertion in your test more intuitive. So when you use expect choice, you would need to write, you know, choose an option as your you know, to see that this option comes up. And you say, I choose 1 from the options available, where you would have to say 123123 in uppercase and lowercase, representing how that would come through in your, application.
Michael:So instead of having to do that as a list of 6 different values 1, 2, 3 with lowercase first letters and 1, 2, 3 with uppercase first letters, you can now pass it as an associative array of lowercase 1 mapping to uppercase 1. If you're watching this on YouTube, you will have seen that somewhere, and it'll make sense. If you need more clarity, we'll have links to that in the show notes, of course.
Jake:And just to be just to be clear too, this is for prompts. Right? So this is This is for prompts. This is what right. Right.
Jake:So Jess Archer is the one who
Michael:artisan mhmm. Artisan commands.
Jake:Yep. Yep. Yep. Yep.
Michael:Okay. Jason McQuery, JMac contributed a Force Destroy convenience method to remove a record while using the soft deletes traits. So previously you had to find a record and then call Force Delete on it. Instead of doing that now you can say comment colon colon force destroy whatever your model is colon colon force destroy and then pass it either a single ID value or an array of ID values and the force destroy method will return an integer value which is a count of the records that were destroyed. So if you're using soft deletes, calling delete on that record would cause it to set the deleted at timestamp to now and if you had a record loaded you can then call force, I think, force delete and that would then actually delete the record from the database.
Michael:So you'd have to call 2 queries, 1 to fetch the record, 1 to then delete it, whereas force destroy would just do the delete operation in one go. So thank you to Jmac for that one. Boris Zmuda contributed a between method to the assertable JSON class which asserts that items are either greater than or equal to the minimum or less than or equal to the maximum value. So this you can do, in your response assertion response assert JSON and pass it a closure that accepts the assertable JSON object as an argument and then returns JSON arrow count between. And then you can say, you know, make sure that there is between 10 30 records in that response.
Michael:If if you've used this assertable JSON stuff, you may have been caught out by doing, like, a partial assertion on the response payload where you you only want to look at 2 or 3 different values to make sure that they pass. And then if you don't do a full assertion for every single property, you'll end up with failing test. This arrow etc method basically goes, I don't care about the rest of the stuff. I only want to look at this specific set of properties. So if you've ever been caught up by that, use the ETC method, the etcetera method to just say, you know, everything else is fine.
Michael:I don't care about
Jake:it. Mhmm. Mhmm.
Michael:2 more items here. First up, Inar Hansen contributed a resource method for the HTTP client's response class, which allows you to directly obtain a PHP stream resource from the resource body. So if you are if you are writing streams to S3 and you wanted to get something back from that, previously you'd have to say write stream and then return streamwrapper:getresource to get the response back. This is some syntactic sugar to basically say, instead of doing all of that you can do storage:disk, s3 and then arrow right stream and it will allow you to do that and then get the response resource back as a streamed resource. So if you've ever needed to do that or want more details, we'll have a link to that for you in the show notes.
Michael:And last up, Millward Kasrabi contributed a without headers method to skip headers during a test request. It was already possible to remove headers individually and this update allows removing an array of headers in one call. So before you'd have to say this without header name, without header Foo. Now you can just say this without headers and pass it an array of name comma, foo. So we will have links to all of that in the show notes.
Michael:Lots of contributors in there, lots of additions. And as always, I think we mentioned this last episode, we talk about a handful of highlights in these posts. If you check out the show notes, you will see that there was literally dozens of, changes, fixes, additions made to the framework. So check that out if you want to see the full suite from many, many different contributors.
Jake:Indeed. Yeah. That stream response thing is pretty cool there. And this is You've
Michael:got, like, giant things that you wanna get Yeah. An idea with rather than trying to download the whole thing, load it into memory. Memory. You know, potentially a large a large thing all in memory. You can you can process it as it's coming back.
Jake:Yep. That's super nice. Really, really handy. I wonder if you've even known how to do that before with that 2 PSR response get body thing. Like, I mean and having a stream wrapper and all that, it's just nice that you can just do that straight from the HTTP class now.
Jake:Really cool response response resource. Really nice. Well, hey, folks. We've got 3 others that are sort of all related, so we are going to attempt to roll them into 1 as we both kind of give a commentary here. So, obviously, we had Laracon last week, and there is a couple of items on here further down.
Jake:We talk about a couple things. I don't think we talk about flux on here, which is a big release. We do have PES 3, but what we're gonna talk about first, because why not, is we're gonna talk about all of the things from Taylor's keynote. So let's talk about the keynote. So, here's what was here's what was said, by Taylor, and I feel like everybody kind of felt like something big was coming.
Jake:He had said, like, hey. We've been working really hard. Right? In in fact, to quote him, he said it's been a very busy year for us at Laravel, Probably marked the biggest shift in the company's history. And at the very beginning of this year, Laravel as a company, was me and 9 other people, and now we're a team of over 30 full time employees.
Jake:So why did we hire so many people? The reason is because we've been tackling some of the ambitious and exciting projects we've ever worked on as a company. And so if you haven't watched the keynote, you should definitely do that, but let's talk through some of, like, the key takeaways from the keynote. So, just as like a preface, I've I really do feel like what what Taylor's vision is for this and the team's vision for this is they want to encourage as wide of adoption as possible of Laravel. And the way that they're doing that is by expanding the top of the funnel.
Jake:And what I mean by that is they're wanting to make Laravel the most approachable and the easiest to deploy framework to get started with for new people. Right? There's a couple of ways that they're doing that, and it's really kind of been in the works for the last few years, I think. One of the things that's actually huge is HEARD. Now we didn't hear a whole lot about HEARD this time around.
Jake:However, the fact that Marcel and Beyond Code team has been able to make a development environment, literally a one click install for both Mac and, critically, Windows is huge. It can't be overemphasized because there's a lot of people coming out of college, university, who probably have a Windows machine. They don't have a Mac. They either can't afford 1 or it wasn't in their, you know, CS classes. They didn't need them.
Jake:And so you've got this whole, you know, swath of developers that have Windows machines. And if the development environment that everybody's setting up is Mac, that really limits the ability of people on Windows to get started. So the fact that Heard is now shipping for Windows and, is free, you know, not the pro version, but it is free, is insane. So that's 1 numb that's number 1 that's knocked out of the way. Development environment is set up for you.
Jake:Number 2, which was released this year, at Laracon is the official Versus Code extension. The Laravel Versus Code extension. So the easiest way I can describe this is to think of, like, Laravel idea for Versus code. The reason why this is critical is because Versus code is one of the most popular editors that people use. It's it's, you know, created by GitHub slash Microsoft, whatever.
Jake:So again, the Windows play there, it's really seamless as, you know, to integrate with a Windows environment or a Mac environment. Tons of people use it. And so having this extension for free, which handles auto completion, across app, route, config, e n v, translations, and all sorts of stuff like clickable you know, clicking through, hover quick fixes, diagnostics, test explorer integration for Versus code, and it integrates with it, natively now. Joe Tannenbaum and the team just did an incredible job. I was a little bit nervous at first.
Jake:The demo started to go sort of sideways. The hover wasn't working. Yeah. And so eventually, it did come back together. But this is another thing that's just like, okay.
Jake:We wanna make it really easy people to have something for free that they can get started for, for no cost. And then, there was, of course, a bunch of open source features for Laravel framework. I'm gonna I'm gonna pause on those for a second, and then I'm gonna I'm gonna jump to the big announcement, which of course is Laravel Cloud. And I just kind of want to complete this thought here because the idea is that Laravel Cloud is a $0 monthly cost to use. It doesn't cost you anything to sign up and start using it.
Jake:And then even at that, once you do start using it, you're able to hibernate your projects. Any projects you've spun up, you're able to hibernate them after a set amount of time that you decide. And all you pay for is, you know, you don't pay for compute when it's hibernated, of course. You pay for storage, which if it's a little side project, you're just spinning up and just trying it. No big deal.
Jake:And then you play pay for bandwidth, which again is probably gonna be nominal. So it literally doesn't make sense for anybody to I mean, I can't say it doesn't make sense. All I'm saying is it feels like all the barriers to entry for anybody to get started with Laravel have been bulldozed. Like, there is really no excuse why anybody could come up what that anybody could come up with for why they couldn't start using Laravel tomorrow. Right?
Jake:It's all just laid out there for you. And so I think that, you know, that's the strategy. They're really wanting to expand the footprint and make it super easy for anybody to get started, and I feel like they accomplished that, like, in spades. They did an awesome job presenting that vision and then knocking it out of the park. They did an awesome job.
Jake:So, yeah, I'd I'll I'll open that for your comment, Michael, and then, you know, I'll, I'll have some other things to say too, but go ahead.
Michael:Yeah. There there's definitely, like, over the last 12 months or so, there has been a a a definite, like, concerted effort from Laravel to to start making the onboarding story simpler. And and not just, like, making things free, but meeting developers from outside of the Laravel ecosystem where they already are. You know, not just Mac or Windows, but it's like making PHP easy to start using it on the environment you've already got. Because before, you'd have to you know, we've had Valet for a long time, and there's Laragon and things like that on on Windows.
Michael:But to have one piece of software in Herd that you can install on Mac or on Windows and and you're ready to go, that it can scaffold out your application and you're ready to go. Things like, Livewire, Vault, and Folio, which gives, you know, JavaScript developers coming into the ecosystem, you know, maybe for the first time or reentering from, you know, doing PHP 10 years ago, going seeing something like that and understanding what that is because it looks very similar to what they might have been doing in things like React, for example. And then Versus Code being such a popular editor you know, it's popular for for PHP and for Laravel, and you've got to kind of rummage around to find the right extensions to install and making sure you install, you know, the correct version of it. There's IntelliFence and there's IntelliSense, and, you know, if you install the wrong one, things don't quite work the way that you want. So so bringing this first party tooling to, 1, a free editor, but one that a lot of developers, especially, you know, the JavaScript people coming in that have been using it probably because it's it's the most well regarded and best supported editor for building JavaScript and TypeScript applications, going, okay.
Michael:I just installed this Laravel plug in, and I can keep going with all of the key bindings and all of the stuff that I've already got set up. You know, it's gonna make it much easier to onboard them. And now completing that story is is deployment. And as Taylor pointed out in his keynote, you know, this has always been the goal for Laravel, is developer happiness from, you know, when you first create application until when you deploy it into production. Having this environment now where you can just spin up a Laravel app and be ready to go and just git push and it would deploy and and have your app up, you know, in seconds.
Michael:Really like, who who would have thought 10 years ago that this was the kind of stuff that we would even have possible with PHP? You know, to be able to just install Herd on your, you know, whatever device you already have, to use Versus Code, which you're more than likely already using, to then just deploy it to this, you know, cents on the dollar service to host your application is, is incredible. So shout out to the team, you know, not only from the growth, but, like, the the stuff that they've been able to turn out. You know, a team of a handful of people working for 6 months have got this Laravel cloud platform to where it is now. So, yeah, shout out to them, and and I'm I'm excited.
Michael:There's been some discussion as well, since Laracon, a bit of, you know, muttering before Laracon about how we make, I guess, Laracon popular outside of our little bubble, how to how to onboard new developers, how to, you know, the those advisers and and things like that that say, you know, don't use PHP because it's rubbish because all they know of PHP is 10 years old. Like, you know, now that now that all of this stuff has shifted, like, this is the next piece is actually making PHP look cool in the same way that JavaScript and TypeScript have been made to look cool for the last few years as well. So still lots of work to do, but there's an incredible amount of stuff that's that's been, you know, moved out of the way already.
Jake:Yeah. Yep. And then so sort of last note I'll make on this is that it did there was this feeling of this being a big pivot point in the story of the Laravel community and of, like, the Laravel world being like, this is gonna go create it's it's you know, I think next year, we're gonna come back, and it might be a whole new crowd almost. You know what I mean? Maybe not even maybe not in 1 year, maybe in a couple years, but there was definitely that sense of, like, this is going to be different next year because the number of people that are gonna be there is going to be a lot I I think a lot more.
Jake:Even when Taylor pulled the audience and said, how many of you maybe it wasn't Taylor. I don't remember who it was. They said, how many of you are you know, this is their first your first time here. It was it looked like it was just under, like, half half of the audience there.
Michael:Yeah.
Jake:Was people who've never been there before. Now it doesn't mean that they're brand new. It could be that they've been in the Laravel community for a while and just have wanted to come to Laravel, but haven't been able to. But it's to me, it's one of those things. It's like, dang.
Jake:I gotta put, like, a, a watcher on when those tickets go on sale because I can imagine things getting sold out and, like, not being able to grab a ticket if you're not not watching carefully. And so it'll be really interesting to think see how things pivot, you know, as we as it becomes more widespread. And then the the last thing that I will say that was really refreshing as well is not only the technical aspects of, like, hey. We're really making this, approachable for new developers, but the community aspect of Laravel was highlighted really well, too, like, at the conference. And so Primagen was there.
Jake:He said, this is like a really special community, really special conference. Like, I've never been to a conference that felt like this. I'm gonna get her wrong her name wrong. Can you do you remember her name? Capahe.
Jake:Capehe. Thank you. I was gonna say, Capehe. Capehe. Yeah.
Jake:She did a great job just talking about finding her village, finding your village, and, and just incredible, incredible job. And so it was super cool to see her story and how she's grown alongside of Laravel and kind of where she was at as Laravel was growing. And now she's, in the fold. She's one of the people, right, on the stage and presenting. And so, man, I could not be more excited for what the future looks like.
Jake:And, man, if anybody had any doubt, it's, like, it's a great time to jump in. You know what I mean? Like, I feel like we've got, you know, Caleb talked about that idea of, like, this effect. I can't remember what it is, but, like, however many years something's been in existence, it has at least that many years before it dies sort of deal. And, you know, we're over a decade now.
Jake:Right? So, like, for me, man, it looks like the future 10 years even, you know, more is is a bright future. You know? There's a lot of really cool stuff on the horizon. So, anyway, that's that's for me where it's just like you know, we hit a couple things there.
Jake:The cloud stuff, of course, you can look more into. But, I mean, really, it's from 0 to deployment in under a minute. From sign up to deployment in under a minute is the idea there. Right? It's approachable and really easy to get set up for new developers, but it also has a feature set that scales out to large production applications with things like vertical and horizontal scaling as well as being able to set up queue workers and your daemons and all that stuff straight from the dashboard.
Jake:Really, really slick stuff, and, it's awesome. So definitely should check more of that out. However, we should probably talk also about some of the items that were new in the framework as well. So I feel like I've been talking a lot. I am on the keynote takeaways from, Taylor's keynote.
Jake:You want do you wanna if you wanna jump in on any of those, feel free, and then you grab a couple. I'll grab a couple. Sound good?
Michael:Yeah. I was gonna say we could we probably run through them fairly high level because we are running along. And
Jake:Okay.
Michael:But just just to hit hit the high notes. I think this this stuff I I messaged Tim when I saw this happen because I I managed to catch it live. And I said to Tim, you are a very, very clever cookie. Like, this this, defers stuff and the concurrency stuff that he's done, you know, the ability to just do all of these things. Like, all of this stuff that just wasn't possible, really, before where you can just say defer, and the framework will figure out how to shove this onto another process that just happens behind the scenes without having to spin up queue workers or anything like that, and and it all just happening, you know, behind the scenes is incredible.
Michael:Moving all of this attribute stuff in into the framework, Symphony, as I understand, has had it for for some time. But being able to kind of annotate things in your constructors and have the framework then inject config keys that you can find without having to go and do all these, you know, container bindings of things manually, being able to inject the current user, and being able to inject specific database. All of this kind of stuff just especially with modern PHP, I think is really cool. And as I said, I I I know the symphony's had it for for some time, but it's cool to see that, you know, we're embracing this kind of stuff as well. And, you know, me, I've I I prepared the the attributes for for a long time, but things like this just just make it, like, much easier to to reason about.
Michael:And I think the other thing aside from all of the changes that are coming to Inertia version 2, you know, everyone thought it was dead in the water, and they've put a
Jake:ton of
Michael:work into all of this stuff that's been missing async requests and polling. And when visible and infinite scrolling and prefetching, like, all of that kind of stuff is is incredible. But this other thing, this chaperone method, I one of one of Australia's very own, Samuel Levy, put the work in to to get this to, you know, solve a bug that he'd encountered. And I Taylor is unrivaled when it comes to naming things. Like, to call this thing chaperone, like because when when Sam put this together and I and I believe this still exists as an alias for the chaperone method.
Michael:He he called it inverse because, you know, most people, you, me, like us normal Laravel people, normal developers, go, what does this do? It is the inverse. So we just call it inverse. But Taylor's like, no. That's that's not.
Michael:It's not. It's not not good enough.
Jake:And so
Michael:I'm gonna call it chaperone. Like, to be able to to say, you know, to to bring these models in without having to, you know, run into these inadvertent n plus one queries is is really cool. So, yeah, heaps of stuff. Taylor's keynote ran for, I think, about an hour and a half. So
Jake:Yeah. If you haven't if you haven't go and
Michael:watch it. It's it's the longest keynote he's ever given. It it was, like, incredibly well produced. You know, it was it was it was, like, apple level nonsense, to be to be perfectly honest. And, you know, it was it was just good to see.
Michael:Like, the production I I don't I'm we're just casual, Eric, on a year. I don't think we need to bowl. They're trying to compete.
Jake:No. It's not competition. Right? Like, that's not a good ball. Right?
Jake:It's it's just about getting the community together. And, honestly, I mean, that's that's what everybody said. Like, the keynote was great. It was great to be here, but, like, it's just the people. And so, yeah, no.
Jake:I I'm with you. No need to compete. The, the defer method, though, I just want to touch on that real quick. So basically, to me, what that feels like is, you know, if you have some expensive operation, you can defer it, and it's just going to push it to a like you said, like, it's not a queue worker, but it is to a background thread. Right?
Jake:And so you get the ability to be able to do some work and then return, like, a view immediately to your user while the background task goes and takes care of itself. Right? And I'm thinking that is happening on, like, the destruct method of, like, a class or something like that. Like, it's actually calling that at the time of the class getting destructed, like, the application getting torn down, then it's kind of running that, like, before it does that, possibly. Not exactly sure.
Jake:One of the cool things that also enables those is this item called cache flexible. So this is really interesting. If you've ever tried to cache something for a certain period of time, let's say you cache something for 10 seconds, whoever's the first person to hit it after that 10 second expiration has to incur the expense of cashing the item for the first time. You you know what I'm talking about? So, like, somebody has to be the scapegoat for that thing.
Jake:They have to they have to endure the penalty. They then cash it, and then the next people who hit it for the next 10 seconds don't incur that penalty. This cash flexible solves that problem by essentially using this defer that we just talked about to go and cash it in the background, while the cash is still active. So there's 2 values that you pass to cut pass to cash flexible. The first one is how long should we wait before we should try and refresh the cash?
Jake:And the second one is how long is too long that it should be considered, like, stale, and you shouldn't present the old you know, shouldn't present the old one anymore. So, like, let's say it's 5 and 10. 5 seconds for the first one, 10 seconds for the second argument. What it's gonna do is it's going to cache the value. It's going to present it for 5 seconds, and if it's between 5 and 10 second mark, what it's going to do let's say somebody visits at 7 seconds.
Jake:It's going to give them the cache, but it's going to kick off a new cache refresh thing in the background so that by the time somebody hits it at the 10 second mark, it's already got the new version. And so this was the pattern called oh, boy. Oh, man. I actually wrote
Michael:it down. While revalidate.
Jake:Still while revalidate. You got it. Still while revalidate. So cool. So cool.
Jake:And the funny thing is I've built this before by myself, but I can replace it now. I had my own little cash helper that did this for me, but cash flexible is a much better way to do it. So, definitely check that one out. Like we said, we are running a little bit long, so let's speed up just a touch here, talk about Pest 3 and Pinkery. So, Nunu Maduro, good stuff with Pest 3.
Jake:Anything that you saw in there, Michael, that you thought was interesting?
Michael:I didn't actually catch it. I started watching his keynote this morning. I think this tying stuff to issues is really cool. I know that he'd been like, Nuno mentioned mutation testing was coming in v 3 when he was here, for Laracon AU last year. And so it's cool to see that that that's come out.
Michael:I haven't got to that part of of his presentation yet.
Jake:Of course.
Michael:I'm looking forward to Yeah.
Jake:Let me checking
Michael:that stuff out as well.
Jake:Let me do a quick wrap on it. So then, basically, task management. This is really interesting for us specifically because we're doing a greenfield project right now. There are some things that we actually don't know on, like, the left hand side of the equation. So as far as, like, these APIs that we're gonna be consuming, we don't know exactly what that looks like.
Jake:And so what we're doing as we complete our side, like, the UI, once we know that we have these things represented as models in our application, here's how we'd like to display them and modify them and the actions we'd like to take on them. However, we need to write tests for those eventually. So what we're doing is we're marking we're creating tests and writing them as to do's. Mhmm. But now what you can do with PES 3 is you can say assign to, and then you could put, like, a GitHub username in there, and then you could do issue and then number and issue.
Jake:And so for us, we're currently building these these things out. Every single one of these items that we have has an issue attached to it as well as a user assigned to it. And so what we can do is we say before we ship this thing to production, we can say, pass, give me the to do's, and it will show me listed out. Here are the to do's that are left. Here's who they're assigned to, and if you're interested in knowing what issue that you should look at when you're looking for the context that you need in order to be able to write this test effectively, Here it is issue 11, and you can click through to it.
Jake:It's incredible. It's really, really amazing. And so, really cool on that. One of the other things 2 of the other things, architecture presets. So if you've ever used architecture tests, you know how useful they are.
Jake:They're they're insanely useful, and it really enforces consistency in your code base and make sure you don't leave things like DDs around or make sure that if you have, like, a particular folder that you should always implement this contract, you can do that in there. One of the things that I felt was missing though is like presets. I just want a Laravel preset. Just give me a set of rules that should apply to my architecture if I'm using Laravel.
Michael:Mhmm.
Jake:And so now we have that. And then there's something like strict and relaxed as well. So you could say strict, and that says make sure you have final classes or, you know, final on all of your classes and etcetera, etcetera. And relaxed says you should never have final classes. And so the thing he advocated for was to basically say, I don't care which one you do.
Jake:Just be consistent. Right? If you're gonna do it if you're gonna be strict, be strict. If you're gonna be relaxed, be relaxed. Don't don't go back and forth between the 2 of them.
Jake:And so, you can tag that on as well. And then, yes, mutation testing, which basically, takes and makes sure that the code the tests that you are writing are actually testing the code that you're that you're writing it against. Right? So it says, like, if I'm go modify this test and nothing changes or as I think it's not the test, it's actually if I go modify your code and nothing changes in your test, your test still passes, you're not actually testing that thing. Nothing actually tested that.
Jake:And so the mutation testing is is really, really cool. So nicely done on that. And then last thing is the Pinkery is open source. So Pinkery was on full display. Lots of people were using Pinkery to kind of share social links and things like that.
Jake:It's now fully open source, and so you can find us on it at Laravel News, which is really cool, but this is built with the tall stack. It's a really exam a really good example of a full Laravel application that you can learn from and take a look at and contribute to. So you can find that. It's using PES 3 as well. You can find installation instructions and contribute to that at pinkerydashproject/pinkery.com.
Jake:Very, very cool. Okay. Onto you.
Michael:Yes. We the we've got 2 episodes that have dropped. So for those of you unaware, Eric Barnes, our fearless leader, has been going through and doing this, Laravel creator series where he talks to package creators in the community about the packages that they're building. And, you know, it's a bit about the packages and a bit about, the the creators themselves. There have been 2 episodes out since we last recorded this, episode number 5 with Patricio, who talks about mingwid.
Michael:Js and PHP WASM, playing playing with Laravel, saving code, and sharing it with others, and Voxpop sites, which I believe he's working on with, Shruti. So check that one out. And also Andrew Schmelian talking about publishing video courses, virtual and physical worlds, and LLMs. So check those out. You can subscribe to the creator series on our YouTube channel.
Jake:Awesome. Well, hey, folks. If you did not happen to take the last developer survey that was out, you might be interested in another one. So the team at Adiva is doing another Laravel developer survey. The other one might have been, like, for PHP sort of at large, but this one is the Laravel developer survey, and it's designed really to map out the entire Laravel ecosystem so we can get insight into everything, Laravel.
Jake:So talks about tech stack, tool choices, framework usage across different industries. And really if you have the time, it is helpful. It really is. It's like a resource for anything involved with the Laravel ecosystem, you know, decision makers, developers, and it really helps to create a clearer picture of the current state of Laravel, all the people who are using it, and then gives us data that we can use to make decisions, about how we can strengthen the ecosystem in the community. So if you have time to do it, we really appreciate it.
Jake:You can find it, in the show notes, and that would be awesome. Thanks so much, Adiva, for putting that one together. Thanks, Eric, for writing that one up.
Michael:While we're here, I have no segue for it, but we should talk about our wonderful friends and supporters at Century. Century was featured very heavily throughout, Laracon US last week. They had some cute elephants. I don't know what else they did, but they they had
Jake:these elephants.
Michael:You got one? I did. I I messaged Taylor, and I said, I can I have one of those? So maybe maybe I will be lucky enough to to receive a, Laroc a Century Sentry, elephant. But for those of you who don't know at this point who Sentry are, they are error and bug tracking rated not bad by some 4,000,000 developers.
Michael:Now application and performance monitoring, they help you to fix your code faster whenever it breaks, and, look, it breaks for all of us. It helps you to identify, debug, and resolve errors. It will help you find the root cause of those errors, and it even enables you to automate everything keeping your entire team informed with customer alerts in Slack to async of issues with Jira and tracking releases from GitHub, Vercel, and Netlify. But you don't have to just watch the errors. You can take action.
Michael:Tracing will allow you to see the complete end to end path that data takes through your distributed system to pinpoint the exact origin of the issue and navigating to a trace from a correlated metric, specific issue, or search. You can solve slow performing pages quickly using automatic detection of and notification of critical performance issues, so you can trace every slow transaction to a poor performing API call or database query, and you can measure what matters by tracking and visualising custom data points across services, helping you to proactively spot any spikes, dips or other anomalies. And you can see what your users are seeing navigating your application's console output, network calls and even inspect your application's DOM tree, it's like your browser's dev tools right inside of Sentry. Of course, this is going to help you protect your user's privacy as well and locks down your debugging experience without sacrificing user privacy with a range of privacy controls to ensure no sensitive user information leaves the browser. Get ahead of production issues, shorten your review cycles, and group all of your testing concerns.
Michael:Get started with Sentry. It is easy, not only in Laravel and PHP, but for next, asp.net, Spring Boot, Vue, Angular, Solid, Svelte, Astro, and more, you can check them out at century.io. And if you use the promo code, Laravel News, you will get 2 months for free.
Jake:F r e e free.
Michael:Free.
Jake:Also, we're using the PowerShell. Yep. We're using for PowerShell. PowerShell. You mean, you can't believe that?
Jake:Isn't that crazy? Yep. PowerShell and crons soon. Crons for the PowerShell.
Michael:That's unbelievable.
Jake:And literally, it has solved a big problem. That was so funny because one of my one of my guys, the IT guys, he's like, yeah. Like, our reporting is crap on all our PowerShell stuff. And I'm like, why don't you Sentry? He's like, what Sentry?
Jake:I'm like, here it is. And he's like, no. It's not gonna solve it. He's like, that's super complex, whatever whatever. I was like, just, dude, just try it.
Jake:So he tried it, and literally, he's like an evangelist now. He cannot stop talking. Like, he won't shut up about it. He's like, oh, dude. This is so good.
Jake:Oh, this is it tells me what version of PowerShell I'm running. It tells me what machine it ran on. It tells me what arguments. He's like, oh, what time it was. This is awesome.
Jake:He will not it's it's great. I'm so glad if he it's, you know, solve a problem for him. It's amazing. So, I mean, even things as obscure as PowerShell using Sentry, and it's amazing. So definitely go check it out.
Jake:That's right. We've got a couple packages, couple tutorials. We're gonna rip through them here. Bossman Chris. Is bossman Chris?
Michael:It is bossman Chris.
Jake:Yes. It is bossman Chris. I was just looking to see if it was the right Chris. It is the right Chris. Bossman Chris write wrote this one up.
Jake:This is a package called linen. If you're looking for a lightweight package that can read and write spreadsheets, Chris Morell's linen package is a lightweight spreadsheet package for Laravel. So if you've ever used OpenSpout before, OpenSpout is a package that that does this. Right? And so what this is is this is a Laravel wrapper around OpenSpout.
Jake:So a couple quick examples of how you can use this. You know, if you have an array of data, what you could do is you could just do CSV writer, do. For, throw the array in there. There you go. That's it.
Jake:Super simple. You can write it to a temporary file. You could write it to a disk. Really simple, and just as easily, you can do the same thing for Excel. So instead of CSV writer, you could say Excel writer, and obviously, you have the opposite ability as well, which is to read.
Jake:So create a CSV reader from pass the the file name, collect those into a set of, values, right? You do a nice Laravel collection using the arrow collect. Same thing with Excel. Excel reader from file name collect, and you're all set to go. So really, really nice.
Jake:It has a couple cool conveniences like using Laravel's lazy collection class when reading spreadsheets as well. So you don't overflow those memory, buffers and all that all that good stuff. So nice job, boss man Chris. Thanks for creating that one. Onto you, my friend.
Michael:The other package we have here enables you to generate entity relationship diagrams with Laravel. The Laravel ERD package automatically generates ERD diagrams diagram diagrams from your Laravel models and displays them using ERD Editor. As someone, Paul Redmond, who recently downloaded MySQL Workbench to try to generate an ERD diagram using this package is way easier and the results look beautiful. Included in the show notes, Paul generated the ERD locally for the pinkery.com project. The project's README has advanced instructions on excluding tables and generating an SVG file that you can distribute to your team or with your documentation.
Michael:For Paul, the SVG generation was not working for him. This package is still brand new and under active development. So to get started, you can view the installation and usage instructions. We will have links to all of that in the show notes. If you've ever done this, and and like Paul, the only time I ever install MySQL Workbench is when I wanna do this.
Michael:And I always regret it because it's this horrible, you know, cross platform Java thing that just it grinds.
Jake:I did this recently. I'm with you. It's the worst.
Michael:Definitely check this one out. ERD editor. I don't know what this is. It's some kind of looks looks v s Cody. My goodness.
Michael:Anyway, erd editor.io to to check that out. We have links to all of it for you in the show notes, of course.
Jake:Very nice. Two tutorials here. Let's go through them real quickly. So we've got how to build your very first PHP package. This is something that if you've not done it before, it can seem really intimidating, and so you've got a great idea.
Jake:You think to yourself, I should really put this in a package, and that's where you stop because you're like, I don't know where you're going to started. This is where you get started. So Paul Redmond wrote this one up. It goes through all the different resources that you can use that really help to scaffold out a lot of the stuff for you, but it starts at, like, step 1, like, initializing a git repository. It doesn't assume any knowledge here.
Jake:Right? Mhmm. How do you get it onto Packagist? What does your composer JSON file need to look like? How do you set up auto loading?
Jake:It goes through everything. And so if you've wanted to create a package and you didn't know where to start, this is where to start. Really great job. Thank you so much, Paul Rudman, for writing that.
Michael:And the last one that we have here, Laravel Model Tips by Ash Allen, regular contributor to Laravel News. I won't talk about exactly what all of these things are, but I will give you a high level overview. Number 1, spotting and preventing n plus one issues. N plus one issues, we talked a little about earlier. It's, you know, when you run a query and you forget to ego load a relationship and you end up iterating over, say, a list of users and getting all their blog posts and you end up querying the details, you know, one query to the the post table for every user in that array.
Michael:Preventing access prevent accessing missing attributes using, prevent accessing missing attributes functionality of Eloquent. There's prevent silently discarding attributes. There is enabling strict mode for models using UUIDs using UUIDs as the primary key. There are some gotchas to that that I still stumble upon every now and then. Adding a UID field to a model using UUIDs, which is a universally unique lexicographically sortable identifier, shorter version of a UID, still sortable because it's time based and looks a little bit nicer, a little bit tidier alternative to UIDs.
Michael:There's changing field used for route model binding, changing the field for all routes, changing the field for single routes, using custom model collection. Goodness. Ash, you put in a lot of effort into these. There is a lot of stuff. There's still more.
Michael:I'm still scrolling as I'm talking and it keeps going. So thank you, Ash. If you want to get some of these incredible Laravel model tips, some of them you'll be familiar with, some of them you won't. And some of them, even as an experienced person, you look at it and you, like me, realize that you still get bit by these from time to time. So
Jake:Mhmm.
Michael:Have a read, commit it to memory, and have it as a point of reference if and when you come across those things again in the future. That is it. That is all of our items for this week.
Jake:That is all she wrote. Well, folks, thanks so much for hanging out with this episode 222. Find show notes for this episode at podcast.larvaldashnews.com/222. If you'd like to ask us any questions, hit us up on Twitter atjacobennett@michaeldorindaor@laravelnews. And if you rate if you liked the show, we'd really appreciate it if you'd rate it up in your podcast of choice.
Jake:Five stars would be incredible. Thank you so much. Hey, folks. If you have not, if I didn't see you at Laracon if I did see you at Laracon, thanks so much for saying hi. If I didn't see you at Laracon, hopefully I'll see you next year.
Jake:Or if you haven't tickets for Laracon AU yet, you definitely should do so. Go visit the other half of the Laravel News crew, mister Michael Durinda over there in Aussieland.
Michael:To it.
Jake:Until 2 weeks from now, friends. Go ahead, Michael.
Michael:We we just extended our early bird. We because we we had an allocation of tickets, and I kind of went, that's the allocation of tickets. And I looked at the calendar and picked a random date. And so that's when we'll stop selling those tickets. But there's still, a handful of them available.
Michael:There's still a handful of those early bird tickets available. And I thought, well, we've already committed to selling that number of tickets, so we'll just leave them open until they're all gone. So if you missed out on early bird, good news everyone. They're still available. Check them out at laricon.au.
Jake:Love it. Alright, folks. See you next time. Bye. Peace.