PHP 7.3 ^
Composer
MYSQL 5.5^Clone repository
https://github.com/taghwo/minimvc.gitRun
composer install Run
composer dump-autoloadCreate a .env file in the root of the app, copy and paste .env.example placeholders INTO .env
Update your app credentials in .envModify boom file permissions
Run
chmod +x boomRun migrations for users table with
php ./boom migrate usersstart app with
cd public && php -S 127.0.0.1:8000Authentication 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 All endpoints reside in Route/api.phpDuring registration and login submitted data will be validatedRegistration 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