make-it-app / laravel-discrete-api-base
Laravel API for discrete Frontend. Supports Sanctum token authentication. Inscludes: register, authenticate, logout, reset password, email verification and profile/avatar support.
v1.2.0.1
2024-01-19 12:32 UTC
Requires
- php: ^8.1|^8.2|^8.3
- laravel/framework: ^10.10
- laravel/sanctum: ^3.3
- nette/php-generator: ^4.1.2
- symfony/var-exporter: ^6.3
Requires (Dev)
- laravel/pint: ^1.0
This package is auto-updated.
Last update: 2024-04-25 09:27:24 UTC
README
Laravel API for discrete Frontend. Base Version (needed for all futher verstions).
Supports Sanctum token authentication.
Inscludes: register, authenticate, logout, reset password, email verification and profile/avatar support.
Requirements
- none
Installation
composer require "makeit-app/laravel-discrete-api-base"
Setup
- Add records to the
.env
-file
APP_FRONTEND_DOMAIN=publicdomain.com APP_FRONTEND_URL="https://${APP_FRONTEND_DOMAIN}" APP_FRONTEND_LOGIN_URL="${APP_FRONTEND_URL}/login" APP_FRONTEND_DASHBOARD_URL="${APP_FRONTEND_URL}/dashboard" APP_URL="https://backend.${APP_FRONTEND_DOMAIN}"
php artisan vendor:publish --provider="MakeIT\\DiscreteApi\\Base\\Providers\\DiscreteApiBaseServiceProvider" --tag="install" --force
- overwrite User modelphp artisan vendor:publish --provider="MakeIT\\DiscreteApi\\Base\\Providers\\DiscreteApiBaseServiceProvider" --tag="nova" --force
- full version ofApp\Models\User.php
, meaning the installedmake-it-app/laravel-user-roles
package and this installable package.
THEN
php artisan makeit:discreteapi:base:install
- installer for modificable descendant classes of the package. Follow installer instructions.
Then see app/**/DiscreteApi/Base/*
filesystem structure.
Routes
- POST
api/register
- register user (first user = super-administrator - POST
api/login
- login - POST
api/logout
- logout - PUT
api/password/forgot
- request password reset link - PUT
api/password/reset
- reset password - POST
api/email/verification-notification
- request verification link - GET
api/email/verify/<UUID>/<TOKEN>?expires=<UNIX_TIMESTAMP>&signature=<HASH>
- onetime verification link - GET
api/user
- user data - DELETE
api/user
- delete myself - DELETE
api/user/force/<UUID>
- delete specified user (super only) - PUT
api/user/profile
- update profile - GET
api/user/profile/avatar
- get avatar image - POST
api/user/profile/avatar
- update avatar image - DELETE
api/user/profile/avatar
- remove avatar image