dukenst2006 / php-challenge

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PHP Challenge - API + SPA App

Technologies used

Laravel 8.73, laravel passport 10.2, vue 2.6.12, vue-router 3.5.1, vuex 3.6.2, Bootstrap 4.

Prerequisites

 - PHP version >= 8.0 (php -v).
 - Composer installed.
 - npm installled.   

Features

  • Frontend (SPA) built with [Bootstrap] (login, Customers listing with pagination, custumer details etc..)
  • OAuth2 authentication implementation using laravel passport
  • Command to import all customers from customers.csv
  • Job to get customer latitude & longitude base on address using Google Maps API
  • API Documentation & testing /api/docs
  • PHPUnit test for all features.

How to Install

  • Clone the project under your web server's root directory using git or Download (as zip) and extract.

    $ git clone https://github.com/dukenst2006/php-challenge.git
    • Install dependencies with Composer :
    $ composer install
  • Create a file .env using .env.example. Update the files - set app url, database connection, passport details like client_id & client_secret and GOOGLE_MAPS_API_KEY.

 $ cp .env.example .env 
  • Run php artisan key:generate

  • Create two databases one for app (e.g api) and one for app testing (e.g api_testing).

  • Install front-end dependencies with npm:

    $ npm install && npm run dev
  • Run php artisan migrate --seed, this will create a user for testing. You can use email: test@gmail.com, pwd: secret

  • Run php artisan passport:install. Note Client ID & Client secret provided. it will required to get API authorizations from /api/docs endpoint

  • Run php artisan import-customers:csv to import customers from customers.csv file. NB: latitude & longitude will be fill from Google map API

  • To run the tests use:

    $ php artisan test

    Make sure update the .env.testing file

DEMO

  • SPA Demo SPA Demo

  • Import customers commande Import customers

  • API Documentation (/api/docs) API Documentation

About


Languages

Language:PHP 75.6%Language:Blade 12.1%Language:Vue 11.6%Language:Shell 0.7%