baspa/laravel-timezones

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

Fund package maintenance!
baspa

v1.1.1 2024-03-26 12:45 UTC

This package is auto-updated.

Last update: 2024-04-29 12:21:10 UTC


README

Banner

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

Latest Version on Packagist GitHub Tests Action Status 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();

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.