This project is created with CodeIgniter - the framework with which we can create web site with PHP quickly.
The main controller is $PROJECT/application/controller/AthletesRestController
. There are several REST APIs defined here, with which we can upload players info with JSON, vew player detail, view player list and delete player.
This project provides serval REST APIs, such as file uploading, add, update, delete and view player.
The main REST controller is $PROJECT/application/controllers/AthletesRestController.php
, you can found all REST API definitions here.
The default model is $PROJECT//application/models/Athletes_model.php
, this model provies functions to interact with database.
- PHP 7.2+
- CodeIgniter v3.1.11(don't need to install as it's included in the source code)
- CodeIgniter rest-server, please install it via
composer
by following commandcomposer require chriskacerguis/codeigniter-restserver
. And don't forget to update PHP config file$PROJECT/application/config/config.php
set$config['COMPOSER_AUTOLOAD'] = TRUE
- (OPTIONAL) If need, you can udpate project base_url in '$PROJECT/application/config/config.php', the default configuration is
$config['base_url'] = 'http://localhost/kinduct'
MhySQL version 8.0.18+
- Please run below SQL to create table 'athlete' in target database.
CREATE TABLE
athlete(
idint(10) unsigned NOT NULL AUTO_INCREMENT,
namevarchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
ageint(3) NOT NULL,
cityvarchar(150) COLLATE utf8_unicode_ci DEFAULT NULL,
provincevarchar(150) COLLATE utf8_unicode_ci DEFAULT NULL,
countryvarchar(150) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (
id) ) ENGINE=InnoDB AUTO_INCREMENT=37 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
- Update DB connection parameters in
$PROJECT/application/config/database.php
, with your own database hostname, username, password and database name.
We need Apache v2.4+ to run this programme, please make sure your Apache support PHP.