The Series – Table of Contents
Update (2017-05-12): I no longer endorse Spark to quite the same extent, and have realised that it has various shortcomings, and have not myself used Spark since the release of version 2.0
This is the first in a series of blog posts about Laravel Spark. Content may be added and removed throughout, and the table of contents above is merely a rough plan of what I hope to publish.
What is Spark?
Spark provides the perfect starting point for your next big idea. Forget all the boilerplate and focus on what matters: your application.
Before anyone thinks anything – Spark is not meant to be an app, it’s not meant to be an all-fulfilling package, it’s meant as a boilerplate. Spark provides you with the foundation for a general SaaS; it gives you user and team billing, subscription plans, teams, and a lot more. Above anything else, however, Spark provides scaffolding. As soon as you type
spark new idea, it will lay the foundation for a SaaS for you.
“Should I use Spark?”
Well, maybe, maybe not. Make no mistake, Spark is heavily opinionated towards a certain type of platform. It does not feature any advanced multi-tenancy with multiple levels of teams (akin to how GitHub works), and a guide for setting it up easily is yet to surface. In it’s base install, a user belonging can either create a team or they can’t, and you can create lots of teams. You can’t create a team within a team, and limit those, or have a user be organisation-bound rather than platform-bound (a good example of the two would be GitHub, where you have a GitHub account, and are part of multiple organisations, and Slack, where you have one account per team). Of course, this is never advertised as something that would be feature, but a few people have requested a way to easily implement this over at the Larachat Slack.
However, Spark is very customisable, but do keep in mind it might not be suitable for every project you will build. Now, Spark does have a lot out of the box; it features team invites, role management and team-specific registrations. It comes with a well-written backend and frontend, and although parts might need customisation, that is only to be expected with something that only provides you boilerplate. It would have been nice to have a useful trait or middleware for multi-tenancy that could just be used, but that part is also not terribly difficult. In fact, to make it easier, Brian Dillingham wrote a plug-and-play trait which he was kind enough to put in a Gist to be used by anyone.
Now, if you visit the Spark website and think to yourself >Gee, that’s not quite the platform I’ve envisioned, I’ll have to change a lot.
Then by all means, don’t use Spark, but also keep in mind a lot of it can be customised.
If you would like to read more about multi-tenancy in Spark, check out my old article from the alpha days, a lot of it still applies.
Getting started with Spark
Okay, so you’ve decided Spark is the way to go for your app, and you want to get started. Of course, the first thing to do is to sign up for Spark over at the website. Once that’s all done, you’ll have to buy a license ($99 for a single-site license or $299 for an unlimited license) to get access to the code (you can create as many Spark projects as you want even with a single-site license, but it’s only valid for publishing one application). From that point on, just follow the instructions for the Spark Installer.
When you’ve got your token registered, fire up your terminal and navigate your way to the directory where you want your project. After that, simply execute
spark new project-name, set up the database as you would a normal Laravel application, run the migrations, and treat yourself to something nice, because you just set up Spark.
Where to go from here
This is not meant as a tutorial for setting up Spark and working with it. For that, I wholeheartedly recommend the Laracasts series.
There have been quite a few comments on the lack of a clear way to integrate a multi-level team structure, and I will agree that I believe this use case should have been taken into more consideration, as it is a fairly common structure. However, all things considered, Spark is a well-rounded product, albeit largely opinionated.