Skip to content

Laravel Advanced CRUD API Architecture for Small to Big Project.

Notifications You must be signed in to change notification settings

amarildomgl/Laravel-Advanced-CRUD-API

 
 

Repository files navigation

Laravel CRUD API with Auth

Basic Laravel CRUD API application included with Authentication Module & Product Module. It's included with JWT authentication and Swagger API format.


Language & Framework Used:

  1. PHP
  2. Laravel

Architecture Used:

  1. Interface-Repository Pattern
  2. Model Based Eloquent Query
  3. Swagger API Documentation - https://github.com/DarkaOnLine/L5-Swagger
  4. JWT Auth - https://github.com/tymondesigns/jwt-auth

API List:

Authentication Module
  1. Register User API with Token
  2. Login API with Token
  3. Authenticated User Profile
  4. Refresh Data
  5. Logout
Product Module
  1. Product List
  2. Product List [Public]
  3. Create Product
  4. Edit Product
  5. View Product
  6. Delete Product

How to Run:

  1. Clone Project -
git clone https://github.com/ManiruzzamanAkash/Laravel-Basic-CRUD-API.git
  1. Go to the project drectory by cd Laravel-Basic-CRUD-API & Run the
  2. Create .env file & Copy .env.example file to .env file
  3. Create a database called - laravel_basic_crud.
  4. Now migrate and seed database to complete whole project setup by running this-
php artisan migrate:refresh --seed

It will create 21 Users and 103 Dummy Products. 5. Run the server -

php artisan serve
  1. Open Browser - http://127.0.0.1:8000 & go to API Documentation - http://127.0.0.1:8000/api/documentation
  2. You'll see a Swagger Panel.

Procedure

  1. First Login with the given credential or any other user credential
  2. Set bearer token to Swagger Header or Post Header as Authentication
  3. Hit Any API, You can also hit any API, before authorization header data set to see the effects.

Demo

API List Views:

1-Swagger-API-Demo

Login in Swagger with Given Data:

2-API-Login1

Get token After Successfull Login:

3-API-Login2-Response

Set token in Swagger Header:

4-API-Swaagger-Set-Bearer-Token

Or, Set token in Postman Header as Authorization:

Postman-Product-List-API-with-Authenticated-Token

Hit Any API Route in Swagger:

5-API-Swaagger-Public-Product-List-View

Image Upload throw Postman:

Postman-Store-Product-with-File-Upload

Test

  1. Test with Postman - https://www.getpostman.com/collections/dbb31ed9c8dd676e0531 [Click to open with post man]
  2. Test with Swagger.
  3. Swagger Limitation: Image can not be uploaded throw Swagger, it can be uploaded throw Postman.

About

Laravel Advanced CRUD API Architecture for Small to Big Project.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 96.6%
  • Blade 2.7%
  • Shell 0.7%