承接 jtn/shopify-currency-format 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

jtn/shopify-currency-format

最新稳定版本:v1.0.0

Composer 安装命令:

composer require jtn/shopify-currency-format

包简介

Helper for formatting string to fit Shopify currency formats

README 文档

README

Build Status

This is a small helper utility for formatting currencies provided by the Shopify API. All the formats covered in the documentation on Shopify currency formats are supported

Installation

Install with composer.

composer require jtn/shopify-currency-format

Usage

Simply create a new instance of the class and supply the format you want to use and pass an integer in cents to the format method.

If you pass a string the library will expect this came from the Shopify API so will be in dollars and cents so it will be divided by 100.

You can change the format by calling setFormat.

use Jtn\ShopifyCurrencyFormat\ShopifyCurrencyFormat;

$formatter = new ShopifyCurrencyFormat('{{ amount_no_decimals }}');
echo $formatter->format(3.65); // 4

$formatter->setFormat('{{ amount_no_decimals }}');
echo $formatter->format(300); // 3.00

$formatter->setFormat('<span class=money>£{{ amount }} GBP</span>');
echo $formatter->format('5.99'); // <span class=money>£5.99 GBP</span>

If you specifiy an unsupported format an exception will be thrown.

use Jtn\ShopifyCurrencyFormat\ShopifyCurrencyFormat;
use Jtn\ShopifyCurrencyFormat\UnsupportedFormatException;

$formatter = new ShopifyCurrencyFormat('{{ some_unsupported_format }}');

try {
	echo $formatter->format(1.00);
} catch(UnsupportedFormatException $e) {
	echo 'That format is not supported :(';
}

// That format is not supported :(

统计信息

  • 总下载量: 263
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 8
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-11-06

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固