You are on page 1of 3

TASKS

[TASK 1.] Setup project


a. Using the MVP pattern, setup appropriate folders and files (just empty
files for now)
b. Suggested folder/files structure:
i. src/
1. Controllers/
a. PaymentController.php
2. Models/
a. Database/
i. Database.php
3. Views/
a. index.html
4. External/
5. Config/
a. config.php
b. insurance.sql
6. Autoloader.php
ii. cli.php
iii. index.php
iv. README.MD
From (1), there are a couple of things to do:
[TASK 2.] Setup Database.php class.
a. It will be built using OOP that tends to perform common database
queries with convenience. Such as SELECT, UPDATE, DELETE etc.
These queries should be built generically in such a way that it can be
integrated to any system.
i. Methods that should be in the class include: fetch(), update(),
delete(), rawQuery() etc.
ii. Should be able to read environmental variables stored in
Config/config.php. These variables include: database name,
host, password, etc.
[TASK 3.] Autoloader.php:
a. Should be a simple php class-autoloader that helps us automatically
require a php class stored in any folder without using require ‘’,
include_once(‘’) statements.
b. Also note the External/ folder. It will be used to store any external
library or php package that we may need. We will be using composer
for getting external php packages into our project. Also note that
composer comes with its structure and has its own autoloader (stored
in vendor/autoloader.php). Our Autoloader.php file should be able to
communicate with the composer autoloader.
[TASK 4.] cli.php file will be a simple php file to be run on the command
line. It should enable quick setup of the project when installed on a computer
that has php run on command line. The file should:
a. Enable setup of database (insurance) by running a command on the
CLI e.g: > php cli.php setup. It should derive its connection by
implementing the Database class and calling a connect() function
which returns instance of MySQL connection and also run other
necessary functions such as setup()
b. Enable running the queries contained in src/Config/insurance.sql.
These queries could be queries to setup our table structures or inject
some seedlings into the database for testing. Should call the
c. The file should read its configuration from src/Config/config.php.
[TASK 5.] index.php file should be the entry file for all HTTP requests
(POST and GET only). Since the backend is expected to give a RESTful
response, all conversion of class or method implementation will be here.
a. It should handle responding with appropriate response code for each
request
[TASK 6.] README.MD file. This is a markdown file supposed to
contain documentation on how to use the software.
a. It should have steps for installations
b. Request syntax and response formats
c. Do’s and Don’t’s
d. List of contributors etc.
[TASK 7.] PaymentController.php should be a PHP class that extends
Database class. It will:
a. Be the controller responsible for accepting payments, storing payment
records, authenticating payments, retrieving payment.
b. It will use the PayStack/flutterWave SDK (to save time) which is a
composer depended package.
Furthermore, all controllers should have a suffix of …Controller.php to their name.
this can be useful when building the autoloader.
This is not a full-fletched MVC implementation. But has almost all necessary
requirements. Due to nature of this project (being simple and small), we will NOT
be using any framework though a few packages may be required such as payment
gateway SDK.

You might also like