PHP Custom MVC Rest api, phpunit, and symphony console package
HTML
PHP Simple and custom MVC framework, With PHPUnit Testing, Symphony console package, Symphony validator, Mockery
PHPUnit Code covrage is used to check how much php testing is done and on which class and function.
The folder for php reports is phpUnitReports
Things to do before calling the api's
Create .env file copy .exampleENV file and change variables according to your needs.
PHP character set should be UTF-8.
PHP memory_limit=default or more, when running command for importing .dat file into database.
MYSql max_allowed_packet=default, when running command for importing .dat file into database.
Composer install, or composer update, to install PHPUnit, symfony/console
For running the test's
Create tests/.env file copy .exampleENV file and change variables according to your needs. this is testing environments.
You need to create the database and create the address table.
Run php console\bin ImportAddress
For phpunit coverage html
vendor\bin\phpunit --coverage-html FolderName
Folder structure and description
app
Commands
ImportAddressCommand.php => ImportAddressCommand in order to run e.g: php bin\console ImportAddress
Config
Config.php => Class through which one can get .env variales
Controller
AddressController => Controller which handles api nodes
Core
Request
IRequest => Handles Request Body
Request => Implements IRequest Body, and other Request Related functions
Response
Response => Handles responses currently only json responses
Controller => Base Controller
Database => handles database connection
Helpers => Application Helper function such as generateUniqueID
Routes => Handles routes, extract controller, method, parameters.
Models
Address => Address table model
Repository
AddressRepository => Handles database queries for addresses table
Views => currently not view.
start => application bootstrap file.
bin
console => Handle commands. in order to run command e.g:php bin\console CommandName
data
contains .dat file
public
css => css files
images => images files
js => js files
.htaccess
index.php => includes start.php
tests
Integration
PHPUnit Integration test
Unit
PHPUnit tests
.envExampleEnv => environment variables example for testing
.gitignore file
.envExampleEnv => environment variables example for application
composer.json
phpunit.xml => contains phpunit configration
Readme