Looking to hire Laravel developers? Try LaraJobs

laravel-shopify-currency maintained by ownego

Description
Currency converter using Shopify's currencies cdn file
Author
Last update
2021/12/13 09:15 (dev-master)
License
Links
Downloads
7 165

Comments
comments powered by Disqus

Introduction

This package created for convert between 2 currencies by using currencies.js file provided by Shopify.

Installation

  1. Install package

    composer require ownego/laravel-shopify-currency
    
  2. Optional: add the service provider

    'providers' => [
       // ...
       Ownego\LaravelShopifyCurrency\LaravelShopifyCurrencyServiceProvider::class,
    ],
    
  3. Optional: publish config

    php artisan vendor:publish --provider=Ownego\LaravelShopifyCurrency\LaravelShopifyCurrencyServiceProvider
    
  4. Optional: add facade

    'alias' => [
       // ...
       'ShopifyCurrency' => Ownego\LaravelShopifyCurrency\Facades\ShopifyCurrency::class,
    ],
    

Usage

  1. Convert
    use Ownego\LaravelShopifyCurrency\Facades\ShopifyCurrency;
    
    $result = ShopifyCurrency::convert(100, 'eur', 'usd');
    
  2. Get rate
    use Ownego\LaravelShopifyCurrency\Facades\ShopifyCurrency;
    
    $result = ShopifyCurrency::rate('eur', 'usd');
    

Command

If you want to manually update currencies from cache, then run:

php artisan shopify-currency:cache