PHP Classes

Advanced Laravel CRUD API: Implement API that provide CRUD operations

Recommend this page to a friend!
  Info   View files Documentation   View files View files (113)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2022-10-21 (3 months ago) RSS 2.0 feedNot yet rated by the usersTotal: 31 All time: 10,680 This week: 3Up
Version License PHP version Categories
laravel-advanced-cru 1.0.0MIT/X Consortium ...5PHP 5, E-Commerce, User Management, L..., W..., D...
Description Author

This package allows to implementation of API that provides CRUD operations.

It provides a Laravel-based application that implements several modules there perform operations to create, read, update and delete records of model objects.

Currently, it provides modules that perform CRUD operations on:

- Registered users

- Available products

- User welcome

Picture of Maniruzzaman Akash
  Performance   Level  
Name: Maniruzzaman Akash <contact>
Classes: 14 packages by
Country: Bangladesh Bangladesh
Age: 27
All time rank: 372046 in Bangladesh Bangladesh
Week rank: 147 Up5 in Bangladesh Bangladesh Up
Innovation award
Innovation award
Nominee: 5x

Details

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-8
  2. Laravel-9

Older Versions (if Needed):

  1. Laravel 8.x - https://github.com/ManiruzzamanAkash/Laravel-Advanced-CRUD-API/releases/tag/vLaravel8.x

Architecture Used:

  1. Laravel 9.x
  2. Interface-Repository Pattern
  3. Model Based Eloquent Query
  4. Swagger API Documentation - https://github.com/DarkaOnLine/L5-Swagger
  5. JWT Auth - https://github.com/tymondesigns/jwt-auth
  6. PHP Unit Testing - Some basic unit testing added.

API List:

Authentication Module
  1. [x] Register User API with Token
  2. [x] Login API with Token
  3. [x] Authenticated User Profile
  4. [x] Refresh Data
  5. [x] Logout
Product Module
  1. [x] Product List
  2. [x] Product List [Public]
  3. [x] Create Product
  4. [x] Edit Product
  5. [x] View Product
  6. [x] 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. Install composer packages - `composer install`.
  5. 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.
  6. Generate Swagger API
    php artisan l5-swagger:generate
    
  7. Run the server -
    php artisan serve
    
  8. Open Browser - http://127.0.0.1:8000 & go to API Documentation - http://127.0.0.1:8000/api/documentation
  9. 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:

<img src="https://i.ibb.co/gV1Yn9Z/1-Swagger-API-Demo.png" alt="1-Swagger-API-Demo" border="0">

Login in Swagger with Given Data:

<img src="https://i.ibb.co/5vrXkgN/2-API-Login1.png" alt="2-API-Login1" border="0">

Get token After Successful Login:

<img src="https://i.ibb.co/cQ37n9t/3-API-Login2-Response.png" alt="3-API-Login2-Response" border="0">

Set token in Swagger Header:

<img src="https://i.ibb.co/m8xQZ4T/Screenshot-2022-07-12-at-8-37-47-AM.png" alt="4-API-Swagger-Set-Bearer-Token" border="0">

Or, Set token in Postman Header as Authorization:

<img src="https://i.ibb.co/7p8Y3Yz/Postman-Product-List-API-with-Authenticated-Token.png" alt="Postman-Product-List-API-with-Authenticated-Token" border="0">

Hit Any API Route in Swagger:

<img src="https://i.ibb.co/VSWbXq9/5-API-Swaagger-Public-Product-List-View.png" alt="5-API-Swaagger-Public-Product-List-View" border="0">

Image Upload throw Postman:

<img src="https://i.ibb.co/VBkMBBp/Postman-Store-Product-with-File-Upload.png" alt="Postman-Store-Product-with-File-Upload" border="0">

Test

  1. Test with Postman - https://www.getpostman.com/collections/5642915d135f376b84af [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.
  Files folder image Files  
File Role Description
Files folder imageapp (9 directories)
Files folder imagebootstrap (1 file)
Files folder imageconfig (16 files)
Files folder imagedatabase (4 directories)
Files folder imagepublic (4 files, 2 directories)
Files folder imageresources (3 directories)
Files folder imageroutes (4 files)
Files folder imagestorage (1 directory)
Files folder imagetests (2 files, 2 directories)
Accessible without login Plain text file .editorconfig Data Auxiliary data
Accessible without login Plain text file .env.example Data Auxiliary data
Accessible without login Plain text file .styleci.yml Data Auxiliary data
Plain text file artisan Class Class source
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file composer.lock Data Auxiliary data
Accessible without login Plain text file docker-compose.yml Data Auxiliary data
Accessible without login Plain text file package.json Data Auxiliary data
Accessible without login Plain text file phpunit.xml Data Auxiliary data
Accessible without login Plain text file README.md Doc. Documentation
Accessible without login Plain text file server.php Aux. Auxiliary script
Accessible without login Plain text file webpack.mix.js Data Auxiliary data

  Files folder image Files  /  app  
