Modern Deployment for Laravel and WordPress

Brian Coords: You are listening to viewSource, conversations around WordPress and adjacent tech with hosts, Aurooba Ahmed and me, Brian Coords.

Our Completed Laravel App
---

Aurooba Ahmed: All right, so last episode of the Laravel series. In our last episode, if I'm remembering correctly, we basically talked a lot about the content relationships and how they differ between Laravel and WordPress and you showed us how you created the form and how to add content to our Suggest an Episode Laravel app.

Right, Brian?

Brian Coords: Yeah. I did all those things learned a few mistakes, left a few accessibility errors on the server, you know, a few things like that, but yes, that, that is what happened. And since then I've, I, I think finished, you know, V1, you know, release candidate one of of the episode suggestion. Suggestor.

Aurooba Ahmed: cool, cool. So what did you do? I mean, when we left off, we had the ability to register and the ability to add a new suggestion, but we didn't have the ability yet to vote, which is something we talked about, because that required a new table, right?

Brian Coords: Yeah. So the way I had originally envisioned it was like, we'll just keep track of the number of votes, but then we realized we need to limit it to one vote per user ID. So that's

Aurooba Ahmed: Or

Brian Coords: we made. Yeah. For like a suggestion and a user ID. So there's a pivot table now that ties those two things together. And of course with Laravel, it was super easy.

I created a table. It, I knew exactly what I wanted to do. It's a very easy to use. They have these relationships where I can say this belongs to this, this belongs to this, attach a user to a suggestion and it'll only do it once. And there's just, you know, it's pretty seamless. So it honestly took me like 20 minutes to add that feature and put some forms and some SVG buttons that copilot just like threw in for me.

And and it's, it's there. You, anybody can create an account and put suggestions and vote.

Aurooba Ahmed: Cool. And I played around with it, so I noticed, for example, that you moved our form up to the top of the area and there's a little arrow and I could vote for things, so it was fun. I was like, yeah, let me vote for everything.

Brian Coords: Yeah, and I put in, like, one thing I do is when you put in a suggestion, you immediately automatically vote for it. So everybody starts with their one vote.

Aurooba Ahmed: Oh, that's smart. Yeah, that makes sense. I did not test that, but cool. All right. So do you want to show us what that looks like?

Tailwind and Colors
---

Brian Coords: Okay. So I am sharing my screen with the suggest episode, suggester tool that we built. And I'm actually on the login screen that you know, where you can log in or create an account, forget your password, all that stuff is functional and working. And as we talked about before, super easy do you notice anything visually about the screen?

Aurooba Ahmed: The colors are the view source colors now.

Brian Coords: I did, I brought, yep, I brought in like the button colors and stuff like that. And like the focus colors and everything from view

Aurooba Ahmed: Did you also slightly change the background or is it that it looks more blue because of the other blue accents, like the sea blue accents now?

Brian Coords: So you know how Tailwind makes you pick a color, but then you have to put in like zero to a thousand like versions of the color. There's like a tool where you put in your color and then they make that for you. Like they make the different 100 through whatever. So I found that tool online. I put in our brand colors for blue and green.

And then, so that background you are correct is like the tiniest. It's like, it's like a 50, like 0. 05 percent of our blue instead of

Aurooba Ahmed: That's awesome. Okay. We'll put the, we'll put that tool in the show notes because that sounds really cool. Even if you don't use it with Tailwind, right?

Brian Coords: All right. I'm going to log in by putting in my email address and password.

Aurooba Ahmed: It's so nice. Like the brand color just makes me so happy.

Brian Coords: And honestly, like, doesn't this remind you of WordPress, but like

Aurooba Ahmed: Yes.

Brian Coords: like easier, but it's like such a clean, simple, like UI that everyone understands.

Aurooba Ahmed: it's a little bit more modern looking than the default WordPress login screen.

Brian Coords: Yeah. And we will not go off on a tangent about how they changed the HTML markup of it in WordPress 6. 4. That's probably going to be out by the time this comes up.

Aurooba Ahmed: Yes. Okay.

Brian Coords: Yeah, you're right. I did change the order of this. There was a few things I was thinking about. One is that this page might get eventually really long and it should be paginated for like performance reasons. But I just didn't want, I just didn't have time for it. So I was like, I'll just put the form at the top and you can see it.

I don't know. What do you think?

Aurooba Ahmed: Yeah, no, I think that for this version and for the sake of this series, which is, you know, only four episodes and we can't do everything or show everything, this makes a lot of sense. And this way it just, it's there at the top, which is like one of the major things you kind of want to do maybe that and vote and you can already vote.

So

Brian Coords: Yeah.

