
This week we will try to explore Laravel Spark. The main goal of Laravel Spark is in building out business oriented SaaS applications. It has features like user roles, team management, recurring billing through Stripe and many more. If you have developed a team management and a billing system manually you would know how much time it consumes. But by using Spark it is so easy it takes care of all the designing and invoice creation process. Even though it has been commercialised it is worth buying which makes us focus a lot on our business.
There are two ways to install one by using a installer and other by a manual process .
We will now see the implementation part. Before installing we need to know the few requirements of Laravel Spark.
* Laravel Framework 5.2
* Laravel Elixir
* Composer
* Bootstrap 3
Spark uses vue.js a Javascript Framework on the registration and setting page. But it is our choice do we use the framework or not. We can install using a installer by downloading the Spark Installer. Laravel Spark has a very handy installer which will create a new Larval application and installs the Spark in the directory which we chose.
Note: Care must be taken to install Laravel installer before we go for a Spark installer.
First we need to clone the Laravel/spark-installer repository from GitHub to any location in our machine. Once we have cloned the installer we must make sure to run the composer install command within the cloned directory so that all the dependencies get installed automatically.
Note: Care must be taken to add the spark-installer directory to the system $PATH variable to locate the Spark executable file.
Registering our API token
We can create an API token from the settings dashboard which can be used with the installer using register command
spark register token-value
To view the currently registered token, we can use
spark token
Creating a Spark Project
We can easily create a Spark project once we have installed the Spark installer and registered our API token using the below command
spark new project_name
The above command creates a Laravel project with the given project_name. Spark gets installed and configured automatically.
Note: We need to do the database migration with php artisan migrate command.
Once all the above task is done we can start configuring our application.
Manual Download Method
We can Manually also configure the same using the “ZIP” archive.
Step 1 : Extract the content of the zip and place it into our project root directory.
Step 2 : Add spark directory as repository to our projects composer.json file.
Step 3 : Add laravel/spark requirement to your composer.json file
Step 4 : Run composer update command so that all the dependencies will get installed
Step 5 : Add LaravelSparkProvidersSparkServiceProvider class to our app.php configuration
file.
Step 6 : Run spark:install in the command prompt
Step 7 : Add the below service providers to our app.php configuration file
Note: Care must be taken to install npm, gulp, and php artisan migrate commands.
Hope this blog has given you a basic Idea on what Laravel Spark is and how to install it. we will come back with a more interesting blog in the upcoming weeks.