merrick/laravel-shopify-timezones

Laravel package providing the full list of Shopify supported timezones (hardcoded from IANA with friendly names and offsets)

Maintainers

Package info

github.com/merrick67/laravel-shopify-timezones

pkg:composer/merrick/laravel-shopify-timezones

Statistics

Installs: 1

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

1.0.0 2026-01-26 09:26 UTC

This package is auto-updated.

Last update: 2026-02-26 09:40:20 UTC


README

Packagist Version Downloads

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.