Code Monkey home page Code Monkey logo

candy-api's Introduction

Please Note
Whilst every effort has been made to make this software ready for a release, it is provided as is, this is very much still in early alpha stages and you use it at your own risk.

This is not production ready software

GetCandy E-Commerce API

A laravel way to build an API driven store online.

Requirements

  • Laravel >= 5.5
  • Elasticsearch >= 6

Server setup

We think the easiest way to get up and running is to use Valet+ with Elasticsearch. But really, it's up to you :)

Installing via composer

You can either install just the API or the API and Hub.

Just the API

This will contain everything you need to manage your store through the API endpoints.

composer require getcandy/candy-api

API and Hub (recommended)

This will install the API and the Hub, so you have a nice interface to manage your store.

composer require getcandy/candy-hub

Laravel 5.6

GetCandy supports package auto discovery

Laravel 5.5

Add the three required service providers to your config/app.php file

'providers' => [
  // ...
  
  GetCandy\Api\Providers\ApiServiceProvider::class,
  GetCandy\Api\Providers\EventServiceProvider::class,
  
  // If you have installed the hub, add this one
  GetCandy\Hub\Providers\HubServiceProvider::class
],

Publish the config / resources

The API needs to publish some config items and the hub needs to publish some resources (if you're using it)

php artisan vendor:publish --tag=config

// If using the hub
php artisan vendor:publish --tag=public

Set up your users

GetCandy doesn't have it's own User model, we figured you'd want your own, so we just use a trait:

use GetCandy\Api\Traits\HasCandy;

class User extends Authenticatable
{
    use HasCandy;

The API uses passport for authentication, so make sure your config/auth.php config uses this:

This will probably be refactored into it's own gate going forward, hangover from non package days...

'guards' => [
  // ...
  
  'api' => [
     'driver' => 'passport',
     'provider' => 'users',
   ]
]

Get things up and running

The API needs some bare minimum data to get going, for now we've just made a console command to get going:

php artisan candy:install

Follow the installation steps and you'll be able to log in and start adding products!

candy-api's People

Contributors

alecritson avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.