File Role Description
Files folder imageConsole (1 file)
Files folder imageExceptions (1 file)
Files folder imageHelpers (1 file)
Files folder imageHttp (1 file, 3 directories)
Files folder imageInterfaces (1 file)
Files folder imageModels (2 files)
Files folder imageProviders (5 files)
Files folder imageRepositories (2 files)
Files folder imageTraits (1 file)

  Files folder image Files  /  app  /  Console  
File Role Description
  Plain text file Kernel.php Class Class source

  Files folder image Files  /  app  /  Exceptions  
File Role Description
  Plain text file Handler.php Class Class source

  Files folder image Files  /  app  /  Helpers  
File Role Description
  Plain text file UploadHelper.php Class Class source

  Files folder image Files  /  app  /  Http  
File Role Description
Files folder imageControllers (1 file, 3 directories)
Files folder imageMiddleware (9 files)
Files folder imageRequests (4 files)
  Plain text file Kernel.php Class Class source

  Files folder image Files  /  app  /  Http  /  Controllers  
File Role Description
Files folder imageAuth (1 file)
Files folder imageProducts (1 file)
Files folder imageWelcome (1 file)
  Plain text file Controller.php Class Class source

  Files folder image Files  /  app  /  Http  /  Controllers  /  Auth  
File Role Description
  Plain text file AuthController.php Class Class source

  Files folder image Files  /  app  /  Http  /  Controllers  /  Products  
File Role Description
  Plain text file ProductsController.php Class Class source

  Files folder image Files  /  app  /  Http  /  Controllers  /  Welcome  
File Role Description
  Plain text file WelcomeController.php Class Class source

  Files folder image Files  /  app  /  Http  /  Middleware  
File Role Description
  Plain text file Authenticate.php Class Class source
  Plain text file EncryptCookies.php Class Class source
  Plain text file PreventRequestsDuringMaintenance.php Class Class source
  Plain text file RedirectIfAuthenticated.php Class Class source
  Plain text file SwaggerFix.php Class Class source
  Plain text file TrimStrings.php Class Class source
  Plain text file TrustHosts.php Class Class source
  Plain text file TrustProxies.php Class Class source
  Plain text file VerifyCsrfToken.php Class Class source

  Files folder image Files  /  app  /  Http  /  Requests  
File Role Description
  Plain text file FormRequest.php Class Class source
  Plain text file LoginRequest.php Class Class source
  Plain text file ProductRequest.php Class Class source
  Plain text file RegisterRequest.php Class Class source

  Files folder image Files  /  app  /  Interfaces  
File Role Description
  Plain text file CrudInterface.php Class Class source

  Files folder image Files  /  app  /  Models  
File Role Description
  Plain text file Product.php Class Class source
  Plain text file User.php Class Class source

  Files folder image Files  /  app  /  Providers  
File Role Description
  Plain text file AppServiceProvider.php Class Class source
  Plain text file AuthServiceProvider.php Class Class source
  Plain text file BroadcastServiceProvider.php Class Class source
  Plain text file EventServiceProvider.php Class Class source
  Plain text file RouteServiceProvider.php Class Class source

  Files folder image Files  /  app  /  Repositories  
File Role Description
  Plain text file AuthRepository.php Class Class source
  Plain text file ProductRepository.php Class Class source

  Files folder image Files  /  app  /  Traits  
File Role Description
  Plain text file ResponseTrait.php Class Class source

  Files folder image Files  /  bootstrap  
File Role Description
  Plain text file app.php Class Class source

  Files folder image Files  /  config  
File Role Description
  Plain text file app.php Class Class source
  Plain text file auth.php Class Class source
  Accessible without login Plain text file broadcasting.php Aux. Auxiliary script
  Accessible without login Plain text file cache.php Aux. Auxiliary script
  Accessible without login Plain text file cors.php Aux. Auxiliary script
  Accessible without login Plain text file database.php Aux. Auxiliary script
  Accessible without login Plain text file filesystems.php Aux. Auxiliary script
  Accessible without login Plain text file hashing.php Aux. Auxiliary script
  Plain text file jwt.php Class Class source
  Accessible without login Plain text file l5-swagger.php Aux. Auxiliary script
  Plain text file logging.php Class Class source
  Accessible without login Plain text file mail.php Aux. Auxiliary script
  Accessible without login Plain text file queue.php Aux. Auxiliary script
  Accessible without login Plain text file services.php Aux. Auxiliary script
  Accessible without login Plain text file session.php Aux. Auxiliary script
  Accessible without login Plain text file view.php Aux. Auxiliary script

  Files folder image Files  /  database  
File Role Description
Files folder imagefactories (2 files)
Files folder imagemigrations (4 files)
Files folder imageseeders (3 files)
Files folder imagesql (1 file)

  Files folder image Files  /  database  /  factories  
File Role Description
  Plain text file ProductFactory.php Class Class source
  Plain text file UserFactory.php Class Class source

  Files folder image Files  /  database  /  migrations  
File Role Description
  Plain text file 2014_10_12_000000_create_users_table.php Class Class source
  Plain text file 2014_10_12_100000_...rd_resets_table.php Class Class source
  Plain text file 2019_08_19_000000_...iled_jobs_table.php Class Class source
  Plain text file 2020_12_13_191618_..._products_table.php Class Class source

  Files folder image Files  /  database  /  seeders  
