Categories
Laravel Samuel

Installing Laravel Spark on a new Project

These are mainly just notes copied from laravel docs. Just wanted them in this specific order so when I came looking back at them I could follow them easier:

First, download the Laravel installer using Composer:

composer global require "laravel/installer"

Make sure to place the ~/.composer/vendor/bin directory (or the equivalent directory for your OS) in your PATH so the laravel executable can be located by your system.

Next install a fresh new laravel project:

laravel new project-name

Next, add the following repository to your composer.json file:


"repositories": [
{
"type": "composer",
"url": "https://spark-satis.laravel.com"
}
],

Note: don’t add this at the bottom of the file, put it right under the require-dev section.

You should also add the following dependencies to your composer.json file’s require section:


"laravel/spark": "~1.0",
"laravel/cashier": "~6.0"

Next run the composer update command. This will add all the dependencies and clone in spark. Also note you will have to add a github token, which is stored in: C:/Users/computer-user-name/AppData/Roaming/Composer/auth.json

**Note you need to link laravel spark with your github account, and join the repo before composer will have access to clone it into your project**

Next add 2 providers to the confing/app.php file:

Laravel\Spark\Providers\SparkServiceProvider::class,
Laravel\Cashier\CashierServiceProvider::class,

Next run the spark install command:
php artisan spark:install --force
**note you must add the 2 providers into the ‘providers’ => [ section on line 124

After spark has successfully installed add the following provider to the config/app.php file again in the providers section:

App\Providers\SparkServiceProvider::class,

Now we are ready to run the DB migrations. If you get the @homestead error just update the .env file to use your local db creds.