AlpineJS and Package Bloat
---

Brian Coords: As we were talking, I remembered that when you install like Breeze that also includes like Alpine JS and Tailwind and stuff like that we talked about. It actually has a modal component, they stick in there for you. And I actually didn't even think about that. I could have put this card into a modal and had like a button right here

like, add a suggestion, which would be really nice too. And the, the framework for the modal and stuff is already like there in

Aurooba Ahmed: Nice.

Brian Coords: In, in the breeze package. So

Aurooba Ahmed: Okay. Maybe we can do it after, like, we're done recording this episode or something. But that sounds like a really good idea and it would feel a little cleaner and still avoid the whole pagination issue, right?

Brian Coords: Yeah.

Aurooba Ahmed: Yeah. But it's really cool that Breeze includes that, too. I mean, I'm impressed with how many things just come in that basic Breeze package.

Brian Coords: yeah, it's, it's a little random. Cause you're like, Oh, well now you have a, like, sometimes you'll install a package in Laravel and then there'll be like, we also brought our own modal and what, and you're like, well, I was installing breeze. I didn't know I was getting tailwind and Alpine, like all these things, but it is actually really nice.

You just have to think ahead when you install packages. Cause they sometimes come with a little more stuff than you expected.

Aurooba Ahmed: And can you, like, remove them or say, Oh, I don't want this one part or something, or no?

Brian Coords: I think just like manually, although I don't, yeah, yeah, because usually you, when you install something, you run a command that like copies over a bunch of stuff. And I don't know if you, maybe they, they put in options or something to like strip that down.

Aurooba Ahmed: mean, that's worth looking at. But okay, this looks solid, you know, and do you want to, do you want to demonstrate the voting?

Brian Coords: yeah. So I got to find, so like I can't vote. Oh, you know what? Because we reset the server, I can vote on some of my own. But typically that wouldn't happen, but I will vote. Ooh, which one do I actually want to vote for? Finishing that accordion block. I will vote for that. So you click it, this, this success message I'm now realizing like is such a light.

I don't even know if you can see that in the screen share that it's there. So we can definitely do some stuff with that. It's not an error. Cause it's, it's, you know, the point gets across, like the background is not like important to the getting the content across, but

Aurooba Ahmed: So, what Brian's talking about is that there's a notification at the top of the screen right now that says, "Suggestion Upvoted", and the green color background is so light that you can't really see it against the whole application background, but. Yeah, it's all good.

Brian Coords: but that's it. It's just a form. You don't even see it, but you actually, when you click the button, you you're clicking a submit button, it goes to a URL that checks everything, authenticates.

Aurooba Ahmed: Yeah, so this is actually refreshing the whole page, but you could use AlpineJS or, like, LiveWire or something in order to make it, you know, do it without a refresh, but honestly, it's so fast and so light that you kind of, like, you notice it because of the fact that it gets, it takes you to the top of the page again, but aside from that, it's like, it's so fast, it doesn't even matter.

Single Page Apps on Laravel
---

Brian Coords: Yeah, and if I wanted to, like, you can, you can build like full single page app on top of Laravel. It's very common. There's lots of places to do that. I wanted to go as simple as possible and do full PHP page refreshes. And what's nice is like, if I upvote and it changes the ranking of the order,

because they're ordered by votes most to least. I don't have to deal with that. Cause I'm just loading the page. Like, I don't know, it just less complexity and like getting it off the ground faster, I think was the goal. And like, that's an example of where it's, it's just, you make your life easier.

Aurooba Ahmed: Yeah. I also want to note, like, a really, really popular or really good example of a SPA built on top of Laravel is actually Fathom Analytics. Because Fathom Analytics is basically Laravel with, like, Livewire and AlpineJS and Jack Ellis, the primary developer of it. He loves Laravel and he loves doing everything in it.

And, you know, it's not Exactly. Like there's the, it's, it feels very dynamic. It's very single page. Things don't load reload or anything, but it's definitely a different way of doing things than React or JavaScript. And you can't, you, you can tell, but it doesn't matter because it's doing what you need it to do.

Brian Coords: Yeah. And if you want that single page app experience with like instant reloads and everything, but you want to write it in PHP, that's what Laravel LiveWire is for, like you never really write the JavaScript, you always are dealing with PHP and it's definitely a route to go. And this would probably be a very good use case for it.

Because it would have done things like re redo the whole query and everything like sort of instantly. But you know, it's really good at that. And then sometimes as you get more complicated, you're like, Oh, this is getting a little too, too much to handle. Just such a great ecosystem.

Brian's Three Open Terminals
---