File Role Description
  Plain text file DatabaseSeeder.php Class Class source
  Plain text file ProductSeeder.php Class Class source
  Plain text file UserSeeder.php Class Class source

  Files folder image Files  /  database  /  sql  
File Role Description
  Accessible without login Plain text file laravel_basic_crud.sql Data Auxiliary data

  Files folder image Files  /  public  
File Role Description
Files folder imagecss (2 files)
Files folder imageimages (1 directory)
  Accessible without login Plain text file .htaccess Data Auxiliary data
  Plain text file index.php Class Class source
  Accessible without login Plain text file robots.txt Doc. Documentation
  Accessible without login Plain text file web.config Data Auxiliary data

  Files folder image Files  /  public  /  css  
File Role Description
  Accessible without login Plain text file bootstrap.min.css Data Auxiliary data
  Accessible without login Plain text file style.css Data Auxiliary data

  Files folder image Files  /  public  /  images  
File Role Description
Files folder imageproducts (17 files)

  Files folder image Files  /  public  /  images  /  products  
File Role Description
  Accessible without login Image file akij-chair-1608363866.png Icon Icon image
  Accessible without login Image file asus-rog-g531gt-15-1608355217.png Data Auxiliary data
  Accessible without login Image file canon-eos-1500d-241-1608355424.png Data Auxiliary data
  Accessible without login Image file code-with-two-exampl-1608342846.png Data Auxiliary data
  Accessible without login Image file desktop-monitor-1608362784.png Data Auxiliary data
  Accessible without login Image file final-test-1608344158.png Data Auxiliary data
  Accessible without login Image file indoprimo-mens-regu-1608355308.png Data Auxiliary data
  Accessible without login Image file product-1-updated-1608359602.png Data Auxiliary data
  Accessible without login Image file samsung-galaxy-tab-a-1608361186.png Icon Icon image
  Accessible without login Image file samsung-gallaxy-a10-1608354906.png Icon Icon image
  Accessible without login Image file sunglass-1608360893.png Icon Icon image
  Accessible without login Image file sunglass-1608361794.png Icon Icon image
  Accessible without login Image file t-shirt-2-1608369537.jpeg Data Auxiliary data
  Accessible without login Image file test-1608344059.png Data Auxiliary data
  Accessible without login Image file test-product-1608056421.png Data Auxiliary data
  Accessible without login Image file update-new-another-1608360796.png Data Auxiliary data
  Accessible without login Image file white-sleeve-t-shirt-1608369183.jpeg Data Auxiliary data

  Files folder image Files  /  resources  
File Role Description
Files folder imagejs (2 files)
Files folder imagelang (1 directory)
Files folder imageviews (1 file, 1 directory)

  Files folder image Files  /  resources  /  js  
File Role Description
  Accessible without login Plain text file app.js Data Auxiliary data
  Accessible without login Plain text file bootstrap.js Data Auxiliary data

  Files folder image Files  /  resources  /  lang  
File Role Description
Files folder imageen (4 files)

  Files folder image Files  /  resources  /  lang  /  en  
File Role Description
  Accessible without login Plain text file auth.php Aux. Auxiliary script
  Accessible without login Plain text file pagination.php Aux. Auxiliary script
  Accessible without login Plain text file passwords.php Aux. Auxiliary script
  Accessible without login Plain text file validation.php Aux. Auxiliary script

  Files folder image Files  /  resources  /  views  
File Role Description
Files folder imagevendor (1 directory)
  Accessible without login Plain text file welcome.blade.php Aux. Auxiliary script

  Files folder image Files  /  resources  /  views  /  vendor  
File Role Description
Files folder imagel5-swagger (1 file)

  Files folder image Files  /  resources  /  views  /  vendor  /  l5-swagger  
File Role Description
  Accessible without login Plain text file index.blade.php Aux. Auxiliary script

  Files folder image Files  /  routes  
File Role Description
  Plain text file api.php Class Class source
  Accessible without login Plain text file channels.php Example Example script
  Accessible without login Plain text file console.php Example Example script
  Plain text file web.php Class Class source

  Files folder image Files  /  storage  
File Role Description
Files folder imageapi-docs (1 file)

  Files folder image Files  /  storage  /  api-docs  
File Role Description
  Accessible without login Plain text file api-docs.json Data Auxiliary data

  Files folder image Files  /  tests  
File Role Description
Files folder imageFeature (1 file)
Files folder imageUnit (3 files)
  Plain text file CreatesApplication.php Class Class source
  Plain text file TestCase.php Class Class source

  Files folder image Files  /  tests  /  Feature  
File Role Description
  Plain text file ExampleTest.php Class Class source

  Files folder image Files  /  tests  /  Unit  
File Role Description
  Plain text file ExampleTest.php Class Class source
  Plain text file LoginTest.php Class Class source
  Plain text file ProductTest.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%
Total:31
This week:0
All time:10,680
This week:3Up