Download the PHP package kawaiiwaifus/laravel-api-kawaii-jwt without Composer
On this page you can find all versions of the php package kawaiiwaifus/laravel-api-kawaii-jwt. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download kawaiiwaifus/laravel-api-kawaii-jwt
More information about kawaiiwaifus/laravel-api-kawaii-jwt
Files in kawaiiwaifus/laravel-api-kawaii-jwt
Informations about the package laravel-api-kawaii-jwt
Kawaii-jwt (JWT) for Laravel 5.5+ and Quasar BoilerPlate
- Kawaii-jwt is API from Quasar BoilerPlate - BoilerPlate
ReLations packets:
- JWT-Auth - tymondesigns/jwt-auth
- Dingo API - dingo/api
- Laravel-CORS barryvdh/laravel-cors
- Laratrust Laratrust
Installation
- composer create-project kawaiiwaifus/laravel-api-kawaii-jwt NameOfProject
Usage
- run the
php artisan migrate
- run the
php atisan jwt:secret
- run the
php artisan db:seed
(optional) for create tests users.Main Features
A Ready-To-Use Authentication Controllers
You don't have to worry about authentication and password recovery anymore.
I created four controllers you can find in the App\Api\V1\Controllers
for those operations.
For each controller there's an already setup route in routes/api.php
file:
POST api/auth/login
, to do the login and get your access token;POST api/auth/refresh
, to refresh an existent access token by getting a new one;POST api/auth/register
, to create a new user into your application;POST api/auth/recovery
, to recover your credentials;POST api/auth/reset
, to reset your password after the recovery;POST api/auth/logout
, to log out the user by invalidating the passed token;GET api/auth/me
, to get current user data;
Router ADM Users
GET api/admin/users
, get all usersGET api/admin/users/{id}
, get user to editPUT api/admin/users/{id}
, update userPOST api/admin/users
, "create user" I think not finished it.DELETE api/admin/users/{id}
, "delete user" I think not finished it.
--
Router Roles e Permissions
GET api/admin/roles
, get all rolesGET api/admin/roles/{id}
, get role to editPUT api/admin/roles/{id}
, update rolePOST api/admin/roles
, create role-
DELETE api/admin/roles/{id}
, delete role GET api/admin/permissions
, get all permissionsGET api/admin/permissions/{id}
, get permission to editPUT api/admin/permissions/{id}
, update permissionPOST api/admin/permissions
, create permissionDELETE api/admin/permissions/{id}
, delete permission
A Separate File for Routes
All the API routes can be found in the routes/api.php
file. This also follow the Laravel 5.5.
Secrets Generation
Every time you create a new project starting from this repository, the php artisan jwt:generate command will be executed.
Configuration
Database example:
You can find all the Kawaii-jwt specific settings in the config/kawaii-jwt.php
config file.
As I already said before, this Kawaii-jwt is based on dingo/api and tymondesigns/jwt-auth packages. So, you can find many informations about configuration here and here.
However, there are some extra options that I placed in a config/kawaii-jwt.php file:
sign_up.release_token
: set it totrue
if you want your app release the token right after the sign up process;reset_password.release_token
: set it totrue
if you want your app release the token right after the password reset process;
There are also the validation rules for every action (login, sign up, recovery and reset). Feel free to customize it for your needs.
Creating Endpoints
You can create endpoints in the same way you could to with using the single dingo/api package. You can read its documentation for details. After all, that's just a boilerplate! :)
However, I added some example routes to the routes/api.php
file to give you immediately an idea.
Cross Origin Resource Sharing
If you want to enable CORS for a specific route or routes group, you just have to use the cors middleware on them.
Thanks to the barryvdh/laravel-cors package, you can handle CORS easily. Just check the docs at this page for more info.
Tests
- coming soon..
CREDITS:
- I got the idea of this project and modified some things to work.
- laravel-api-boilerplate-jwt
All versions of laravel-api-kawaii-jwt with dependencies
laravel/framework Version ^5.5.20
tymon/jwt-auth Version dev-develop
dingo/api Version 2.0.0-alpha1
barryvdh/laravel-cors Version ^0.9.3
santigarcor/laratrust Version 5.0.*