Aurooba Ahmed: Yeah. So, okay. Let's bring it back to the topic of our This last episode in this series, which is really about, you know, how do you build this stuff? How do you deploy it? So what goes on to make this happen?

Brian Coords: So I'm going to take this on a side trip because. Earlier, we were talking about how, I mentioned how, oh man, when you're coding with Laravel and you have to have like three terminals open, and you were like, three terminals open. So, did you, did you, like, figure out what you think my three terminals are that I need to have open?

Aurooba Ahmed: I was, I was so tempted to Google it, but I'm like, no, no, I'm not going to Google it. We're going to find out together. Obviously one is like, you had told me is artisan serve, which is to like, start up the server. One is probably to like, actually you know, like a standard NPM run build, right? But what is the third one?

I,

Brian Coords: So

Aurooba Ahmed: what is the third one doing?

Brian Coords: so I'm sharing my code editor. I'm very zoomed in. I have my terminal on like the right hand side column of the screen. And the reason why is cause so first I need my like PHP artisan serve. And so I need to run the PHP server and it gives me like a little local host URL, right?

Then I have to click the split button and open a second terminal. And this is where I have to run my build process. So I need NPM run dev. This is a very fresh version of Laravel, so it's actually using Vite instead of Mix.

Aurooba Ahmed: Veet. Yeah. And it's fantastic. Vite is great.

Brian Coords: yeah. And then I need a third one, because honestly, I spend a lot of time making commands.

Constantly talking to the server. So like, php, artisan, make. With a colon, and then I'm making something, make a migration, make

Aurooba Ahmed: I see.

Brian Coords: make, you know, scaffold this,

Aurooba Ahmed: Right.

Brian Coords: or recently I've been doing a lot of where I type in PHP artisan tinker, which opens like a little PHP shell and resetting my password.

Cause I keep forgetting to save my password for my user, my local computer. So I like go in there and I like, you know, in PHP, like find the user and change the password. So I always just need that third terminal open to like do these sorts of things.

Scaffolds and CLIs in WordPress
---

Aurooba Ahmed: That's so interesting, you know? Coming from the world of WordPress, that's not something... You're not used to scaffolding so many things using the command line. Even though there's a number of scaffolding commands in WP CLI, right, for like a plugin, a custom post type, those kinds of things do exist, but I don't think that's as...

baked into the workflow of a WordPress developer as it is for a Laravel developer. So that's really cool. You know, it's another way. I'm just like, this is awesome.

Brian Coords: and it goes back to what you were saying a few episodes back about like strictness, where like, I can do all this stuff from the root. Oh, I might be doing, the other thing I might use this for is like Git. I kind of like to just do my Git stuff in the command line sometimes. And so it's all easy because I'm like right in the root.

It's always the same and I know that sometimes WordPress, I'm like, oh, yeah, there is WPCLI as scaffold. But like, Is WPCLI even working on my computer right now? Sometimes it's not because it's got PHP, like version issues. Unless I'm using Local, then they have like their own shell that I have to open up. I can't open up in VS code.

I got to open it up in a real terminal. Like, am I scaffolding from the root? Am I building a block in a plugin, in a theme? And you know, it's like, there's, there's just. Cause there's no like best way to do it. It's, it's just like, I think it adds a lot of overhead to people. And they're just like, I don't want to deal with the scaffolds.

I don't want to deal with WPCLI. I don't want to deal with the build process. I want simple WordPress.

Aurooba Ahmed: Yeah. That's unfortunate, you know? And I think when I think about that, I think it's, yes, there's this whole concept of there's so many different ways to do it that there's no one way that you can guarantee it'll work. But two is, I think, just an education thing as well. I actually think that around WPCLI and it's Usefulness, you know, the fact that it has a lot of these commands and the fact that it's actually very easy to create new commands, all of these things, there's not actually a lot of education around them in the WordPress world.

And so the only people who are using it are the people who, like, literally are doing something so often that they know creating a WPCLI command is going to save them so much time. And I think that comes along, that comes along most often on the enterprise level. Right. And not everyone is on the enterprise level, but with Laravel, it's like, it doesn't matter what level of development you're on, you're in the artisan area.

Right. You're using your command line a lot. it's so different in such a cool and good way.

Brian Coords: Yeah. And you definitely made me think of, like, I was thinking along the same lines of enterprise, like if you're using Pantheon or WordPress VIP, there actually is a lot more of a standardized practice that you would see. And like, if you've done one project, then you can probably more, you know, regularly understand the other projects and they do have a better, like CLI and all that sort of stuff.

You know, set up. And so you see it in there, but like you said, like, if you're a beginner Laravel, you're hopefully for the most part, going to be learning the same tips, tricks, and tools that the advanced Laravel, Laravel developer is going to use, and you're on that same journey. Whereas yeah, with WordPress, you might be, we're all on like very different journeys of like tooling.

