ixnode / php-timezone
PHP Timezone - This library converts different timezone strings.
Installs: 1 471
Dependents: 3
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: ^8.0
- ixnode/php-naming-conventions: ^0.1.1
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.13
- ixnode/bash-version-manager: ^0.1.3
- phpmd/phpmd: ^2.13
- phpstan/phpstan: ^1.9
- phpunit/phpunit: ^9.5
- povils/phpmnd: ^3.0
- rector/rector: ^0.15.1
README
This library converts different timezone strings.
Usage
use Ixnode\PhpTimezone\Timezone;
Get country code from given timezone.
print (new Timezone('Europe/Berlin'))->getCountryCode(); // (string) "DE"
Get country name in english from given timezone.
print (new Timezone('Europe/Berlin'))->getCountryName(); // (string) "Germany"
Get country name in german from given timezone.
use Ixnode\PhpTimezone\Constants\Locale print (new Timezone('Europe/Berlin'))->getCountryName(Locale::DE_DE); // (string) "Deutschland"
Get some locale language names in different languages
use Ixnode\PhpTimezone\Constants\Locale use Ixnode\PhpTimezone\Constants\LocaleTranslation print LocaleTranslation::DE_DE[Locale::DE_DE]; // (string) "Deutsch (Deutschland)" print LocaleTranslation::DE_DE[Locale::ES_ES]; // (string) "Alemán (Alemania)" print LocaleTranslation::NN_NO[Locale::IT_IT]; // (string) "Norvegese nynorsk (Norvegia)"
etc.
Get some language names in different languages
use Ixnode\PhpTimezone\Constants\Language print Language::DE['de']; // (string) "Deutsch" print Language::DE['sv']; // (string) "Tyska" print Language::SV['en']; // (string) "Swedish"
etc.
Installation
composer require ixnode/php-timezone
vendor/bin/php-timezone -V
php-timezone 0.1.0 (12-19-2022 01:17:26) - Björn Hempel <bjoern@hempel.li>
Development
git clone git@github.com:ixnode/php-timezone.git && cd php-timezone
composer install
composer test
License
This tool is licensed under the MIT License - see the LICENSE file for details