SBSC PHP Developer Code Test

Prerequiste

  • PHP 7
  • Composer
  • MySQL

Technologies used

Modern PHP technologies were adopted for this project

Laravel: Laravel is a web application framework with expressive, elegant syntax. We’ve already laid the foundation — freeing you to create without sweating the small things. Visit here for more information.

Mysql - Relational Database System used in project.

JWT - used to authorize and authenticate API routes.

Gmail - Email SMTP client that enable you to send emails.

Installation

Step 1.

  • Begin by cloning this repository to your machine
git clone https://github.com/samson1998/sbsctest.git
  • Install dependencies
cd name && composer install
  • Create enviromental file and variables
cp .env.example .env
  • Generate app key
php artisan key:generate

Step 2

  • Next, create a new database and reference its name and username/password in the projects .env file. Below the database name is "expanse"
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=sbsctest
DB_USERNAME=root
DB_PASSWORD=
  • Go to your mailgun account and get your mailgun domain and secret key. choose an email and senders name
MAILGUN_DOMAIN=****
MAILGUN_SECRET=****
MAIL_FROM_ADDRESS=***@***.com
MAIL_FROM_NAME=*****

Step 3

  • To start the server, run the command below
$ php artisan serve

API Routes

API documentation was created using POSTMAN and can be viewed at https://documenter.getpostman.com/view/11352997/T1DjkfEH

HTTP VERBENDPOINTFUNCTIONALITY
POST /api/auth/register Creates a user
POST /api/auth/login Login a user
POST /api/auth/logout User logout
POST /api/password/email Forgot Password
POST /api/password/reset Reset Password
POST /api/categories Create a category
POST /api/categories Get list of all categories
GET /api/categories/{id} View a particular category
DELETE /api/categories/{id} Delete a particular category
PUT /api/categories/{id} Update a particular category
POST /api/products Create a product
POST /api/products Get list of all products
GET /api/products/{id} View a particular product
DELETE /api/products/{id} Delete a particular product
PUT /api/products/{id} Update a particular product
POST /api/factoryProducts Generate 50 products with Faker
GET /api/exportCSV Export to CSV
GET /api/exportPDF Export to PDF
GET /api/factorial Get the factorial of 13
POST /api/searchinsert Search and insert indexes
POST /api/sortstates Sort Nigeria states
POST /api/groupanagrams Search and insert indexes