ownego / laravel-shopify-currency
使用 Shopify 的货币 CDN 文件实现的货币转换器
1.0.0
2021-12-13 08:15 UTC
Requires
- php: >=5.5.1
- ext-json: *
- illuminate/cache: >=5.1
- illuminate/console: >=5.1
README
此包是为了通过使用 Shopify 提供的 currencies.js 文件在两种货币之间进行转换而创建的。
安装
-
安装包
composer require ownego/laravel-shopify-currency
-
可选:添加服务提供者
'providers' => [ // ... Ownego\LaravelShopifyCurrency\LaravelShopifyCurrencyServiceProvider::class, ],
-
可选:发布配置
php artisan vendor:publish --provider=Ownego\LaravelShopifyCurrency\LaravelShopifyCurrencyServiceProvider
-
可选:添加外观
'alias' => [ // ... 'ShopifyCurrency' => Ownego\LaravelShopifyCurrency\Facades\ShopifyCurrency::class, ],
使用方法
- 转换
use Ownego\LaravelShopifyCurrency\Facades\ShopifyCurrency; $result = ShopifyCurrency::convert(100, 'eur', 'usd');
- 获取汇率
use Ownego\LaravelShopifyCurrency\Facades\ShopifyCurrency; $result = ShopifyCurrency::rate('eur', 'usd');
命令
如果您想手动从缓存中更新货币,请运行
php artisan shopify-currency:cache