Setting up Laravel Spark for local development

Scott Anderson
May 27 · 2 min read
Image for post
Image for post

Spark is a Laravel package that provides scaffolding for a SaaS application and includes billing, subscriptions, authentication, payment, etc.

The instructions below are for setting up a Laravel Spark application (Spark v10.0) for local development on MacOS.

I’m assuming the following:

  • you already have a local development environment suitable for running Laravel applications. For more information check out the Laravel docs
  • you have purchased a licence and have received your token

Before we start, ensure you are running PHP 7.3
At time of writing (May, 2020) the Spark installer fails on PHP 7.4.

1. Install or upgrade the Laravel Installer

composer global require laravel/installer

Ensure you have >= 2.3.0 of the Laravel Installer installed.

2. Install the Spark Installer

git clone https://github.com/laravel/spark-installer.git

Change into the spark-installer directory and run composer install

Next, add the Spark Installer directory to your PATH

export PATH=$PATH:/path/to/spark-installer

3. Run the Spark Installer

Add your token (from purchasing a Spark licence)

spark register <<token>>

Next, run the Spark installer
Note: it will create a new directory in whatever location you run the command

spark new <<project name>>

4. Configure application settings

Edit your .env file and add your projects settings, especially DB credentials.

Then, run the Spark migrations

php artisan migrate

As per the Spark docs, link the storage directory with

php artisan storage:link

You should now be able to load the site in your browser!

5. Accessing the developer “Kiosk” area of the site

Edit the app/Providers/SparkServiceProvider.php file and add your email address to the $developers array.

Then, use the Register feature on the site to create an account, with that same email address.

E.g. https://local-spark-domain.com/register

Once this account has been created you’ll be able to see the Kiosk option on the top right menu under your Profile name.

Image for post
Image for post

Note: You can find all the Spark URLs via the routes file spark/src/Http/routes.php

More Spark tutorials

Setting up Stripe plans and Spark billing

Configuring email verification in Laravel Spark

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch

Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore

Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store