Skip to content

Latest commit

 

History

History
48 lines (41 loc) · 1.11 KB

README.md

File metadata and controls

48 lines (41 loc) · 1.11 KB

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