Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Currency Api Bundle Laravel Package

bigoen/currency-api-bundle

View on GitHub
Deep Wiki
Context7

Currency Api Bundle

This Symfony bundle provides integration with the Currency Beacon API, allowing you to fetch and manage currency data within your Symfony application.

Installation

  1. Install the bundle using Composer:
composer require bigoen/currency-api-bundle
  1. Enable the bundle in your config/bundles.php file:
return [
    // ...
    Bigoen\CurrencyApiBundle\BigoenCurrencyApiBundle::class => ['all' => true],
];

Configuration

Add the following environment variables to your .env file:

###> bigoen/currency-api-bundle ###
CURRENCY_BEACON_API_KEY=your_api_key_here
###< bigoen/currency-api-bundle ###

Usage

To use the Currency API service, you can inject it into your services or use it manually:

Commands

This bundle provides commands to manage currency data:

  • To update currencies, use:

    php bin/console exchange-rate:currency-beacon:currency-update
    
  • To fetch the latest or historical daily exchange rates, use:

    php bin/console exchange-rate:currency-beacon:daily-update
    

Alternatively, you can use the CurrencyBeaconService directly in your code:

  • To update currencies manually, use the updateCurrencies method:

    $currencyBeaconService->updateCurrencies();
    
  • To update daily exchange rates manually, use the updateDailyExchangeRates method:

    $currencyBeaconService->updateDailyExchangeRates();
    

To query daily exchange rates by date and currency, you can use the DailyExchangeRateRepository:

  • Example query:
    $repository = $entityManager->getRepository(DailyExchangeRate::class);
    $exchangeRate = $repository->findOneBy(['date' => $date, 'currency' => $currency]);
    $amount = $repository->convert('TRY', 'EUR', Carbon::now(), 500);
    

License

This bundle is released under the MIT License. See the bundled LICENSE file for details.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
cgv/localized-resource