merrick/laravel-shopify-timezones
Composer 安装命令:
composer require merrick/laravel-shopify-timezones
包简介
Laravel package providing the full list of Shopify supported timezones (hardcoded from IANA with friendly names and offsets)
README 文档
README
A lightweight Laravel package that provides the full list of timezones supported by Shopify, hardcoded from the IANA timezone database with friendly names and GMT offsets exactly as shown in Shopify Admin dropdown (e.g., "(GMT-05:00) Eastern Time (US & Canada)").
Features:
- Timezone code (IANA identifier), friendly display name, and offset.
- Sorted like Shopify Admin: Most used timezones first (US/Canada zones, Europe, Asia...), then alphabetical by display name.
- No database, no migrations, no API calls – pure PHP enum + static data for instant performance.
Perfect for:
- Timezone dropdowns in store settings or user profiles
- Matching Shopify store timezone exactly
- Validation rules for timezone inputs
- Scheduling features, order notifications, or analytics
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-timezones
For local development/testing:
Add to your project's composer.json:
"repositories": [ { "type": "vcs", "url": "https://github.com/merrick67/laravel-shopify-timezones" } ], "require": { "merrick/laravel-shopify-timezones": "dev-main" }
Then run:
composer update merrick/laravel-shopify-timezones
No manual configuration or provider registration needed – auto-registered.
Usage
1. Via Facade (Recommended)
use Merrick\ShopifyTimezones\Facades\ShopifyTimezones; // Get all timezone codes (IANA identifiers) as array $codes = ShopifyTimezones::codes(); // Get full Collection (sorted like Shopify Admin dropdown) $timezones = ShopifyTimezones::all(); // Example items: // ['code' => 'America/New_York', 'display' => '(GMT-05:00) Eastern Time (US & Canada)', 'offset' => 'GMT-05:00'] // ['code' => 'Europe/London', 'display' => '(GMT+00:00) Dublin, Edinburgh, Lisbon, London', 'offset' => 'GMT+00:00'] // Validate a timezone code $isValid = ShopifyTimezones::isValid('America/Chicago'); // true
2. Via Helper Functions
$codes = shopify_timezone_codes(); // array of codes $timezones = shopify_timezones(); // full collection with display $isValid = is_shopify_timezone('UTC'); // true
3. Via Service Container
use Merrick\ShopifyTimezones\Services\ShopifyTimezoneService; $service = app(ShopifyTimezoneService::class); $timezones = $service->all();
Blade Dropdown Example (Matches Shopify Admin Exactly)
<select name="timezone" required> @foreach (ShopifyTimezones::all() as $tz) <option value="{{ $tz['code'] }}"> {{ $tz['display'] }} </option> @endforeach </select>
Result preview (just like Shopify Admin General settings):
- (GMT-12:00) International Date Line West
- (GMT-11:00) American Samoa
- (GMT-10:00) Hawaii
- ...
- (GMT-05:00) Eastern Time (US & Canada)
- (GMT+00:00) Dublin, Edinburgh, Lisbon, London
- ...
Available Methods
| Method | Return Type | Description |
|---|---|---|
codes() |
array |
All IANA timezone codes |
all() |
Collection |
Full list with code, display, offset (Most used first) |
isValid(string $code) |
bool |
Check if timezone is supported by Shopify |
Why Hardcoded?
Shopify's timezone list is stable and based on IANA database. Hardcoding ensures:
- Exact match with Shopify Admin dropdown (friendly names + offsets)
- No external API dependencies
- Instant loading and zero runtime overhead
Version History
- 1.0.0: Initial release with full timezone list, friendly display, offset, and Most used sorting.
Contributing
Report missing timezones, suggest improvements, or open PRs on GitHub: https://github.com/merrick67/laravel-shopify-timezones
License
MIT License
See LICENSE for details.
merrick/laravel-shopify-timezones 适用场景与选型建议
merrick/laravel-shopify-timezones 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 01 月 26 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 merrick/laravel-shopify-timezones 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 merrick/laravel-shopify-timezones 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 1
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 29
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-01-26