Aurooba Ahmed: yeah, for sure. Cool. Okay.

Handling Build Assets in your Deployment
---

Aurooba Ahmed: So when you're developing, you have these three terminals running and then, you know, you've done all your work, everything's good to go, and then what's next?

Brian Coords: yeah. So. I think, you know, our kind of goal is to talk about deployment and getting this stuff on a server. And I think this part is important because, you generally don't in Laravel commit all of your built assets. So like with Blade and and Tailwind and, you know, just Sass and all these sorts of things happening, you know, that's why you have this Vite build process building on stuff, but you don't keep all that stuff in the repo because it's so hard to merge branches and stuff when you're dealing with like

built compiled assets. So in Laravel land, you deploy stuff to a server and that server generally needs to run all the composer, like installation stuff, get all of the dependencies installed in composer, get all the node dependencies involved, do your nodes, it's like, there's like this whole thing that has to happen every time you deploy to a server.

So it's a lot different than the WordPress space, most of the WordPress space. And so. Everything we're doing here kind of has to be a part of that deployment process because we had to rebuild the site once we put it onto the server.

Aurooba Ahmed: Okay. So yeah, it's a lot like Netlify, right? Like statically generated stuff where you went into a repo and then it's going to run that build process for you and then give you that static version on the server. Whereas in WordPress, it's expected that you're going to give it. The static itself, because I mean, technically you could do that in WordPress too if you wanted, but it's not as simple, right?

Like you could have like a repo that doesn't have build stuff and then run it through like a deployment workflow with another tool or something that then compiles everything and then puts it on the server. But that's not really very common in WordPress.

Brian Coords: I would say like the Roots Sage world of WordPress that is, I think, heavily influenced by the same thinking that influenced Laravel does do that. And so if you've ever done a site with them, like you do use composer and there is like WP Packagist and there are all these like movements to bring those sorts of things into it.

But I think most WordPress developers are probably just committing built- there's they're compiling their CSS. That goes into the repo or gets dragged onto a server. And there's not that like CI/CD mindset of like building things on the fly when you deploy. So it's a mindset shift.

Aurooba Ahmed: definitely. And just a, just a general workflow shift. I mean, it's a completely different way of going from development to deployment entirely. And there's no middle ground, you know, either you do it this way or you do it this way, there is no way where you're like, oh yeah, let me, let me ease into this process, there's really not, that's not really a thing.

Brian Coords: And it's, I think that tension that's always in WordPress of wanting to have modern advanced tooling, but also wanting to be super beginner friendly. And I think even hosting companies are kind of struggling with defining the best ways to do this sort of stuff. You know, you want to be able to just put files on a server.

And not think about this stuff, but, but this stuff really helps and it makes collaboration easier and it makes you know, the possibilities a lot better.

Aurooba Ahmed: yeah. Although I would say that there are parts of WordPress that are moving towards saying, hey, you know what, it's okay if we're not completely beginner friendly in all aspects of our development. So it's there, but yeah, that's not really like the default mode of WordPress. That's not, that's not the WordPress culture.

At least, up until now.

Deployment - Forge (and SpinupWP)
---

Brian Coords: So should we, should we deploy, should we go through the process of deploying

Aurooba Ahmed: Yeah, let's take a look at what that looks like here. How are you going to deploy this?

Brian Coords: So I'm going to use a tool that's pretty much the standard, I think, in Laravel. And it's, you know, comes from the same team behind Laravel. So it's really deeply integrated with a lot of the tools and stuff like that. It's pretty popular. This is called Laravel Forge, which I'm sharing on my screen right now.

That I am logged into Laravel Forge. It's a paid service, so you pay. Small monthly fee, they might have a free tier. But I think generally you need to pay for it, right?

Aurooba Ahmed: Right. I don't think there's a free tier.

Brian Coords: There might not be a free tier. That might be wishful thinking on my part. So, so do you, I feel like you know a lot about this sort of, it's like the approach where you have a tool that handles your deployment and you have a server that you buy from AWS digital ocean, you know, whatever. And you put those two tools together to deploy.

I feel like. You're probably more familiar with that mindset than me.

Aurooba Ahmed: Well, okay, very short story time, when I went to my very first WordCamp US, it was, that was WordCamp US 2019, and I was walking around in the sponsor hall, and there were a lot, there was a few different Forge like businesses that were advertising that were sponsors of WordCamp US. And one of them was SpinupWP.

