Best laravel framework open-source packages.

Valents task

Laravel Based Project - Rate Limiting APIs, Enabling CORS, and OAuth Authentication using Laravel - Enhancing API Security and Performance Using Laravel
Updated 9 months ago

Please Have a look at: Postman Documentation

Base URL: http://localhost:8000/api/v1/

Tasks Accomplished:

  • Created 4 APIs, to list, create, update & delete the user
  • Route for list is unprotected while other routes are protected
  • oauth2 used for user authentication
  • Cors are Enabled
  • Rate limiting is implemented to 20 requests/minute

Provided & Tested:

  • Tested APIs Postman
  • Json zip folder along with Environment
  • Zip folder of APIs is attached in the email
  • Implemented and tested authentication
  • Tested

User Schema:

  • id
  • first_name
  • last_name
  • email
  • password
  • photo (photo is appended in `\App\Models\User`, spatie attaches photo that way)

I sent 100 requests using setTimeOut, it didn't gave any CORS error Gave error after 20 reqyests, it can be seen in the next Image Image of testing CORS Enabled and Rate limiting on a local react project is given below

Image of testing CORS Enabled and Rate limiting on a local react project in which I sent 100 requests using setTimeOut, it didn't gave any CORS error and also gave and error after 20 reqyests, it can be seen in the next Image

Finally the console of this test is attached

Cors testing with: https://myxml.in/cors-tester.html

Installation


Run command composer install

Copy env.example as env cp .env.example .env

Generate a key for the project php artisan key:generate

then php artisan migrate:fresh --seed

Seeded User:

email: admin@gmail.com
password: password

then php artisan passport:install

Put the obtained values with the respective key given below

PASSPORT_PERSONAL_ACCESS_CLIENT_ID=${clientID} PASSPORT_PERSONAL_ACCESS_CLIENT_SECRET=${clientSecretKey}
Hope the project is fine, Thanks for the opportunity!