Assignment In Slim 4 with MySQL
How to setup
Installation
-
Update database credentials located at config/env.php
-
Run
composer install -
Run migrations using
./phinx migrate -
Run the following Seeders
./phinx seed:run -s UserSeeder./phinx seed:run -s LocationsSeeder./phinx seed:run -s TransactionSeeder -
Run
composer startit will run using http://localhost:8080
User's APIs
-
Fetching users use this end point GET
http://localhost:8080/api/users -
Save new user
Endpoint:
http://localhost:8080/api/usersMethod: POST
Params format required first_name number Yes last_name string Yes email string Yes -
Update user
Endpoint:
http://localhost:8080/api/users/{id}Method: PUT
body:
Params format required first_name number Yes last_name string Yes email string Yes -
GET Single User by ID Endpoint:
http://localhost:8080/api/users/{id}Method:
GET
Location APIs
- Fetching location use this end point GET
http://localhost:8080/api/locations
- GET Location by ID Endpoint:
http://localhost:8080/api/locations/{id}
Method: GET
Transaction APIs
Fetching transactions use this end point GET
http://localhost:8080/api/transactions
User Query Params to filter out the data.
| QueryParam | format |
|---|---|
| locationId | number |
| fromDate | string |
| toDate | string |