And I walked up to them and I'm like, I don't understand what this is. Can you explain this to me? And I, I forget who it was, but he was so helpful. And he walked me through this whole concept, which was very novel to me at the time. Like I knew it, but I had never seen anyone really doing it in WordPress.

Until, you know, SpinupWP, which was at the time part of Delicious Brains. They're separate now, but yeah, like this whole concept of having a C Panel that is not a C Panel, right? We all know C Panel from our back in the day, early development years. Like you have a server, you install C Panel on it,

and that's sort of how you administer your server, create emails and FTP accounts and sites and install WordPress and all sorts of things. And this lets you do that with any server, but. In case, in the case of Spinup WP, it was specialized for WordPress itself. Forge first and foremost is specialized for Laravel.

Right. And yeah, this is like, in a lot of the cases, like you can connect a repo and have it have this administration sort of software, handle it for you and deploy it to the server and do a lot of things that like that Netlify does essentially, but for your own stuff without like a service. It can seem a little bit insane, I think, because you're like paying for a server and then you pay for the software and you're, you feel like you're paying for two different things.

But if you have a lot of sites or you need this kind of stuff, it actually is very helpful and cost effective in the long run. I

Brian Coords: Yeah, I was, I was going to ask you, like, why in the world of like good solid managed WordPress hosting, why would you want to have your own AWS server and your own deployment workflow and your own, like, why would you want to do all that in the world of managed WordPress? But I think you're right. Like it, it can be super cost effective and it really depends on the types of sites you're building and the types of things you're trying to do with those sites.

You know, how critical code changes and vers- you know, version control code changes are to your workflow.

Aurooba Ahmed: Yeah, definitely. I mean, I had a bunch of clients and literally all of these clients had three or four page websites only. They barely ever edited. And I had like, I think like. 18 of these clients and I put them all on a 5 digital ocean server connected to spin up WP and I never encountered any problems.

They never had any issues because they were just never resource heavy. But if I had the same thing going on, like, on a managed WordPress host, I would have to pay, like, 23, 24 per month per site. And here I was getting away with, like, 5 and, like, I think, like, I don't know, 18 or something a month or something.

And. Being able to charge like a regular ish but discounted hosting client price to my clients, win for them, win for me, is great. It is great.

Brian Coords: Yeah. So that's been fun to dig into. Like I've deployed a few Laravel things. I think if you have clients and stuff and you are saying, Oh man, this project, Laravel might be right for you. You do want to be a little more upfront with like. You will probably need to be paying for this deployment service and the server.

And, you know, there are a lot of like things you know, you like on a WordPress host, you can kind of trust that PHP Mailer will send some emails for you, maybe a little bit or whatever. But once you get into this world, like that's not going to be on the server. Like you need them, you need an email, transactional email API.

Like you need all these little pieces on top of it. Cause you are building it all yourself. You're not dealing with that managed situation. But if you want that control and. Can make it, like, price, like, affordable, then it's definitely worth it.

Aurooba Ahmed: Yeah. For sure. So, I think, SpinupWP was, I think, inspired by Forge, and I'm sure there's other, like, software like this, but I think Forge is now, like, it can even do WordPress, right? It's not just Laravel, and it does a lot of really cool things, like, it has this concept I'm seeing here in the menu bar of Circles, which I thought was, like, a really great way of doing teams and collaboration.

It's just, there's a lot of really great things about it.

Brian Coords: Yeah, I definitely know people who do it, who use it for WordPress. And so if you want that sort of like, composer centric, you know, workflow, it's definitely doable. So,

Connecting AWS to Forge
---

Brian Coords: I have one server in this account that is basically, I have an AWS account. I, you know, paid for a server. It's overall pretty cheap, you know, like to host on AWS.

I think it's, it can be pretty cost effective. And what I've done here is I basically told Forge, here's my AWS server. You've got to go through the whole, like, IAM User song and dance, like credentials, groups, permissions, whatever. Like it. It's something that you will not do it right the first time you will like, it, it's taking me like, you know, five plus sites to get to a place where I'm like, okay, I can connect AWS to forge quickly.

But we connect that and we basically have the server and then I can dig into that server by clicking on it. I called our server view source and I see a little Amazon logo. And inside of that server, I can now add as many sites as I want to that server based on, you know, how much bandwidth I want to use and that sort of thing.

And so I have one site that I've launched to this server.

Aurooba Ahmed: Right. Okay. Yeah. So I see this is just view source FM as a site in that table.

Brian Coords: Mm hmm.

Aurooba Ahmed: And there's a lot of like, server related settings as well. But you can see that it's connected to that repo. Yeah,

