Laravel-Advanced-CRUD-API
Laravel-Advanced-CRUD-API copied to clipboard
Laravel Advanced API Architecture for Small to Big Project with Auth, Repository, Interfaces, Unit Testing and so many stuffs with Laravel 11.x
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:
- PHP >= 8.2
- Laravel 11.x
Older Versions (if Needed):
- Laravel 8.x - https://github.com/ManiruzzamanAkash/Laravel-Advanced-CRUD-API/releases/tag/vLaravel8.x
- Laravel 9.x - https://github.com/ManiruzzamanAkash/Laravel-Advanced-CRUD-API/releases/tag/vLaravel9.2
Architecture Used:
- Laravel 11.x
- Interface-Repository Pattern
- Model Based Eloquent Query
- Swagger API Documentation - https://github.com/DarkaOnLine/L5-Swagger
- JWT Auth - https://github.com/tymondesigns/jwt-auth
- PHP Unit Testing - Some basic unit testing added.
API List:
Authentication Module
- [x] Register User API with Token
- [x] Login API with Token
- [x] Authenticated User Profile
- [x] Refresh Data
- [x] Logout
Product Module
- [x] Product List
- [x] Product List [Public]
- [x] Create Product
- [x] Edit Product
- [x] View Product
- [x] Delete Product
How to Run:
- Clone Project -
git clone https://github.com/ManiruzzamanAkash/Laravel-Basic-CRUD-API.git
- Go to the project drectory by
cd Laravel-Basic-CRUD-API
& Run the - Create
.env
file & Copy.env.example
file to.env
file - Create a database called -
laravel_basic_crud
. - Install composer packages -
composer install
. - 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.
- Run the server -
php artisan serve
- Open Browser - http://127.0.0.1:8000 & go to API Documentation - http://127.0.0.1:8000/api/documentation
- You'll see a Swagger Panel.
Procedure
- First Login with the given credential or any other user credential
- Set bearer token to Swagger Header or Post Header as Authentication
- Hit Any API, You can also hit any API, before authorization header data set to see the effects.
Demo
API List Views:

Login in Swagger with Given Data:

Get token After Successful Login:

Set token in Swagger Header:

Or, Set token in Postman Header as Authorization:

Hit Any API Route in Swagger:

Image Upload throw Postman:

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