A Laravel 6 API Boilerplate to create a ready-to-use REST API. User Authentication using JWT
This is a boilerplate for writing RESTful API projects using Laravel, a "Starter Kit" you can use to build your API in seconds.
composer create-project kennethtomagan/laravel-6-api-boilerplate myNewProject
;
$ composer install
Create .env
file:
$ cat .env.example > .env
Run php artisan key:generate
and php artisan jwt:secret
$ php artisan migrate:fresh --seed
Verb | URI | Controller | Notes |
---|---|---|---|
POST | http://localhost:8000/api/auth/login |
AuthController | to do the login and get your access token |
POST | http://localhost:8000/api/auth/register |
RegisterController | to create a new user into your application |
POST | http://localhost:8000/api/auth/recovery |
ForgotPasswordController | to recover your credentials; |
POST | http://localhost:8000/api/auth/reset |
ResetPasswordController | to reset your password after the recovery (setup your mail credentials in .env file to avoid error); |
POST | http://localhost:8000/api/auth/logout |
LogoutController | to log out the user by invalidating the passed token; |
GET | http://localhost:8000/api/profile |
ProfileController | to get current user data |
PUT | http://localhost:8000/api/profile |
ProfileController | to update current user data |
PUT | http://localhost:8000/api/profile/password |
ProfileController | to update current user password |