Skip to content

taghwo/minimvc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MVC Framework

Requirements

PHP 7.3 ^
Composer
MYSQL 5.5^

INSTALLATION

Clone repository
https://github.com/taghwo/minimvc.git
Run
composer install
 Run
 composer dump-autoload
Create a .env file in the root of the app, copy and paste .env.example placeholders INTO .env
Update your app credentials in .env
Modify boom file permissions
Run
chmod +x boom
Run migrations for users table with
php ./boom migrate users
start app with
cd public && php -S 127.0.0.1:8000

Usage

Authentication

Authentication is handled with bearer tokens
When visiting endpoint that needs authentication pass the access token
that was received during registration or login as bearer in your authorization header.

## Example
Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9

endpoints

 All endpoints reside in Route/api.php
During registration and login submitted data will be validated
Registration sample payload looks like
{
	"name":"mongoya T",
	"email":"mits@f.com",
	"password":"password"
}

Login sample payload
{
  "email":"mits@f.com",
  "password":"password"
}
Login response payload 
{
  "status": "success",
  "data": {
    "user": {
      "id": "79",
      "name": "mongoya",
      "email": "mit@f.com"
    },
    "accessToken": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJNVkNBUFAiLCJhdWQiOiJVU0VSIiwiaWF0IjoxNjE3MDQyNDU5LCJuYmYiOjE2MTcwNDI0NjksImV4cCI6MTYxNzA0NjA1OSwiZGF0YSI6eyJpZCI6Ijc5IiwibmFtZSI6Im1vbmdveWEifX0.QzreOSwa6aUe3LAhtwbm7m4BXotez5BqGbWssh6xksI",
    "tokenType": "Bearer"
  }
}
Currently logged in user response payload
{
  "status": "success",
  "data": {
    "id": "79",
    "name": "mongoya",
    "email": "mit@f.com"
  }
}
Status code returned include
1: 401 for unauthenticated response
2: 400 for invalid credentials
3: 500 for server error
4: 200 for ok
5: 201 for created
6: 417 for unexpected error

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published