Brian Coords: Yeah. And so I connected this, like, you basically kind of traditionally going to start with like a repo as the basis. So, you know, one thing we could do is we could connect, like, you can see here that I'm connected to the main branch, but we could on the same server, make a staging version of it to test our changes and connect that to a different branch so that when we push changes to, you know, a developed branch they go to that other, that other site sitting on the same server, for example.

Aurooba Ahmed: Right. And, but you could still, like, keep a connection to the same database. So that you still have all the same information, stuff like that. Right.

Brian Coords: Yeah. So when you connect and once you've connected it to, to AWS, like it, when you add a new, when you start a new site, it handles everything like picking like the VPC and like the server and the database and all that stuff. And you can customize it, but it's going to make all of those assets and it's going to install NGINX and it's going to install like all the different things.

It's going to do all that work for you. And so it's super seamless and yeah, you can, then you can say like, I want to point this to a different database. I can also like remote into the databases from here by adding credentials, all that sort of stuff.

Aurooba Ahmed: So for the most part, once you've connected to AWS or wherever your server lives, you don't really have to go in there for the most part, right? You just handle what you need from here.

Brian Coords: Yeah, I don't think I've logged back into AWS since on any of the sites. Yeah.

Aurooba Ahmed: Yeah, yeah, that makes sense. Okay, cool. And I mean, I'm seeing a lot of really cool things here. Some that are probably like more Laravel specific, right? Like scheduler and, uh, stuff, but there's like SSH keys and database, like a lot of different settings that you can use and configure for your server.

Brian Coords: Yeah. So there's a lot of things you can go kind of like deep down it. Like if you're a, a server y kind of person, you can like. You can make changes to the type of database and all that sort of stuff. There's a lot of stuff built in you know, change your PHP version, all that stuff. But then you can click on the site and you get sort of a, a deeper dive for that specific site.

And some of the things you can change there.

Aurooba Ahmed: Nice. Okay. So

Automated Git Deployments
---

Aurooba Ahmed: what is happening here? Can you show us what it looks like? When you push something to the repo, what is set up to happen here in order to deploy that change to the server?

Brian Coords: Yeah. So we have a little deployments tab. So I'm going to click on that. I'm going to scroll down and what we're basically, there's a few things. One is that we have what's called quick deploy, which basically says like, watch for changes on this branch. If the brand, if someone pushes to the branch, just deployed automatic.

And so we, we have that set up for the main branch and then you have, and this is something that is more common in, like you said, like the Netlify world is that deployment script, which is once I pushed to the branch, run some commands for me. And so in this case you can see here, like PHP artisan migrate, like run all my migrations.

Did I, did the, were there new tables added since the last time I pushed? Like modify those tables, add those tables. And then this one, people have different opinions on, but then I do an NPM install and a NPM run build to build all of those assets with Vite.

Aurooba Ahmed: What are the different opinions like on what exactly?

Brian Coords: So like sometime in the last, I like, I would love somebody to like explain this to like. I think the base package changed where you used to not have to do that because I think it was committing the compiled resources, but sometime during version 10 of Laravel that changed and it wasn't happening. So I kind of went down the rabbit hole and some people were like, I just commit all my built assets and other people were like, no, I just run NPM on the server because node is available and just build it then.

And I kind of liked that approach better. But it didn't use to be the case. It used to be the case that you committed your built assets.

Aurooba Ahmed: Yeah. I mean, I learned about deployment scripts through the world of Jamstack through Netlify. So it's, to me, it's, it's very common. It makes a lot of sense that you would run npm install as part of your script instead of committing anything. So. Yeah, that makes a lot of sense. Cool, so this is running every single time you push something right now, because you do have Quick Deploy turned on.

Brian Coords: Yeah, and since, you know, we obviously do our work in a branch and then we try, so like you do have to be aware that like, don't just sit there pushing things to main all day, like we're going to branch, you know, if this was a live site and people were like logged in, it would not be a great experience if every five minutes, like composer was like checking for new dependencies, installing them, you know what I mean?

Like, so, you know, that sort of stuff definitely, pay attention to that. But once you do, you can actually go down so you can see like all the deployments that happened. You can see where I actually did do like a couple pushes this morning. Cause I was trying to get out fast, but it wasn't live.

So I didn't feel as bad, but you can actually see the full console output of everything that it did too.

Aurooba Ahmed: Nice. And it's quite pretty, and very readable, which I appreciate.

Brian Coords: like what commits were pushed what physical files are actually changed. Were there any new packages that need to be

Aurooba Ahmed: Mm hmm.

Brian Coords: any migrations that needed to be run? And then, and then it runs that build process for you and kind of does all of that.

Aurooba Ahmed: Nice. So if there was any errors or any issues, it'd be really easy to pinpoint them in that log, which is really nice.

