joy2362/php-time-zone
Composer 安装命令:
composer require joy2362/php-time-zone
包简介
A simple package that provide list of all timezone that php support
README 文档
README
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
| Name | Default | Description |
|---|---|---|
| DEFAULT_TIME_ZONE | 'GMT' | label start value support 'GMT' and 'UTC' |
| TIME_DIFF_SYMBOL | '.' | seperator between time different hour and minutes |
| LABEL_FIELD_NAME | 'label' | timezone list array key name for label |
| VALUE_FIELD_NAME | 'value' | timezone list array key name for value |
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:
统计信息
- 总下载量: 2.3k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 17
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-01-30