This service obtaining exchange rates and cross rates from cbr.ru
- PHP 8.2
- Composer
- Docker and Docker Compose
-
Clone the repository:
git clone https://github.com/lampatrampa/exchange-rates.git cd exchange-rates
-
Add GitHub Personal access tokens (*when needed), due to the GitHub API limit (0 calls/hr) is exhausted limits
cp auth.json.example auth.json
Add GitHub Personal access tokens:
https://github.com/settings/tokens/new
add to auth.json
{ "github-oauth": { "github.com": "your token" } }
-
Start docker containers:
docker-compose up -d --force-recreate --remove-orphans
-
Install dependencies:
docker-compose exec -T exchange_rates_php composer install
- Run the Symfony Messenger consumer (and keep it running):
docker-compose exec -T exchange_rates_php php bin/console messenger:consume async -vv
- Fetch historical rates for a currency:
docker-compose exec -T exchange_rates_php php bin/console app:fetch-historical-rates --currency=USD --base-currency=RUB
- Get exchange rate for the specified date:
docker-compose exec -T exchange_rates_php php bin/console app:fetch-exchange-rate --currency=MDL --base-currency=KGS --date=2023-04-14
- Try out the API via swagger doc: http://localhost:8088/api/doc
To run the PHPUnit tests:
docker-compose exec -T exchange_rates_php php bin/phpunit