Download the PHP package ivashchukk/pkbp-rates without Composer
On this page you can find all versions of the php package ivashchukk/pkbp-rates. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ivashchukk/pkbp-rates
More information about ivashchukk/pkbp-rates
Files in ivashchukk/pkbp-rates
Package pkbp-rates
Short Description Framework-agnostic PHP client for PKO BP exchange rate JSON endpoints.
License MIT
Informations about the package pkbp-rates
PKO BP Rates
Small PHP client for PKO BP exchange rates.
It is built for application code that needs conversions like DKK to EUR or EUR
to PLN. Amounts are passed around as integer minor units, so 100_00 means
100.00 for currencies with two decimal places.
Install
Convert Money
The result is rounded to the target currency minor unit with half-up rounding.
Use Decimal Input
If you receive human-readable amounts from forms or imports, use Money:
Money::ofMinor(10000, Currency::EUR) and Money::ofDecimal('100.00', Currency::EUR) represent the same amount.
PLN Examples
PLN works like any other currency in the public API.
Rates
For direct PKO BP PLN multipliers:
The default is PKO BP sale_foreign. PKO values quoted for units like
100 HUF or 100 JPY are normalized to a per-unit rate.
Strings Are Accepted
Typed currency constants are usually nicer:
Strings are useful when the code comes from a request, database, or config:
Dates
Passing null as the date means today in Europe/Warsaw. If PKO BP has no
table for that day, the client looks back up to 10 calendar days.
Error Handling
Package exceptions:
HttpRequestFailedExceptionInvalidResponseExceptionTableNotFoundExceptionCurrencyNotFoundExceptionRateFieldNotFoundException
HTTP Client
PkbpRatesClient::create() uses Guzzle. To inject your own HTTP stack, pass
PSR-18 and PSR-17 implementations:
Development
Generate a local coverage file:
Live tests are skipped unless enabled:
All versions of pkbp-rates with dependencies
brick/math Version ^0.18
guzzlehttp/guzzle Version ^7.10
psr/http-client Version ^1.0
psr/http-factory Version ^1.1
psr/http-message Version ^2.0