Skip to content

feat: currency exchange REST API#207

Closed
hahuma wants to merge 1 commit intoApiki:masterfrom
hahuma:petterson-firmino
Closed

feat: currency exchange REST API#207
hahuma wants to merge 1 commit intoApiki:masterfrom
hahuma:petterson-firmino

Conversation

@hahuma
Copy link
Copy Markdown

@hahuma hahuma commented Apr 4, 2026

Summary

  • Implemented currency conversion REST API (GET /exchange/{amount}/{from}/{to}/{rate})
  • Supports BRL↔USD and BRL↔EUR conversions
  • Well-structured OOP architecture: Currency enum, Validator, Converter, Router, Response classes
  • PHP 8.1+ with strict types, PHPStan level 9 compliant
  • Added PHPUnit unit tests (19 tests) alongside existing Codeception integration tests (14 tests)
  • Docker setup for local development (docker compose up)

Architecture

Class Responsibility
Currency PHP enum with BRL, USD, EUR and currency symbols
Validator Input validation, throws ValidationException
Converter Conversion logic (amount × rate)
Router URI parsing and request dispatch
Response JSON response helper

Test plan

  • composer test — 14 Codeception integration tests pass
  • composer unit-test — 19 PHPUnit unit tests pass
  • composer lint — PHPCS clean
  • composer analyse — PHPStan level 9, no errors

Add currency conversion endpoint (GET /exchange/{amount}/{from}/{to}/{rate})
supporting BRL<->USD and BRL<->EUR conversions with input validation.

- Well-structured OOP: Currency enum, Validator, Converter, Router, Response
- PHP 8.1+ with strict types, PHPStan level 9 compliant
- PHPUnit unit tests for all classes
- Docker setup for local development
- Upgraded Codeception to v5 for PHP 8.3 compatibility
@hahuma hahuma closed this by deleting the head repository Apr 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant