baspa/laravel-timezones

Laravel package to generate arrays of available timezones to be used in lists.

Maintainers

👁 Baspa

Package info

github.com/Baspa/laravel-timezones

Homepage

pkg:composer/baspa/laravel-timezones

Fund package maintenance!

baspa

Statistics

Installs: 20 261

Dependents: 2

Suggesters: 0

Stars: 2

Open Issues: 1

v1.5.0 2026-06-09 08:20 UTC

Requires

Requires (Dev)

Suggests

None

Provides

None

Conflicts

None

Replaces

None

MIT 710595831a4fa83e0af80a0d6514f9a577c0c094

  • Baspa <hello.woop@baspa.dev>

laravellaravel-timezonesBaspa


README

👁 Banner

Laravel package to generate arrays of available timezones to be used in lists.

👁 Latest Version on Packagist
👁 GitHub Tests Action Status
👁 Code Coverage
👁 GitHub Code Style Action Status
👁 Total Downloads

The Laravel Timezones package is a convenient solution for Laravel developers who need to include a dropdown menu of timezones in their applications. This package simplifies the process of incorporating a timezone selection feature, saving developers valuable time and effort.

Installation

You can install the package via composer:

composer require baspa/laravel-timezones

Usage

Timezones grouped by continent

use Baspa\Timezones\Facades\Timezones;
// 
$groupedTimezones = Timezones::toArray(grouped: true);

All timezones

use Baspa\Timezones\Facades\Timezones;
// 
$timezones = Timezones::toArray();

Exclude continents

use Baspa\Timezones\Facades\Timezones;
// 
$timezones = Timezones::excludeContinents(['Africa', 'America'])
 ->toArray();

Show offset

$timezones = Timezones::showOffset()->toArray();
// or
$timezones = Timezones::showOffset(showOffset: false)->toArray();

Include general timezones

To include general timezones like GMT or UTC use the includeGeneral method.

$timezones = Timezones::includeGeneral()->toArray();

Show country names

To include country names alongside timezone labels use the showCountry method. This uses PHP's built-in timezone data combined with the league/iso3166 package to provide accurate country names.

// Basic usage with country names
$timezones = Timezones::showCountry()->toArray();
// Output: "Amsterdam (Netherlands)"

// Combined with other methods
$timezones = Timezones::showCountry()
 ->showOffset(false)
 ->toArray();
// Output: "Amsterdam (Netherlands)"

// With full continent names preserved
$timezones = Timezones::showCountry()->toArrayWithContinents();
// Output: "Europe / Amsterdam (Netherlands)"

// Grouped by continent with country names
$timezones = Timezones::showCountry()->toArray(grouped: true);

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Credits

License

The MIT License (MIT). Please see License File for more information.