baspa / laravel-timezones
Laravel package to generate arrays of available timezones to be used in lists.
Fund package maintenance!
baspa
Installs: 4 069
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: ^8.1
- illuminate/contracts: ^10.0
- spatie/laravel-package-tools: ^1.14.0
Requires (Dev)
- larastan/larastan: ^2.0.1
- laravel/pint: ^1.0
- nunomaduro/collision: ^7.8
- orchestra/testbench: ^8.8
- pestphp/pest: ^2.20
- pestphp/pest-plugin-arch: ^2.0
- pestphp/pest-plugin-laravel: ^2.0
- phpstan/extension-installer: ^1.1
- phpstan/phpstan-deprecation-rules: ^1.0
- phpstan/phpstan-phpunit: ^1.0
README
Laravel package to generate arrays of available timezones to be used in lists.
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.