PHPackages                             jtn/shopify-currency-format - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. jtn/shopify-currency-format

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

jtn/shopify-currency-format
===========================

Helper for formatting string to fit Shopify currency formats

v1.0.0(6y ago)1294[1 PRs](https://github.com/jonathanjanssens/shopify-currency-format-php/pulls)MITPHPCI passing

Since Nov 6Pushed 4mo ago1 watchersCompare

[ Source](https://github.com/jonathanjanssens/shopify-currency-format-php)[ Packagist](https://packagist.org/packages/jtn/shopify-currency-format)[ RSS](/packages/jtn-shopify-currency-format/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependencies (1)Versions (4)Used By (0)

Shopify Currency Format PHP
===========================

[](#shopify-currency-format-php)

[![Build Status](https://camo.githubusercontent.com/9cf6109a3016ce8d24548b5932030cad23ee4b681395c76decc8f2a6c2c7871f/68747470733a2f2f7472617669732d63692e6f72672f6a6f6e617468616e6a616e7373656e732f73686f706966792d63757272656e63792d666f726d61742d7068702e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/jonathanjanssens/shopify-currency-format-php)

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](https://help.shopify.com/en/manual/payments/currency-formatting) are supported

Installation
------------

[](#installation)

Install with composer.

`composer require jtn/shopify-currency-format`

Usage
-----

[](#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('£{{ amount }} GBP');
echo $formatter->format('5.99'); // £5.99 GBP

```

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 :(

```

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance52

Moderate activity, may be stable

Popularity16

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

2477d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8baf1ad5f6c5a44a7c3def28cc79fbbe6024b000af35800b6188ffc53e6548e1?d=identicon)[jtn](/maintainers/jtn)

---

Top Contributors

[![jonathanjanssens](https://avatars.githubusercontent.com/u/3079607?v=4)](https://github.com/jonathanjanssens "jonathanjanssens (12 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/jtn-shopify-currency-format/health.svg)

```
[![Health](https://phpackages.com/badges/jtn-shopify-currency-format/health.svg)](https://phpackages.com/packages/jtn-shopify-currency-format)
```

###  Alternatives

[thecodingmachine/discovery

Publish and discover assets in your PHP projects.

100322.7k14](/packages/thecodingmachine-discovery)[yeesoft/yii2-comments

Comments Module For Yii2 Framework

227.8k2](/packages/yeesoft-yii2-comments)[mp-php/fuel-packages-ratchet

121.9k](/packages/mp-php-fuel-packages-ratchet)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
