A small project to test out Slim framework
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
logs order mapping done Feb 16, 2019
public Updated logger format Feb 4, 2019
src order mapping done Feb 16, 2019
.gitignore init composer & slim-skeleton Jan 31, 2019
.ini logger works with mvc for one call Jan 31, 2019
README.md updated readme Feb 4, 2019
composer.json logger works in router.php Jan 31, 2019
composer.lock init composer & slim-skeleton Jan 31, 2019

README.md

slim-api

A simple CRUD API project using Slim framework. This is a restaurant - supplier platform. It helps connect new and emerging restaurants and suppliers to discover each other in a wide network of the food industry.

Functions

A user can register as a restaurant or a supplier. A supplier can sell his products on the platform. A restaurant can buy products from suppliers by searching for the product he needs, and sorting by price from multiple suppliers by placing an order spcifying the quantity of product he needs. Placed orders can be viewed for checking its status.

Database

user

id email password name address website phone type

Composite Key : id, email

status

id status

Primary Key : id

product

id name description

Primary Key : id

stock

id user_id product_id price

Primary Key : id

Foreign Keys : user_id (user), product_id (product)

order

id restaurant_id supplier_id product_id units rate status_id

Primary Key : id

Foreign Keys : restaurant_id (user), supplier_id (user), product_id (product), status_id (status)

Project Structure and Flow

Index -> Router -> Controller -> Delegate -> DAO -> Database

Routes

User Routes

  • GET /users to get all users of both types.

  • GET /users/{id} to get a user by user ID.

  • POST /users/email to get a user by email ID.

  • POST /users to create a user.

  • PUT /users/{id} to update a user by user ID.

  • DELETE /users/{id} to delete a user by user ID.

Status Routes

  • GET /statuses to get all statuses.

  • GET /statuses/{id} to get a status by status ID.

  • POST /statuses to create a status.

  • PUT /statuses/{id} to update a status by status ID.

  • DELETE /statuses/{id} to delete a status by status ID.

Product Routes

  • GET /products to get all products.

  • GET /products/{id} to get a product by product ID.

  • POST /products to create a product.

  • PUT /products/{id} to update a product by product ID.

  • DELETE /products/{id} to delete a product by product ID.

Stock Routes

  • GET /stock[?sort=column] to get all stock of all suppliers. Optional : sort by column.

  • GET /stock/{pid}[?sort=column] to get a stock by product ID (pid) of all suppliers. Optional : sort by column.

  • GET /users/{uid}/stock[?sort=column] to get all stock of a supplier by user ID (uid). Optional : sort by column.

  • GET /users/{uid}/stock/{pid} to get a stock by product ID (pid) of a supplier by user ID (uid).

  • POST /users/{uid}/stock to create a stock for a supplier by user ID (uid).

  • PUT /stock/{id} to update a stock by stock ID.

  • DELETE /stock/{id} to delete a stock by stock ID.

Order Routes

  • GET /orders[?sort=column] to get all orders. Optional : sort by column.

  • GET /users/{uid}/orders[?sort=column] to get all orders of a user by user ID (uid). Optional : sort by column.

  • GET /orders/{id} to get an order by order ID.

  • POST /orders to create an order.

  • PUT /orders/{id} to update an order by order ID.

  • DELETE /orders/{id} to delete an order by order ID.