merrick/laravel-shopify-currencies 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

merrick/laravel-shopify-currencies

最新稳定版本:1.1.0

Composer 安装命令:

composer require merrick/laravel-shopify-currencies

包简介

Laravel package providing the full list of Shopify supported currencies (hardcoded from CurrencyCode enum)

README 文档

README

Packagist Version Downloads

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'] }} @endforeach

Output 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.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-26

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固