Image for post
Image for post

Installing GetCandy from scratch

This is a guide to get you up and running with GetCandy. I’m going to assume you know a thing or two about Laravel and setting up third-party packages.

Alec Ritson
Feb 5, 2019 · 3 min read

For this, I’ll be using Valet+ for my development machine, but you’re free to use whatever you want.

Initial Steps

So initially we want to install Laravel 5.7 and then pull in the API, we’ll worry about the Hub later.

laravel new online-store

Once that’s installed, we can then install the API.

cd online-store && composer require "getcandy/candy-api":"0.2.*"

Once done, publish the config.

php artisan vendor:publish --tag=config

Feel free to look through the getcandy.php config file, we will probably go into more detail about what’s in it in a later post.

Remember to set up your database

Migrations and Traits

Before we can use GetCandy we need to add the HasCandy trait to our user…

<?phpnamespace App;use GetCandy\Api\Core\Traits\HasCandy;
use Illuminate\Notifications\Notifiable;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Foundation\Auth\User as Authenticatable;
class User extends Authenticatable
use Notifiable, HasCandy;
* The attributes that are mass assignable.
* @var array
protected $fillable = [
'name', 'email', 'password',
* The attributes that should be hidden for arrays.
* @var array
protected $hidden = [
'password', 'remember_token',

Now we are ready to install, run the install command:

php artisan candy:install
Image for post
Image for post


GetCandy uses Passport to deal with authentication, we just need to tell Laravel we want to use it for API authentication, so in config/auth.php the guards should look like this:

'guards' => [  'web' => [    'driver' => 'session',    'provider' => 'users',  ],  'api' => [    'driver' => 'passport',    'provider' => 'users',  ],

Hooray! we have successfully installed GetCandy!

If you just want to use the API we’re all done, otherwise, we can also install the Hub to manage our store.

Installing the Hub

The Candy Hub provides a UI for you to manage all aspects of your store, it’s where you can care for your products, see your orders and build your categories, it’s a great tool and easy to install.

To get started, let's pull in the package:

composer require "getcandy/candy-hub":"0.2.0"

Once installed, we just need to publish the public resources, so we get some styling on the hub.

php artisan vendor:publish --tag=public

With that, just go to /hub and you should see the login screen.

Image for post
Image for post
GetCandy Login

Put the credentials you used when you went through the API installation and you should be able to log in. You will then be on the Dashboard page.

Image for post
Image for post
The GetCandy Hub Dashboard

Wrapping up

So we’ve managed to get the API installed and the Hub up and running, we’ll leave it here for now, but we will look at products, categories etc in more detail in another post. For now just feel free to click around and get a feel for it.

For issues & feedback:



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