It's my implementation for the task using Docker, PHP 8.2, Mysql 8, Symfony 6.3, type hinting with enabled strict mode, DDD, etc.
Project directory structure is a fully standard.
Clone project using terminal
git clone git@github.com:vlady777/loan-schedule.git
Enter in project directory
cd loan-schedule
Run shell script to create containers and prepare project
sh startup.sh
Wait until message API is ready to use. You are inside the container.
.
That's it.
Open browser, go to the https://localhost:8010/ and confirm security exclusion. This is the main page of the API
documentation. Here you can see all available API endpoints and send requests to any of them directly from UI
using Try it out
button. It's a convenient way to test API, to see requests format, etc.
As well, you can use any REST client or anything else to make http requests to https://localhost:8010/ host.
Example of request body to create new Loan:
{
"amount": 1000000,
"term": 12,
"interestRate": 400,
"defaultEuriborRate": 394
}
Example of request body to create new Euribor for Loan #1
{
"segmentNumber": 6,
"rate": 410,
"loan": "/loans/1"
}
Execute commands in terminal (inside container).
Run all test
php bin/phpunit
Run unit-tests only
php bin/phpunit tests/Unit/
Run functional-tests only
php bin/phpunit tests/Functional/
Validate database schema and fields mapping
php bin/console doctrine:schema:validate
Display all routes
php bin/console debug:router
- Create containers
docker compose up -d
- Enter to the php container
docker exec -it loan_php bash
- Install vendors
composer install
- Prepare main database
php bin/console doc:mig:mig -n
- Prepare database for tests
php bin/console doc:mig:mig -n -e test
That's it.