Laravel Spark has a few requirements you should be aware of before installing:
Before installing Spark, make sure you have the latest version of Node and NPM. You can download a graphical installer for Node on the Node website.
The Vue.js JavaScript framework is utilized on the registration and settings pages; however, you are free to build the "bulk" of your application using the JavaScript framework of your choice, or no JavaScript framework at all.
Laravel Spark offers a convenient installer that will create a new Laravel application and install Spark in the directory of your choice. Before getting started, make sure you have the laravel/installer
package globally installed using Composer. You should make sure your version of the installer is >= 1.3.4
:
composer global require laravel/installer
Note: The Spark installer is only recommended for those on Mac or Linux systems. If you are using Windows, please install via Composer. Before using the Spark installer, make sure you have installed the Laravel installer.
First, clone the laravel/spark-installer
repository from GitHub into any location on your machine:
git clone -b 5.0 https://github.com/laravel/spark-installer
Then, run the composer install
command within the cloned directory so the installer's dependencies will be installed.
Next, make sure the spark-installer
directory is added to your systems $PATH
variable, so that your machine will be able to locate the spark
executable when you issue Spark commands.
Now that you have the Spark installer, you need to register your Spark API token with the installer. You may create an API token from the API settings dashboard. Once you have created a token, register it with the installer using the register
command:
spark register token-value
If you would like to view the currently registered token, you may use the token
command:
spark token
Once you have installed the Spark installer and registered your API token, you may create new Spark projects using the new
command:
spark new project-name
This command will create a new Laravel project in a directory matching the given project-name
. Spark will then be installed into the project and configured automatically.
Note: Once the new Spark project has been created, you will need to migrate your new project's database using the
php artisan migrate
Artisan command. If you are not using Homestead, you will also need to update your.env
file with your database credentials.
Once Spark is installed, you are ready to configure your application.
Spark provides a Satis repository which makes it simple to install Spark just like any other Composer package. First, make sure you have purchased a Spark license and joined the Spark GitHub repository.
Create a new Laravel project using the Laravel installer:
laravel new project-name
Next, add the following repository to your composer.json
file:
"repositories": [
{
"type": "composer",
"url": "https://spark-satis.laravel.com"
}
],
You should also add the following dependency to your composer.json
file's require
section:
"laravel/spark": "~5.0",
Next, you should add Cashier to your project. If you are using Stripe, you should use the laravel/cashier
package. If you are using Braintree, you should use the laravel/cashier-braintree
package:
"laravel/cashier": "~7.0"
// or...
"laravel/cashier-braintree": "~2.0"
Next, run the composer update
command. You may be prompted for a GitHub token in order to install the private Spark repository. Composer will provide a link where you can create this token. Once the dependencies are installed, add the following service providers to your app.php
configuration file:
Laravel\Spark\Providers\SparkServiceProvider::class,
Laravel\Cashier\CashierServiceProvider::class,
Next, run the spark:install --force
command:
php artisan spark:install --force
Once Spark is installed, add the following provider to your app.php
configuration file:
App\Providers\SparkServiceProvider::class,
Finally, you are ready to run the npm install
, npm run dev
, and php artisan migrate
commands. Once these commands have completed, you are ready to enjoy Spark!
Once Spark is installed, you should link the public/storage
directory to your storage/app/public
directory. Otherwise, user profile photos stored on the local disk will not be available:
php artisan storage:link
The default spark
command will generate a project that supports individual user plans and Stripe for credit card processing. However, you may also create projects that use team billing or Braintree as your payment processor.
spark new project-name --braintree
spark new project-name --team-billing
spark new project-name --team-billing --braintree