Brian Coords: Yeah. And if you do have issues there's actually a command, like you can, I think there's like a commands tab where you can come in and you can basically run. Any command line commands directly from here. You don't like, you don't have to SSH into the server and like fix things. You can kind of be like, okay, run this command for me real quick.

And,

Aurooba Ahmed: That's awesome.

Brian Coords: and it gives you the same thing, like the full output log and everything. It's really nice.

Git vs SFTP in Managed WordPress Hosting
---

Aurooba Ahmed: That is really nice. I mean, this is definitely a little bit more advanced feeling than Spinup WP, but Spinup WP has a lot of the same concepts, but it is WordPress, WordPress first. So, it's cool. You know this makes me, a process like this, using something like this makes having a good Like CI/CD, like continuous integration workflow, really important, you know, doing pull requests and having different branches and having good commit messages, all of it sort of, you know, waterfalls into helping you create something that is easy to track and collaborate on, whereas when you are the, in the world of just popping a file on an SFTP, I mean, it's not great for collaboration, but it's also doesn't require like a very great, Rigorous or specific, you know, or clean, figured out workflow.

So it's very organized and it requires you to be organized for it to work effectively. So, it sort of brings it upon you and forces it on you in a good way.

Brian Coords: And I think a lot of WordPress managed hosts are sort of bringing in a bit of this experience, but I think forge is like clearly the most robust, like in terms of just full featured and like fully realized as a concept. Because you're at like, sometimes, you know, you end up that situation like, okay, now I have Git on my Siteground account or whatever, but like, it's not quite the same because you can't really, it's really hard to track like who pushed what, did somebody go in and just change it anyway, did, you know, did somebody go in the file editor and change it?

You go to push and it says, Oh, you're missing something that somebody pushed, but they didn't push it to the- they didn't push it to GitHub. They only pushed it that, you know, all these ways it can go wrong and everything. And there's no clear sort of history of what happened. And once it does go wrong, you're like, where's those SFTP credentials?

Cause I need to fix it. You know? So it's really nice. Like that. Everything is like centralized. This is the way to do it. Everyone's doing it the same way. Once, you know, if you're doing commits, I would see your history here. I would see, you know, all those things I could roll it back. It would undo the database changes.

Like all that stuff is just. It's really built for that, like collaboration piece.

Aurooba Ahmed: Yeah, definitely. And, you know, like, I've used Netlify a lot, but this is even more advanced than the administration panel of Netlify. Like, it provides a lot more information from a, like a developer experience perspective, like that console log being there and how nice it is to look at. So I would say that yeah.

I knew Forge and I'd played around with it a little bit. I've used it a little bit, but in like you creating this whole thing and then walking through it with us like here, I'm even more impressed with just how robust it is.

Brian Coords: You know, just like thinking about this whole process of, of going through Laravel and comparing it to WordPress obviously like if you're dealing with like massive content management, WordPress, you know, in the block editor and stuff is just, you know, it's a completely different use case and like a world of like

stuff that's great.

Other cool things like queues
---

Brian Coords: But there was so many things in this, like, fitting this into four episodes that we did not even get to get into. Like somebody mentioned to us jobs and queues and the way you queue up tasks and stuff

Aurooba Ahmed: Shout out to Sean.

Brian Coords: yeah, it was, I, when he said, I was like, Oh, I knew, cause like, that is, that was, I think for me, the, the biggest mind like blowing thing where you were like, Oh, I can like not do everything right now.

I can stack it up in a queue and have PHP workers just like taking care of it and logging it for me. And, and like, I can just stack actions up and, and, and then throw extra resources at them and it's not dealing with WP cron and it's weird, like you're really irregular, like reliability and stuff. I mean, there's

Aurooba Ahmed: And how you can like. Fine tune it, right? You can control it. So finally, there was a project that you and I did where we have to use the workers and set up those jobs. And I remember thinking, you know, this is so much nicer than doing it inside WordPress. Like, it's there's so much more control here without, like, digging really deep, you know. Like, that control is

it's been surfaced up to the highest level so that you don't have any, it's anyone can do it if they understand it a little bit. And I really appreciate that. I think that's like my whole biggest takeaway from Laravel, you know, things that are complex. are complex, but the ability to manipulate them has been abstracted just enough so that they're clean, easy to understand and accessible at the highest level, which sometimes is not the case in a lot of frameworks, including sometimes WordPress.

Brian Coords: And I think like to give a, like a specific example, I was thinking like, let's say you're building a plugin and you need it to export a whole bunch of stuff into like some huge file, but it's going to take like a while to do it. It's not just going to happen quickly. And you want to tell your user, like, it's a common thing, you know.

