joy2362/php-time-zone

A simple package that provide list of all timezone that php support

v1.3.0 2024-06-29 18:13 UTC

This package is auto-updated.

Last update: 2024-08-26 15:57:34 UTC


README

Latest Version MIT Licensed Build Status Total Downloads

A wrapper to enumerate PHP 7.x, 8.x timezones list.

Basics

  • Creates timezone arrays based on PHP's supported timezones with optional grouping by region
  • Lists are sorted by offset from high (+14:00) to low (-11:00)
  • Return as php arrays for whatever use your heart desires

Installation

You can install this package using Composer.

$ composer require joy2362/php-time-zone

Publish config file:

$ php artisan vendor:publish --provider="Joy2362\PhpTimezone\PhpTimeZoneServiceProvider" --tag="config"

Config

Usage

1. Get all timezone list with label and value pair

TimeZone::list();

2. Get all timezone list only value

TimeZone::listWithoutLabel();

3. Get all timezone list only label

TimeZone::listWithoutValue();

4. Get timezone list by a region

TimeZone::listByRegion('Asia');

5. Get timezone label from value

TimeZone::getLabelFromValue('Asia/Dhaka');

6. Get timezone value from label

TimeZone::getValueFromLabel('(GMT +06.00) Asia/Dhaka');

7. Get region list

TimeZone::getRegions();

8. Get supported zone list

TimeZone::getSupportedTimeZone();

Changelog

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

Contributing

Pull requests are more than welcome. You must follow the PSR coding standards.

Security

If you discover any security-related issues, please email abdullahzahidjoy@gmail.com instead of using the issue tracker.

Thanks to

This is based off some lovely work by: