May 202512:0322.6k views

New Laravel starter kit (with built-in billing)

About

Laravel now ships with first- and third-party starter kits that make spinning up a full SaaS app faster than ever including billing, invoicing, and subscriptions. In this video, I walk through the new Chargebee-powered starter kit, show you how to get up and running in minutes, and explore some of the powerful billing tools available under the hood.

Transcript

Everything I said

00:00

Laravel has gone all in on starter kits, which I think is great. Starter kits are all the rage these days, and Laravel has decided, "Hey, what if we made a bunch of free ones?" Which is awesome. I've always thought Laravel's the best way to build a web application, and now with these starter kits, I think it's honestly the fastest way to build one as well. So if we look at, um, the three first-party starter kits that Laravel offers are React, View, and Livewire.

00:25

View is my favorite, but the React and View ones both use Inertia under the hood. Not only do they provide first-party starter kits, but they've made a way for you to start a project with a third-party starter kit. So they're not trying to lock you in here. And some of those third-party starter kits can include things like billing, invoicing, subscriptions, user management.

00:49

Let's take a look. I'll show you the full process in a second, but look, we already have a pricing button up here with a pricing grid. That is pretty great. Now, I'm gonna go ahead and register for this application. And remember, I have written zero lines of code. I've written zero lines of code here. Not a little bit of code, not some configuration.

01:10

Zero, nothing, nada. All right, so we are now here. Let's go to our dashboard. This is the standard, uh, Laravel starter kit application shell. But if I go down to Settings, and I come... There's now this tab here for billing. I can click Subscription. I do not have an active subscription, but, well, let's go ahead and subscribe.

01:31

Why not? It's a good application. So I'm immediately redirected out to this, uh, checkout page. Yep, that looks good. That is what I want to buy. And we'll just fill out some information, and because this is the internet, I don't know you people. 123 Main Street, good enough. And this is such a nice little affordance here. Because I am in test mode, it gives me these few cards.

01:54

I'm gonna choose the valid card and pay and subscribe. Remember, I have done nothing. So we're back here, um, and it says, "Hey, if you wanna customize this, you can. This is where you would go to do it." I do like the confetti, so we're just gonna go ahead and hit that a few more times. Man, that looks good. Okay, now back to Settings, and if we go to Subscription down here, you'll see.

02:17

Look, here is my subscription. I can update my payment method. I, I haven't, I haven't done any of this. So I can add a new card. I can change my primary card. I'm just gonna go back, or I could come down to Invoices, and look at this. Download invoice, and there is my invoice. Not bad. Not bad at all.

02:38

I love, uh, providing the users a way to download their own invoices, 'cause we get a lot of support requests that say, "Hey, can you send me an invoice?" And I'm just like, "Yeah, I guess. Like, you know you bought it. Why do you need an invoice?" But whatever. With this starter kit, they can download their own invoices. So what we're looking at here is a new Laravel starter kit that was written and is powered by the sponsor of today's video, Chargebee.

03:03

Chargebee is a billing and monetization platform built for fast-growing AI companies, enterprise, SaaS tools, for all kinds of things. It is a revenue management platform. We'll talk more about them in a little bit, but they have recently put out a new starter kit and a new Laravel cashier driver so that you can integrate, uh, Laravel Cashier into Chargebee.

03:28

So let me show you how we set up this starter kit, and then I'll show you a little bit behind the scenes of Chargebee. I have completely blown away that project, but that's okay. We're just gonna make a new one. Laravel new, and then this is the flag, um, that allows you to pick a starter kit. So we're gonna say using Chargebee/Laravel/React-starter-kit. So we will call this cb-demo, and it is doing a bunch of stuff, and after this runs, I'm gonna open up the composer.json and show you everything that's in there.

03:56

There's, there's really not a lot. There's not a whole lot in there. Um, there is a lot of stuff built into the actual application, but as far as, uh, packages, there's really not too many. So this is finishing up building. It looks like the whole front end is built, so we'll change into cb-demo, and we will open this in PhpStorm. And the key thing that we are looking for here is composer, json, and look at this.

04:23

Not a whole lot. Um, Inertia is required for, uh, the React-Laravel integration. This is the interesting thing, Chargebee Cashier. So Laravel Cashier is kind of like a, an abstraction over a bunch of different billing options, and Chargebee now has their own driver, which you can install as a package. Chargebee has their own driver for Cashier.

04:46

So you can use that nice, familiar interface that you know and love, but use Chargebee under the hood. And then Dompdf, uh, my guess is, and I haven't looked into this, but my guess is this is the way they're generating the PDFs of those invoices that we download. Okay, while it is true that I didn't write any code for the demo I showed you, I would never lie to you.

05:06

Um, I did have to paste in some environment variables. So I'm gonna grab these over here, and then we'll pop into our .env. And you can see they went ahead and added the names of those keys that are required, which is nice. That tells me what I need to do. So I'm gonna paste that in. You'll notice this says test underscore, so don't get any bright ideas. This isn't gonna get you anywhere.

05:26

Please don't steal my key. In fact, I'll go ahead and roll it. Um, and then my, uh, my store name is TryHard Studios Test, and then I'm just gonna say that this is user and pass. This is how I can validate the webhook. Doesn't super matter in local. So now that that is up, uh, now that that has been set up, let's go back to the browser.

05:48

You'll see I'm still logged in, but if I hit refresh, uh, since I blew away that whole database and everything, I'm now logged out. Now, if we come here and hit Pricing, we don't see anything, but we have this nice little command here that says, "Hey, uh, you haven't actually synced down your plans." So I'm gonna grab this, and then let's just... Yeah, that's fine there.

06:09

We'll clear that out. We are in cb-demo. So now, with any luck, we should be able to, um, fetch these plans. In fact, let's go ahead and do this. Let's do open database, database. Uh, I'm using SQLite 'cause we're just local, and we see we don't have any plans. And now if we went and we ran, I think it's still in my buffer. Great. We'll fetch those plans.

06:30

Boom, boom, boom, boom. There we go. So I didn't write any code. I did, uh, paste some environment variables and run a command, and now we're ready to go. I wanna show you in a second some of the power of the underlying cashier driver. So what we've been looking at is this starter kit, which we saw relies on that Chargebee cashier driver.

06:52

That driver itself is both thoroughly documented and very powerful. So you can drop down a level if you need to go from cashier down to the actual, you know, Chargebee SDK. You can do that through their package. I think, however, an interesting question to address at this point is, why would you choose Chargebee over many of the other options that are available for actually handling, uh, your billing?

07:17

Not just the starter kit, but actually handling your billing. I think Chargebee really excels in, um, making some of these complicated, uh, subscription models very simple. So whether that's, uh, an AI tool with usage-based billing or a SaaS tool where you're charging by the seat or by maybe an API request, Chargebee makes that stuff very, very easy.

07:40

It also makes it very easy to test new plans. So instead of, you know, taking a whole quarter to get some sort of pricing experiment going, with Chargebee, you can do that very quickly, and your accountants will love you. And you may be thinking, Aaron, you don't know anything about being an accountant. Oh, wait. Whoa, wait. Hang on. What is this?

08:01

What is this? Is this my CPA license? And, uh, am I an accountant? Turns out, uh, I used to be an accountant, and I don't... You know, we don't get to show this off very often. So in the state of Texas, I am a CPA, inactive because I don't practice anymore. But Chargebee has a lot of, like, revenue recognition built in, which if you're an accountant or have ever dealt with an accountant, you know that revenue recognition is a big deal, audit logs, compliance, all sorts of stuff built in that your business people, eh,

08:31

they're gonna kinda like. So check out Chargebee if you need, um, anything like that for your-- to power your billing, whether that is AI per seat, per API request, anything like that, or just a simple plan. Check out Chargebee for that. Let me show you some of the power of this cashier driver under the hood. We're looking here at the cashier Chargebee repo, which is inside the Chargebee organization.

08:55

Now, you scroll down here, you'll see, you know, it's very active, lots of commits, and you think, "Well, man, where's the documentation?" In fact, there's a huge amount of documentation, just a really tremendous amount of documentation, which is great. That's what we want. Okay, so starting at the top, you'll see something that you're familiar with. This is cashier, right?

09:15

This is saying the user is the billable model. You could change it to team if you want. You could set up a custom model. That's fine. Uh, environment variables, all of that stuff. Now, I think one of the interesting things is, well, first of all, you can create a customer without creating a subscription. So that's quite nice. You can do create as Chargebee customer, but if we scroll down just a little bit more, billing portal.

09:38

I love a billing portal. I love a billing portal. I love not writing billing code. As much as, as much as I always say you can just do things, sometimes you don't have to do things. You can just have somebody else host your billing portal. So I do like that. And then this to me, um, this to me is like a, it's kinda like a tell. This is like, hey, this is a serious, you know, this is a serious billing platform because you've got balances that you can burn down against, right?

10:03

So you can imagine topping up credits and then burning down against, um, those existing balances, or potentially, um, you're, you're working with a large enterprise and you have a purchase order, and then so you, then you go in and you manually update their balance based on some outside thing, and then they can burn down against that balance as it exists tracked by Chargebee.

10:25

So this to me shows they basically handle every scenario that you might be thinking of. And, uh, one other thing I want to show you is subscription trials. So here we have a couple of different ways to do trials, which I think is very important. I mentioned earlier that experimenting with billing is relatively easy, and we can do, uh, a subscription trial with payment upfront or a generic trial.

10:50

We can extend a trial. We can do all sorts of things with those trials, um, by just using these nice little affordances here. So there's a ton. I mean, we can just scroll up. We-- There's all kinds of stuff on here. The documentation here is, is very good. It's very thorough. It has all the stuff you would expect from Laravel Cashier, and then it has all the power that you might need, um, to drop down and do some more of that complex stuff.

11:15

And they have asked me to tell you if you find anything wonky in here or something that's like, "Well, that could be a little bit better. This is weird, isn't it?" They want you to send them an email. So you can send them an email at DX, for developer experience, dx@chargebee.com. We love a direct email. We love a direct email to voice our complaints with your, uh, Laravel package.

11:38

I think you're gonna like it, but if you find anything that's not done the Laravel way or it's a little bit wonky, write 'em an email. Write 'em an email. Tell 'em about the API. Tell 'em that you heard about it here. I would love that. Thank you to Chargebee for sponsoring this video. Y'all go check it out. Um, we'll leave some links down in the description below to where you can find all of this stuff. But until the next time, see ya.

Laravel & PHP

More videos on Laravel & PHP

All videos

Get the next one by email

I’ll send you some more. Not too many.

Join 7,500+ other readers.

Read past issues