merrick / laravel-shopify-currencies
Laravel package providing the full list of Shopify supported currencies (hardcoded from CurrencyCode enum)
Package info
github.com/merrick67/laravel-shopify-currencies
pkg:composer/merrick/laravel-shopify-currencies
Requires
- php: ^8.1|^8.2|^8.3
- illuminate/support: ^9.0|^10.0|^11.0|^12.0
This package is auto-updated.
Last update: 2026-02-26 09:06:57 UTC
README
A lightweight Laravel package that provides the full list of currencies supported by Shopify, hardcoded from the official CurrencyCode enum (Shopify GraphQL Admin/Storefront APIs, latest 2026-01).
This package includes:
- Currency code, full name, symbol, and display format (e.g., "Vietnamese Dong (VND ₫)", "US Dollar (USD $)").
- Sorted like Shopify Admin dropdown: Most used currencies first (USD, EUR, GBP, CAD, AUD, etc.), then alphabetical by name.
- No database, no migrations, no API calls – pure PHP enum + static data for maximum speed and reliability.
Perfect for:
- Currency dropdowns in forms
- Validation rules
- Payment or checkout features
- Matching Shopify Admin settings exactly
Requirements
- PHP ^8.1 | ^8.2 | ^8.3
- Laravel ^9.0 | ^10.0 | ^11.0 | ^12.0 (illuminate/support)
Installation
Install via Composer (live on Packagist):
composer require merrick/laravel-shopify-currencies
For local development or testing:
Add to your project's composer.json:
"repositories": [ { "type": "vcs", "url": "https://github.com/merrick67/laravel-shopify-currencies" } ], "require": { "merrick/laravel-shopify-currencies": "dev-main" }
Then run:
composer update merrick/laravel-shopify-currencies
No additional setup needed – auto-registered.
Usage
1. Via Facade (Recommended)
use Merrick\ShopifyCurrencies\Facades\ShopifyCurrencies;
// All codes as array $codes = ShopifyCurrencies::codes();
// Full collection (code, name, symbol, display – sorted like Shopify Admin) $currencies = ShopifyCurrencies::all(); // Example items: // ['code' => 'USD', 'name' => 'US Dollar', 'symbol' => '$', 'display' => 'US Dollar (USD $)'] // ['code' => 'EUR', 'name' => 'Euro', 'symbol' => '€', 'display' => 'Euro (EUR €)'] // ['code' => 'VND', 'name' => 'Vietnamese Dong', 'symbol' => '₫', 'display' => 'Vietnamese Dong (VND ₫)']
// Validate code $isValid = ShopifyCurrencies::isValid('VND'); // true
2. Via Helpers
$codes = shopify_currency_codes(); $currencies = shopify_currencies(); // with display format $isValid = is_shopify_currency('EUR');
3. Via Service Container
use Merrick\ShopifyCurrencies\Services\ShopifyCurrencyService;
$service = app(ShopifyCurrencyService::class); $currencies = $service->all();
Blade Dropdown Example (Matches Shopify Admin Style)
@foreach (ShopifyCurrencies::all() as $currency) {{ $currency['display'] }} @endforeachOutput preview:
- US Dollar (USD $)
- Euro (EUR €)
- British Pound (GBP £)
- ...
- Vietnamese Dong (VND ₫)
Available Methods
| Method | Return Type | Description |
|---|---|---|
| codes() | array | All currency codes |
| all() | Collection | Full list: code, name, symbol, display (Most used first) |
| isValid(string $code) | bool | Check if code is supported by Shopify |
Why Hardcoded?
Shopify's CurrencyCode enum is stable and rarely changes. Hardcoding ensures:
- No API dependencies
- Instant performance
- Easy maintenance (update maps in ShopifyCurrencyService.php)
Version History
- 1.1.0 (latest): Added full names, symbols, display format ("Name (CODE symbol)"), and "Most used" sorting to match Shopify Admin dropdown.
- 1.0.0: Initial release with basic code + name list.
Contributing
Report issues, suggest symbols/names, or open PRs on GitHub: https://github.com/merrick67/laravel-shopify-currencies
License
MIT License
See LICENSE for details.