Generate this and we'll let you know when it's ready, you know, like don't do it now, but put it in the list to do. Like those sorts of actions and stuff like that things that are like really complicated, like you said, and really resource heavy or, you know, really nitty gritty and stuff like it just.

It's just a different, it's just a different place to put your head in and it's really been hard to like context shift back and forth from WordPress to Laravel because you're like, I know how to do this here, but I don't know how to do it here and vice versa and stuff. But,

Aurooba Ahmed: Yeah. Oh, this was so easy here. And why isn't this so easy here?

Brian Coords: yeah,

Aurooba Ahmed: Yeah,

Brian Coords: I feel, do you feel like we learned? Do you feel like we did a good? Laravel deep dive.

Final Thoughts
---

Aurooba Ahmed: I think if I'd call it a deep dive, I think it's more like we, we covered a lot of those things that make Laravel good and interesting. And I think for me, the most valuable thing has been reflecting on how that compares to WordPress, you know, and the way it has made me think about, okay, so sure.

WordPress doesn't do this now, but what could we do that is like this within the WordPress paradigm, perhaps? You know, how can we provide that kind of ease without like changing the WordPress culture? There's really great, lots of great things about like how we do things in WordPress too, but there's so much goodness, I think, to be learned from Laravel specifically, you know?

So, like, what do you think? What is your takeaway?

Brian Coords: yeah, I think what I really appreciate about WordPress is it's been leaning very heavily into the user experience side of, you know, with just the block editor and the admin redesign and, you know, some of the things that are getting kind of like more attention nowadays. But I think most people would agree, like developer experience is not like a super high priority.

Whereas in Laravel there, this is all about developer experience. Like that's, everything is, the whole thing is geared towards being great for developers, but it's then on you. And I was, I kind of run into this a lot with my projects, like it's on you to actually think about user experience. And like, you have, you can't just rely on, you know, WordPress sometimes gives you a lot of UI off the bat that Laravel doesn't.

And it's very easy to make a bad, inaccessible clunky UI in Laravel. And I do feel like I see that a lot, like people who are strong developers, but there's no sense of user experience. And so I think that's the biggest takeaway for me is like, I love how far it's leaned into developer experience, but you really have to bring your UX chops.

And on WordPress, it's the user experience with block editor is getting really good. And I'm hopeful that we'll start seeing people contribute more to the developer experience and we'll start seeing some of those best practices for you know, modern quote WordPress emerge over, over the future and people are doing it.

So I think it's coming.

Aurooba Ahmed: Yeah, you know, it is unfortunate. I think that this is a common issue with many frameworks that are either really great at user experience or really, really good at developer experience. And it's very, it's not as common to find like a good balance between the two. Although I would argue that there was a time in WordPress where that balance did exist, but as things got more complex, They had, they had, they shifted a lot and they leaned a lot towards that user experience, but I also think you're right.

There's a lot of hope and a lot of like people, like outspoken people talking about how DX needs to be better in WordPress. So I think over time we should hopefully at least balance it out a little bit more, if not perfectly. Yeah. But, you know, this has been really awesome and, you know, suggest.viewsource.Fm is available if y'all want to register and like, give us actual suggestions in there.

Brian Coords: Yeah, that actually makes me think I bet you that there's a really simple Slack integration that's already supported by Laravel. And so maybe my homework after this will be, I'll put a Slack integration so that if we do get a suggestion, we'll actually know about it.

Aurooba Ahmed: Yeah. I think that would be awesome. So please, if you have ideas, we'd love to see them in the suggest. viewsource. fm application that Brian has built for us. And hopefully you found this series as interesting and fun as we have.

Brian Coords: And all of the code is available on GitHub and I welcome any Laravel pros to point out any any the, you know, amateur mistakes since Laravel is not my first language.

Aurooba Ahmed: definitely. All right, well I guess Brian, I'll see you in the next episode. This is the official end of our Laravel series, right

Brian Coords: Yeah. And what comes next is a mystery to all of us. So see you next time.

Aurooba Ahmed: See ya.

Brian Coords: Bye.

Aurooba Ahmed: Bye.

Visit viewSource.fm for the show notes and if you're enjoying the show, we would love a review on iTunes or a comment on YouTube.

Creators and Guests

Aurooba Ahmed
Host
Aurooba Ahmed
(she/her) Developer building bespoke #WordPress solutions, tools, and blocks. My name is pronounced "oo-ROO-ba" — Default to kindness, folks.
Brian Coords
Host
Brian Coords
WordPress developer and writer blah blah
Modern Deployment for Laravel and WordPress
Broadcast by