We will integrate the API into our user application file, which will be the main application file; there might be interfaces or view files for each application purpose. Let's go through the following steps:
1. Create a new PHP file inside the project directory named
UserApplication.php
, and type in the followingUserApplication
class:<?php namespace My\Application; use My\Service\UserService; use My\Service\ValidatorService; session_start(); require_once "Dao/BaseDao.php"; require_once "Dao/UserDao.php"; require_once "Service/ValidatorService.php"; require_once "Service/UserService.php"; class UserApplication { public function __ construct (UserService $userService, ValidatorService $validator) { $this->userService = $userService; $this->validator = $validator; if (isset($_POST['login'])) { $this->login(); } else if (isset($_POST['register'])) { $this->register(); } else if (isset($_POST['update'])) { $this->update(); } else...