This package created for convert between 2 currencies by using currencies.js file provided by Shopify.
-
Install package
composer require ownego/laravel-shopify-currency
-
Optional: add the service provider
'providers' => [ // ... Ownego\LaravelShopifyCurrency\LaravelShopifyCurrencyServiceProvider::class, ],
-
Optional: publish config
php artisan vendor:publish --provider=Ownego\LaravelShopifyCurrency\LaravelShopifyCurrencyServiceProvider
-
Optional: add facade
'alias' => [ // ... 'ShopifyCurrency' => Ownego\LaravelShopifyCurrency\Facades\ShopifyCurrency::class, ],
- Convert
use Ownego\LaravelShopifyCurrency\Facades\ShopifyCurrency; $result = ShopifyCurrency::convert(100, 'eur', 'usd');
- Get rate
use Ownego\LaravelShopifyCurrency\Facades\ShopifyCurrency; $result = ShopifyCurrency::rate('eur', 'usd');
If you want to manually update currencies from cache, then run:
php artisan shopify-currency:cache