This is the full transcript of the Laravel News podcast episode #37 - “Laracon Sessions with Freek Van der Herten”
Jacob Bennett: Welcome back to the Laravel News Podcast, everyone. [00:00:30] This is episode 37, and this is our very first pre-Laracon speaker-interview episode, and this also happens to be our very first live recording. So we are on Google Hangouts right now, and we're doing this live for the first time, and I accidentally Tweeted out the link that allows everybody to join into the Hangout, so my bad, I didn't know that was a thing, but we're having people come in, into the live thing, so welcome everybody, thanks so much for joining us.
We've got with us our very first guest [00:01:00] speaker, guest interview person on the show today, as promised, we have with us Mr. Freek Van der Herten.
Freek van der Herten: Hey!
Jacob Bennett: How did I do? Van der Herden, or van der Herten?
Freek van der Herten: Freek van der Herten. Yeah. You say it pretty good. I've give it an eight out of ten.
Jacob Bennett: All right. Eight out of ten. It's one notch down from where we were before, but I'll take it.
Michael Dyrynda: We'll get back up to ten by the end of the show, I think.
Jacob Bennett: We'll get there, we'll get there.
Freek van der Herten: Okay.
Jacob Bennett: So the that format we're going to take here, is we've got [00:01:30] probably four of five standard questions that we're interested in asking all the speakers that we're gonna have on, then and then we've got a couple of listener questions that we've had come in as well, so we'll just go ahead and get started with this list of standard questions we've got here.
Freek, for anybody who's not familiar with you, or where you're from, or what it is that you do, or what company you work at, would you mind just taking a minute here and introducing yourself?
Freek van der Herten: Yeah, sure. I'm Freek, I work at a company called Spatie. I'm a developer there, [00:02:00] and I'm also one of the owners. We mainly develop Laravel applications. We exist now for about ten years or something like that, and we started using Laravel in the four dot zero days. When we started out using the framework we really really liked it, but we missed some functionality and I guess [00:02:30] that we invented some functionality and open sourced it to help other people as well. We mainly create CMS kind of websitey things, so the open-source packages that we put out are mainly used to help build applications like that. So that's me!
Jacob Bennett: Perfect, that's great. It's funny because I had a couple of different things [00:03:00] here I was gonna to ask you, as far as like "Hey, what version did you start with?" Which you answered most of that for us. I looked on the website today to see if they had announced what it is that all the speakers are going to be talking about, and nothing's out there yet, so I don't know if you're allowed to talk about it yet or not, but are you able to give us just what topic you're speaking on for Laracon this year?
Freek van der Herten: I'm not going into detail about what I'm going to say exactly during the talk, but about a year ago I created a dashboard with View and [00:03:30] Laravel, and my topic's probably going to be a technical dive in to that.
Jacob Bennett: Okay, pretty cool. Very Cool.
Freek van der Herten: And we'll touch upon all the cool things that are in there.
Jacob Bennett: Excellent.
Freek van der Herten: Because when I'm at conferences, I see a lot of talks about the higher concepts, and stuff like that, but I think there should be more talks on specific projects, or how things were done, to give practical information. I'm going to try to do [00:04:00] that during my talk.
Jacob Bennett: Very good. I have not got around to using that. I know you have had that out there for a little while. I've actually got plans to do that in a couple of different places at the business that I work in and put it up on some big TV's and things like that, but I know it's really popular. Is that one of your more popular packages out there?
Freek van der Herten: I don't have a download count of the dashboards, 'cause it isn't on packages, it's just a Laravel application that you can just copy and modify yourself, whereas [00:04:30] with the packages you have a download counter from packages. But I tweet this question every few months, "Just send me some pictures of your customized dashboards" and I always get pictures back, so I guess some people are using it, and I think it's not for hobby projects only, 'cause I see it also used with companies that have put useful metrics for their company up there, so [00:05:00] I guess it's being used a little.
Jacob Bennett: Yeah, that was the idea that I had for it, is we have a couple of different metrics that we track and it's really helpful for people to be able to see those throughout the day, and it can be a little bit challenging, or annoying I guess, for them to have a tab open on their computer all the time, so it'd be nice if we had a big TV or something out in the main area where they could all see their stats for the day.
Michael Dyrynda: Yeah, we were talking about using it just this week actually, so ... looking forward to having a dive into it 'cause I know that it's been a round for quite a while, so I do look forward to having a play [00:05:30] around with using yours as a base and I thank you for making my life easier, as you do for, I'm sure, thousands of developers around the world!
Freek van der Herten: No problem. I'm always happy that our stuff is getting used. And I think if you know your way around View and Laravel as you surely do, then I think it will be no problem to customize it at all, because it's a project that seems a little bit advanced if [00:06:00] you don't know it, but if you dive a little bit into it then you'll see that it's actually very very easy to set up.
Michael Dyrynda: As I find with most of your packages.
Freek van der Herten: Oh, thank you.
Michael Dyrynda: One question that Jake and I do like to ask a lot from people that we do interview, which is something that we find, I think, kind of unique, is that ... How you got into development, what drove you towards programming, how you got to where you are today [00:06:30] basically.
Freek van der Herten: It actually started when I was watching Laracast in the early days. Jeffrey put out a video on package development, and in there he showed that you can run automated tests on Travis and get the status of your tests into Github, and my mind was really blown by that, and I thought, "Yeah, I want to make [00:07:00] something where I can use Travis and Github."
And so, at the time, I was busy creating a new version of our company website, and we wanted to have some automated screenshots on there of the projects that we've made, and then I created my first package that could create screenshots of websites programmatically. It's called BrowserShot. It was [00:07:30] very exciting to code out in the open. It's a very simple package. It's just basically a class around PhantomJS. I got the test up and running and it was pretty great. I started to get some traction with that, some people were blogging about it, and I thought, "Hey, I want to do this again."
Michael Dyrynda: Yeah.
Freek van der Herten: And I [00:08:00] haven't stopped ever since, I think, because before we used Laravel at our company we used [Lucent 00:08:08] framework, and we've built our own kind of mini-CMS, and there were lot's of functions that were inside that CMS, that just weren't available in Laravel or in the Laravel packages world. So I basically ported them all over to our new CMS that was based on Laravel, [00:08:30] and I wound up with this folder inside the app directory called Services and I've got there, services analytics, services newsletter, services media library, and I thought, "Hey I really want to kill this services library, I just wat to have them all in the package world."
So, I think, the first 20 packages, that was just cleaning out the services folder in our application, [00:09:00] and just putting it all in the package world.
Jacob Bennett: That's pretty funny. I actually had a similar experience with a couple of my things, where it was just sitting in the exact same thing. I had the name of my company, and then slash services underneath that directory and I was like, "You know what? I'm having to copy and paste this into every single one of my applications. I'm gonna extract this and put it into a package." Now granted, it's not a publicly available package, the one's that I've made that are ... some of them aren't necessarily useful to the outside world; they're pretty specific to what we're doing, but yeah, that's [00:09:30] a nice way to do that. It makes it easy to develop it and work out all the bugs before you have to shift your mindset into "I have to push it into a package divorced from the actual structure of the app."
Freek van der Herten: Yep. Because if you have to copy it into every other application, that's what we did before we had things in the package ... take the media library package for instance. In the early Laravel applications that we made, they were all separate and then when [00:10:00] you discovered bugs you fixed them inside A, but just forgot to fix them inside B and C, and it became a mess after a time. And having it in a package makes it much more easier to distribute all of the bugfixes.
Michael Dyrynda: Yeah, definitely.
Freek van der Herten: We took some time to create those packages, but I'm pretty sure it's save us a lot of time in the long run.
Michael Dyrynda: Yeah it certainly does, and it makes it easier to then, obviously, share those things with other people, and [00:10:30] if they're useful for yourself, as you've clearly found, then they're going to be useful for other people. So it's a pretty good way just to save yourself time, is to start extracting things to packages, if for no other reason, to stop needing to copy and paste. And as you say, from a maintainability point of view you only have to update the package in one place and then you just update any project that's depending on it. And the nice byproduct of that is that you then can help in the open source community.
Freek van der Herten: [00:11:00] Yep, sure. And the open source community helps you back, because there are also some packages ... I think it's mainly the Laravel fractal package, which is a wrapper around the leagues fractal package ... That package really wrote itself. I wrote the basic functionality, just what I needed into the project, and I think in a months time I got six or seven very good pull requests, [00:11:30] and that package now can do everything that the fractal package can, and I only worked I think 20% of the package, yet we use it now on all our projects. So you get some nice things back from the community as well if you just create great packages.
Michael Dyrynda: A hundred percent.
Jacob Bennett: Yeah, and I think ... for those of you who this is your first time hearing about Fred [inaudible 00:11:54], which if you've listened to the podcast before, that can't be the case because we've talked about him on a regular basis. One of the things [00:12:00] that Fred [Acre 00:12:00] is most well known for in the community is the fact that Spatie. Is that how you say it, [sparty 00:12:06]?
Freek van der Herten: Spatie.
Jacob Bennett: Spatie. Spatie.
Freek van der Herten: Yeah that was pretty good.
Jacob Bennett: Spatie is really well know for all the open source packages that they have and a large majority of them are Laravel packages that you can pull in.
One of the questions that I had, and really a lot of the listener questions that we have revolve around this idea of open source, and where you get ideas for your packages, what [00:12:30] are the first steps you take when creating a package, and those sorts of things, and we can talk about those, but one of the things I wanted to ask though was what role open source plays at Spatie, as far as was it an intentional decision on the part of you guys as the owners to say "We really want to expose ourselves to new clients through building open-source packages and pushing them out there." Or was it really just a byproduct of needing to have maintainable pieces of code out there that like you said, [00:13:00] you could bugfix and have them reflect across to all of your installations? And that sounds kind of more like what it came out of. Is that a correct assumption?
Freek van der Herten: It actually started a little bit like I said in a previous question, like an experiment of myself, because I was just piqued with what Jeffrey was showing in his video on creating packages, and there really wasn't a big plan at our company to get known in open [00:13:30] source. It just grew out of the urge to learn these things and to learn how to code better. So we never in the beginning really had a plan to get popular with this, you know? The popularity is just a byproduct, and I say it on my blog now and then that the popularity of those packages is not our main goal, it's a nice benefit. [00:14:00] And we do attract clients with it nowadays, but it wasn't our primary goal. That's a really nice benefit of it though.
But because our name is a little bit grown now in the open source community, whereas previously I mainly used my free time to create all those packages, we saw that this is becoming important for the company's wealth, so now we dedicate some company time to [00:14:30] work on open source as well, because we see that it's really beneficial for our company as well. It's all grown a little bit organically. We never had a big plan of doing this. And even now, we don't have a plan of "We want to make this package, or this package", it's just we let it grow as we go. So there isn't a plan [00:15:00] for in 2007 we have to grow 15 packages or something like that. We create stuff because specific client projects that we get and for things that pique our interest. That's how we get ideas for new stuff.
Jacob Bennett: Perfect. That answers a lot of the questions that I was asked to ask you on the show.
One of the other ones, there's a couple of them, but one of the other ones [00:15:30] that was out there that I think you've answered before but I'll ask you here on the air so you can answer it here ... Some of your most recent packages only support the latest version of PHP, so like seven point one. Could you talk a little bit about ... Some people are stuck on older versions and things like that, and I've heard some people in the community to be like "Well why aren't you porting it back to five six?" Or whatever, and I know you've responded to that before so I just wanted to give you a chance to do that here on air as well.
Freek van der Herten: Yeah sure. I get that people wonder about this, and I guess [00:16:00] it really sucks if you're on an old PHP version and you want to use one of our packages, but like I mentioned before, popularity of our packages is really not our main goal, and every package that we've made is made for a specific client project, and we always try to use the latest PHP versions for our client projects, so right now we're creating everything in seven dot one. The most things that we do are green-fielding so we can [00:16:30] basically do whatever we want. So it makes kind of sense for us to create those packages that have a requirement of the latest and greatest version of PHP as well, you know?
Because in our projects we use the new things like iterable types, and return types and such, and it would really suck for us if we couldn't do that in our packages, [00:17:00] because we ourselves don't need PHP five dot six support, so we are not going to invest time in it, 'cause those new features in PHP seven or seven dot one help you write more expressive code and we try to make as readable code as we can and we really think that those new features in seven and seven dot one can help us do that. So that's why we choose for those [00:17:30] versions as well. But if you need PHP five dot six support, you have a few options. You can fork our packages and just maintain your own five dot six compatible copy, or what you can also do, but that's also maybe a little bit expensive, you can pay me to do it! But I'm not going to invest my free time in it to create code that I'm not [00:18:00] going to use.
Jacob Bennett: This is the beauty of open source right? Anybody can fork the package and make a different version that supports what they need.
Freek van der Herten: Yeah.
Michael Dyrynda: Yeah. I do feel what you're saying there Freek, and I know that with a couple of packages that I've created, I've tried to sort of maintain at least a couple of versions of support for the Laravel framework, and you just find that things can change, not necessarily significantly, but change enough that between [00:18:30] say five two and five four, some functionality that I have relied on just isn't there anymore. So even in just in framework versions, it gets pretty trick to maintain a single version that supports multiple versions of the framework, and then you end up having to maintain different major releases, and it gets a bit messy.
Freek van der Herten: Sure.
Michael Dyrynda: But I guess, on the back of what you're saying about always using the latest and greatest, do you or does Spatie maintain projects once they're finished and handed off to clients? Would [00:19:00] you go back to a five six project and upgrade it seven or anything like that?
Freek van der Herten: Most of the projects that we have just stay with us, so we create applications and we also manage the hosting of them, and after the project itself is finished, we maintain it. And for most of our projects we have a little maintainers budget, and [00:19:30] what we do with it is if we have some time, to actually upgrade the PHP versions on the server, so for the projects that we touch upon and add features to it, the first thing we do is probably to upgrade it to the latest and greatest PHP version, and if it's possible we also upgrade the framework.
Michael Dyrynda: Very cool. One other question that I had, and [00:20:00] it's on the back of some work that we are doing at my day job is, in terms of having like a base, a skeleton repository that you start from? ... Spatie has got one of those if I recall correctly, is that right?
Freek van der Herten: Yep, sure. Do you refer now to our blender repo for creating [crosstalk 00:20:23]
Michael Dyrynda: I think that's the one, yeah.
Freek van der Herten: Yeah.
Michael Dyrynda: So when you're creating a new project from that skeleton, are you [00:20:30] then using that as a fork? Are you forking from that to then update any application from that? Or do they then become standalone in their own right?
Freek van der Herten: It becomes standalone in some rights where we create a new repo for that new project, and then the master version of blender into that new project, and then there are-
Michael Dyrynda: Okay, so you wouldn't use the base repo to then update any of the ones that you've created from it later on?
Freek van der Herten: No.
Michael Dyrynda: [00:21:00] Okay cool.
Freek van der Herten: No. But most of the code of Blender is actually in packages, so we can pull in a lot of bugfixes just by running composer update. I think if you open up the composer [JC 00:21:18] file of blender you'll find I think 30 packages of our own in there, so most of the code is already in packages. So it isn't a problem that they're separate.
Michael Dyrynda: Great.
Jacob Bennett: Okay, two questions, [00:21:30] final questions. Actually three, I'll try to make this fast.
Number one, how many shrines have you discovered in Zelda?
Freek van der Herten: I think around 40 or 50 or something like that?
Jacob Bennett: This is a listener question by Christof Rumple. [crosstalk 00:21:47] He wanted to know how many you've discovered, so-
Freek van der Herten: A lot
Jacob Bennett: A lot, okay
Freek van der Herten: Yeah. So the most time I spent was in the shrine, I [00:22:00] think it was called the big battle challenge or something like that? With a big robot in there, and I think I spent more than an hour in that single dungeon to defeat the thing because I really wanted to destroy it. But Zelda, it's such an awesome game.
Jacob Bennett: Yeah, I've yet to check that out. I've got to get it. Michael, you've got a switch, right?
Michael Dyrynda: Yeah. Look, to be honest I have not played Zelda at all. [00:22:30] It wasn't really part of my childhood. I was a Sega guy growing up, so Nintendo stuff wasn't really big for me, but my wife has sunk a lot of time into it, to the point where she's normally very religious about school nights and she's in bed early, makes sure she gets a good nights sleep, but for I think two or three weeks after Zelda came out she was coming to bed 10, 11 o'clock, and regretting it the next day.
Jacob Bennett: Nice.
Freek van der Herten: Cool.
Jacob Bennett: All right, here's my other [00:23:00] question. I don't know if there's a quick answer to this one or not. Have you found any great ways to share your named routes between Laravel and view? One thing that's annoying and sort of frustrating to me ... It's just like a convention thing with me that I like to be able to use my named routes wherever I can, and I would love it if I had a way to be able to say in my view, when I'm making a Ajax call or whatever, [00:23:30] you know, "User dot register" or something like that. Have you found any great way to do that or do you just hardcode all your routes in view? Or what's your take on that?
Freek van der Herten: Well actually in our projects well we use [Choo 00:23:47] we haven't come across that problem yet. Most of our view thingies are just single page things that just talk to an API endpoint in Laravel application [00:24:00] but we don't need to pass routes from Laravel to the view side of things, so can't help you with that one.
Jacob Bennett: Okay, no problem. If anyone else is out there listening and they know, they have this figured out, hit us up on twitter, we'd love to hear your solution to that.
And then, one of the last things we have here before we let you go ... Michael came up with this idea a little while ago. We are really wanting to put together a playlist for people who have to travel [00:24:30] to Laracon in New York this year, and this should be easy for you because you're a radio guy that plays music and stuff, so we're looking to get three songs from each of the speakers that we have come on the show. I don't know if you have those off the top of your head, or if we could get those from at some other point, but even if you just had one or two that you like that we could listen to in advance, that would be awesome.
Michael Dyrynda: Yeah, we will publish a Spotify playlist of them, so fingers crossed they're on Spotify as well.
Jacob Bennett: Yeah.
Freek van der Herten: Yeah sure, I'll select a few songs. [00:25:00] I think for the occasion, because it's for the Laracon thing, I'll just select some New York bands.
Jacob Bennett: Oh awesome.
Michael Dyrynda: Very nice.
Freek van der Herten: That's a nice theme right?
Jacob Bennett: Absolutely.
Michael Dyrynda: Send them through and we will publish them.
Freek van der Herten: So I'll send those to you in a bit.
Jacob Bennett: Very cool. And we'll have those in the show notes for anyone who wants to ... Well I don't know, should we do that Michael? Or should we keep them a secret, what do you think?
Michael Dyrynda: I'll think we'll publish them as we go along. Maybe.
Jacob Bennett: Yeah, perfect sounds great. We'll put those in the show notes and we'll have links to those and then we'll be [00:25:30] making a Spotify playlist as well as we kind of go along in the weeks. But I think that's about it. We've gotten a good amount of time here and it's been really great talking to you. We've gotten to know you a little bit better for sure. This is the first time we've been able to talk kind of in person, I say 'in person' but you know what I mean, over the internet.
Freek van der Herten: Yeah.
Jacob Bennett: And it's been great catching up with you, hearing a little bit about your background and what you guys are doing over there at Spatie. [crosstalk 00:25:52] I wanted to say [danke je 00:25:56], which is 'thank you' in dutch, right?
Freek van der Herten: [00:26:00] That's right, ten out of ten.
Jacob Bennett: Yes! There we go, the coveted ten out of ten. Very nice.
Freek van der Herten: I can't wait to meet you guys in person at Laracon. I'm really looking forward to the event [crosstalk 00:26:14]
Michael Dyrynda: -love meeting you.
Jacob Bennett: Absolutely. Well thanks again for coming on Freek, we'll look forward to seeing you at Laracon this yeah and hearing your talk.
Freek van der Herten: All right, thank you, see you guys
Michael Dyrynda: [Vada well 00:26:24]
Freek van der Herten: Bye bye.
Jacob Bennett: All right well that was really good talking [00:26:30] to Freek. Sorry, that was a terrible ... That was really great talking to Freek. Freek van der Herton. And I did get a ten out of ten on the ... I can't even remember what it was [crosstalk 00:26:43]
Michael Dyrynda: When you said thankyou.
Jacob Bennett: Thankyou. In Dutch.
Michael Dyrynda: That's right.
Jacob Bennett: [Yanda 00:26:46] something, I don't remember.
We've got a couple of things we wanted to talk about today. We have a couple of sections here, so we've kind of got it broken up into Laravel core, I've got a couple of notices there, we've got a couple of new packages [00:27:00] that came out this last week, and then we've got a couple of things that were going on in the community that we wanted to let you all know about. So let's go ahead and start with what's happened in Laravel core this week. We've got some updates with five dot four. Michael do you want to fill us in on that?
Michael Dyrynda: Yes sir. So at Laravel 5.4.20 has now been released and there are probably about a dozen different pull requests that were merged in in that release, but we're just gonna talk about a couple of them and if you wanted to learn about what when in obviously check [00:27:30] out the show notes. We'll have the link in there. One that has been fairly popular in recent times is the tap method. What the tap method does is allows you to pass in a value and a callback, and what will happen is that Laravel will process the callback function passing in the original value and then return the original value.
So this is really helpful if you want to do something like update a user model and then return the modified model, [00:28:00] whereas you can't really do that if you call update directly on user. If you were to call user arrow update you would get a Boolean response indicating that the update had been successful. With the tap, you could pass in dollar user and then a callback which would be your update method, but what we've got here in 5.4.20 is it's been implemented in such a way that it can now be called as a higher order method. So instead of [00:28:30] passing that second parameter that would be a function, what you can actually do is omit the second parameter and call any method on the first parameter, in this case the user model, directly on the result of the tap.
So you could call 'tap user' and then arrow update and then do your update, and you would get back the modified user model. So that makes accessing that stuff a little simpler.
Jacob Bennett: Taylor did have a post out there this week where he talked about this. Or maybe it was last week, [00:29:00] I can't remember, is it the tap tap tap one?
Michael Dyrynda: Yeah. Yep.
Jacob Bennett: Because I was kind of wondering the same thing. I was like "Okay, what's a good use case for this?" And he said this was his most common use case, this exact one that you just described. And I've run into this a couple of times as well where I've tried to get the result of an update function and "Oh that's right, it's a Boolean value" and it's not the actual model that I was expecting. So I'm going to be using this in the future for sure.
Another one that was added that I thought was interesting is this model factory [00:29:30] lazy method. If you take a lot at it in the show notes again what you'll notice is that if you're making a model factory, and what those are is basically they allow you to very quickly create either a model in memory or in the database really quickly using fake values, so sometimes what you have is when you're trying to do this in a test you also need ... Let's say you have a payment and that payment belongs to a user, so that payment needs a user ID, [00:30:00] your options are either to make a user using a model factory and then pass that user ID into your payment, or what this allows you to do is it allows you to, in your model factory for your payment, allows you to be able to make that user right in line, in there, really easily.
And so what you previously had to do was pass the closure and this allows you to basically just say "Factory, User" and then "Lazy", which means it will create it after the fact. Or actually I guess before the [00:30:30] fact, and then insert the ID of the user at that point.
So, looks interesting, and check it out on the show notes.
Michael Dyrynda: Yeah.
Jacob Bennett: Let's see what else we've got. We've got two things actually for Laravel five five that were announced this week. The first one is that, and this was on Twitter for all those kind of hot on Twitter, there was quite a bit of discussion around this. In your controllers you have the ability to call "This Validate" and that will accept a request object and an array of rules, [00:31:00] and it will run those rules against that request and make sure that all those validations pass. But what we're introducing if five dot five is that after this validate is done, what it will now do is it will return those values from the request that you actually validated. So there's a couple gotcha's here. This is a really cool feature. Michael, what are some of the little things we need to be aware of when we're using this?
Michael Dyrynda: I suppose the first and foremost thing that you want to be aware of is the fact [00:31:30] that this method, when you call "Validate", it's only going to return the data that was validated. So if you were validating the input for a product for example, you would have the name, the price, and the category that it exists in. So if your validation was for those three rules then the validate method would only return the data from the request with those keys. So if you were passing in name, price and category, but you had some other data in there [00:32:00] that didn't need validation, and you just wanted a description maybe, well you wouldn't be able to use this particular method, unless you were to then pass description into the validation rules as an empty array or an empty string, so that you would get that value back again.
Jacob Bennett: And what this is doing in the background is, if you've ever used request-only, what that allows you to do is it allows you to pass an array of the keys that you want to get out of the request. And that's what this is using in the background. It's saying "Grab me all [00:32:30] of the keys that are in the validation rules, and grab those out of the request." So one workaround that you can do if you don't want to do any validation on a value that you're wanting to get out of the request and you're still wanting to take advantage of this validate, what you could do is you can pass an empty array in for the rule-set of that key and that will allow that value to be returned along with the rest of them.
Then what you can do really is you can say "Data this. Validate." And then you can just pass that data in if you're going to create [00:33:00] a model or something like that. So looks pretty handy.
Michael Dyrynda: The important thing to note here is that you don't have to use the response from the validate method. You can continue to use that validation as you've used it in the past, and then just continue to use request-only and pass in what you want that way. It's entirely up to you. If you're only ever going to be passing in to your model, for example, the values that you have been validating, you know, protecting yourself against mass assignment and things like that, [00:33:30] this is a great way of going about it. And it certainly simplifies what code you're writing and cuts down how much code you're writing.
Jacob Bennett: I was gonna say you're right. It looks really clean. If you look at the ... They have like "Okay, before this is what you would have done. After, this is what you do." And it looks really clean.
Michael Dyrynda: Yeah. And the validate will still throw an exception where it would have previously, so you don't have to worry too much about that.
But the other thing that has gone along with this, and this is where some of the extra controversy came from, was around being [00:34:00] able to call the validate method directly against the request object. There's probably some criticism around whether that is the correct place to do it. It certainly cleans up your code, and if that is how you feel like you want to write the code then you certainly can. So you can call using the request helper, just request and validate, and then just pass that an array of rules, and that's shortening your code even further. It's something that I had hoped for for a little while, and now that it's coming in five five in July I will [00:34:30] eagerly be awaiting using it.
Jacob Bennett: I was not aware of that. Was that in the same pull request? You can call the request global helper, and call validate on it?
Michael Dyrynda: It was a subsequent pull request.
Jacob Bennett: Okay.
Michael Dyrynda: When I had seen ... I think Joseph [Silba 00:34:44], he had posted the original screenshot of the change and the link to the pull request, I had suggested "Oh, the next step would be to get this happening on the request object." So he's submitted a pull request, and that's now been merged in as well, so it's adding validate [00:35:00] as a request macro.
Jacob Bennett: Very good. Okay, audience participation time. Get your hands ready. For any of you who have ever been frustrated by the default Laravel error page, the one that says "Woops, something went wrong", go ahead and raise your hand at your desk, or in your place of employment, or if you're working out of the gym, just go ahead, raise your hand up.
I've got my hand raised. Michael, do you have your hand up? Yeah, he does. Okay. So good news for all of us who have been frustrated. It's so embarrassing, by the way, when [00:35:30] that happens isn't it? It's kind of funny though when you see it out in the wild. You see a "Woops, something went wrong." And you're like "Oh my gosh, they're using Laravel too!" It's kind of like ... it's comradery, right? But in five five we have some improvements with the default error views, so Michael tell us a little about that.
Michael Dyrynda: Yes. The big part is that it is not that default symphony "Woops" page anymore. It's more in line with the design that's used for the default welcome page. So instead [00:36:00] of getting that gray screen with the serif font that says "Woops" like something is wrong, or something went wrong, now it's Laravel look that we've come to know and love that says exactly the same thing.
Jacob Bennett: And it ships with a couple different error pages that it didn't before right? Typically that was the only one. Now you've been able to add in your own error pages really easily for quite a while now. I don't remember what version it came in on, but it's been for quite a while. But this gives you a template to extend [00:36:30] very easily, it's kind of componentized, so it makes it easy for a nice, centered on the page, message in the nice looking font, and really clean, and it makes it easy to change out that message. I think it ships with a 500, a 404, a 403, a couple of other ones. So check that out, and use it.
Okay. So that's pretty much all the stuff that's Laravel core. We've got three different packages that we wanted to talk about this week, and so the first [00:37:00] one is an interactive make command. We've talked about these a couple of other times on the show where you can do something like PHP artisan make controller, and then you can do a resourceful controller, or there's another one with a nested resource controller that we talked about that got pulled in recently, there's migrations, there's models, there's notifications, and it can be difficult to remember all the flags that can go along with those, and all the options that you without having to refer back to the documentation all the time.
So this package [00:37:30] is pretty cool. It allows you to do PHP artisan make, and then it will list out all of the different make commands that you have available, so off controller, command event job listener, whatever. And then as you do it one step at a time, it will essentially provide you prompts to ask you what you want to do with the different options that you have on that particular command. It's really neat and it allows you to get the full benefit of using [00:38:00] these make commands without having to remember the list of arguments.
Now I tend to use a lot of the same one's over and over, so I've got some of those arguments memorized, but if you're A, new to Laravel, B, you've never used some of these makes, because there's literally like ten? 10, 11 of them here? Which I didn't even know some of these were available. Or, C, if you're just tired of trying to memorize things. These are all good reasons to check this package out, so definitely do so. We'll link it up in the show notes.
Michael Dyrynda: Yeah, [00:38:30] I know other than auth, controller and model, which I use fairly frequently, any of those other ones I'm always running PHP artisan help, make, whatever, to find out what the options and the arguments are, so this is certainly gonna speed that up, and It's an external package. It's released under the Laracademy organization on Github, so I think it's Michael McMullin it looks like, who's the main contributor from Tutelage Systems, so shout out to Michael for that.
Jacob Bennett: Yeah thanks [00:39:00] man, I'll definitely be using this.
All right, what else have we got Michael?
Michael Dyrynda: The other package ... Or not package I suppose, it's a free SaaS that was released by Booby [Booman 00:39:10] Booman? Bowman. Bobby you'll have to let me know which one of those is correct, or if neither one of those is correct. But it's a simple idea that he's put together over a weekend and basically it allows you to generate custom markdown mail themes. This is a feature [00:39:30] that's been around since five four I believe, and in five five you'll be able to customize the theme per mailable ... I think that is correct Jake, do you know?
Jacob Bennett: Let me see. Customize it per mailable? Yes, I believe that's a feature in Laravel, where you can specify what theme you want to use for a specific mailable, and I think that just came in recently. But yeah, I suppose you could use this to generate any number of themes that you want. [00:40:00] And it really is just a little styler. Along the left hand side it gives you all the options for the different things that you can change. The colors and font size or whatever. And then you just click on the little color picker and then you select the color, or you can paste it in from your SaaS file or whatever, and away you go. So it makes it really easy to generate those themes and then save them down to your particular app and then consume 'em.
Michael Dyrynda: So it lets you modify the background, your buttons [00:40:30] ... You've got the blue, the green and the red, the info and the success and the danger kind of colors. It lets you change the color of your links and your text and borders and all that kind of stuff, so it makes it really simple. I mean, not that it's difficult, but it makes it easy to generate these things with a preview of it in the browser straight away, and then you just copy and paste either the markdown theme or the html, and the CSS. [00:41:00] So thanks Bobby.
Jacob Bennett: Yeah, I think the biggest advantage is the live preview, so you're not having to ... Of course we just recently had where you can render a mailable to a ... It'll render a view, right? I think Freek asked for that, and they pulled that in, so where we talked about that a couple of weeks ago, where you can just say "Mailable" and then "Render" or something like that, and it will ... If you just did a little test draw to it you'd be able to try that out. In any case, it's really cool and you should check it out.
Michael Dyrynda: Yeah.
Jacob Bennett: [00:41:30] We also have the Laravel language manager. Mohammed was responsible for kind of converting some of this to a JSON format. It was previously done through an array config I believe, so Laravel language files are now managed through JSON, and he has made a little package called Laravel Language Manager, and it gives you a little GUI for managing your JSON language files in your Laravel project. I won't go into too much detail, it's pretty self [00:42:00] explanatory, you have all the keys on the left hand side, you click it and it allows you to change what it actually is in your language file on the right hand side. For people who have tried to wrangle large JSON files, this could be a welcome relief. And here's a question for you Michael.
Michael Dyrynda: Yeah.
Jacob Bennett: I kind of bounce between the two 'Jason' and 'Jay [Sahn 00:42:25]' or J-[Sawn 00:42:25]. Which do you use? What's your preferred method of pronunciation?
Michael Dyrynda: [00:42:30] I heavily emphasize J-[SON 00:42:34], because I have someone that works with me called Jason. And of course he's now renamed himself on Slack to JSON, so we have to be careful when we're saying Jason and JSON so that he doesn't perk his ears up when we don't want him to.
Jacob Bennett: You know this isn't as hotly debated as gif or jiff, but I hear different people say it different ways, so I was just curious.
[00:43:00] I think that's it for packages and SaaS stuff. We've got a couple of things that happened in the community, one that was really cool, and we've talked a little bit about this before where Laravel is something that's not used just in the US and Canada, but this is literally used all over the world, so had a cool announcement about a meetup that happened over Nigeria, if you want to tell us a little about that.
Michael Dyrynda: Yeah, so as you say Jake, we talked about Laravel Live India probably about a month ago, and now Laravel [00:43:30] Nigeria had their first meetup, and they had over 150 people in attendance.
Jacob Bennett: That's awesome.
Michael Dyrynda: So congratulations to the folks out in Nigeria. I think the meetup was held in Lagos and Neo [Egodata 00:43:44], I guess is how you pronounce his last name, had a event recap that he posted up, and just a little bit from that, he said that one of the goals that they set out to achieve was to raise the standards. So the meetup trend is still very much in its infancy, and so there is much to be done, [00:44:00] but they wanted to be the standard by which all other meetups are measured. When they first started setting up the meetup page where people could join the community and also where could RSVP to the meetup page, they started getting people joining up almost immediately.
So they recorded the talks and thanks to pusher they were able to release those talks and the speaker slide decks which we'll obviously link up in the show notes, but congratulations again to the people responsible for organizing and getting that off the ground. It's always fantastic to see such a great [00:44:30] turnout and engagement from the community just of it's own volition, you know off their own two feet, just getting together and getting these kind of things done.
Jacob Bennett: Yeah. The one other thing that I wanted to mention before we let everybody go here, I know this has been a longer episode, so this'll be the last thing I promise. PHP Roundtable is a podcast hosted by Sammy Kaye I believe. I've listened to that quite a few times, and they had a Laravel [00:45:00] edition. They had Taylor, and Mohammed and Jeffrey and Adam and [Dries Vince 00:45:04] on there this last week. You can check it out on YouTube or you can look at it or find it in your pod-catcher of choice. So check that out when you get a chance, and support that podcast, they do a really great job.
Michael Dyrynda: Yeah. I'm not sure Sammy has put up the audio only version, but we'll certainly link up the YouTube recording in the show notes.
Jacob Bennett: For sure. All right, well that is it for me. I am all out of stuff. Pretty cool [00:45:30] week, lot's of stuff going on in Laravel core, five point five is getting better every day. I'm more and more excited to have it in production as soon as possible.
Michael Dyrynda: Yeah, every time we seem to think that Laravel has run out of steam, Taylor finds some new things in the community and he always finds some new things to add and change and improve the framework, so always great to see that continuing to happen and I hope the trend continues for a long time to come.
Jacob Bennett: Absolutely. Thanks everybody for listening today, this is episode 37, you can find the show notes [00:46:00] for this episode at Laravel dash news dot com slash podcast slash 37. If you like the show please feel free to rate it up at five stars in your pod-catcher of choice, we'd really appreciate it. If you have any questions for Michael or I, feel free to reach out to us at Laravel news on Twitter or on our personal Twitter accounts. Michael thanks so much for taking some time to talk to me man.
Michael Dyrynda: No worries, and don't forget we'll have the link and the show notes as well for the road to Laracon Spotify playlist [00:46:30] Freek has sent me his tunes. I've also got some tunes from a few other people in the community, but I think I'm gonna keep it to myself who owns each of those songs, and we'll see if the community wants to-
Jacob Bennett: Ah! A big mystery.
Michael Dyrynda: Yeah, see if the community wants to play a big guessing game.
Jacob Bennett: Sweet. Sounds good. Hey do you have any foreign language goodbyes for us this week?
Michael Dyrynda: I do. Just on theme because we had Freek on, I'm gonna say goodbye in Dutch this week, and that is [Vara vell 00:46:59].
Jacob Bennett: Nice. [00:47:00] It sounds like Laravel.
Michael Dyrynda: It does, it does. Maybe that's why Freek was drawn to it in actuality.
Jacob Bennett: There we go. All right man, take it easy. We'll see you.
Michael Dyrynda: See you mate, see you in two weeks.
Jacob Bennett: [00:47:30] Bye.
Join the weekly newsletter and never miss out on new tips, tutorials, and more.