Download the PHP package benjaminmal/exchangeratehost-bundle without Composer
On this page you can find all versions of the php package benjaminmal/exchangeratehost-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download benjaminmal/exchangeratehost-bundle
More information about benjaminmal/exchangeratehost-bundle
Files in benjaminmal/exchangeratehost-bundle
Package exchangeratehost-bundle
Short Description ExchangeRate.host API bundle for Symfony
License MIT
Informations about the package exchangeratehost-bundle
exchangerate.host bundle
This bundle allows you to query the great (and free!) exchangerate.host API in a Symfony app with ease. It supports PSR-7, PSR-17, PSR-18 so you have full control of your dependencies! It uses also the Symfony Cache.
⚠️ This bundle is unofficial. I'm not related to exchangerate.host.
Summary
- Requirements
- Installation
- Getting started
- Config
- Use the API client
- Cache
- Customizing the cache
- Clearing the cache
- What's more
Requirements
- PHP ^8.1
- Symfony ^6.2
Installation
Composer
PSRs
In order to use this bundle, you need to set PSR-17 message factories and a PSR-18 HTTP client.
If you already have PSR-17 factories and PSR-18 HTTP client in your services you're done! Otherwise, you can use these great libraries:
If you're using Symfony Flex and the recommended librairies, you're all set!
Otherwise, enable the bundle by adding it to the list of registered bundles in the config/bundles.php
file of your project:
Then add your implementation of PSR-17 and PSR-18 services if they don't exist yet:
Getting started
Config
The following file is optional but here are the default config values:
Use the API client
The API client is available through autowiring via ExchangeRateHostClientInterface
or via benjaminmal.exchangerate_host_bundle.client
service id:
Cache
Customizing the cache
You want to change the default cache behavior? Let's do that:
Clearing the cache
If you are using the cache (which is highly recommended) you may want to clear the cache at each new entry of the exchangerate.host API. So you need to set a cron job on your server just after 00:05am GMT everyday (found in the FAQ).
The cron command:
⚠️ Cron generally works on local time! Adapt it to the timezone of your servers.
The command:
If you changed the default cache pool, use them instead of exchangeratehost.cache
!
What's more?
- exchangerate.host for full documentations about the exchangerate.host API.
- nyholm/psr7 for a PSR-7 and PSR-17 implementations.
- symfony/http-client for a PSR-18 implementation and a great integration with Symfony.
All versions of exchangeratehost-bundle with dependencies
psr/http-client Version ^1.0
symfony/cache Version ^6.2
symfony/config Version ^6.2
symfony/dependency-injection Version ^6.2
symfony/flex Version ^2.2
symfony/framework-bundle Version ^6.2
symfony/http-kernel Version ^6.2
symfony/monolog-bundle Version ^3.0
symfony/validator Version ^6.2
webmozart/assert Version ^1.11