https://github.com/baspa/laravel-timezones
This package offers a convenient solution for Laravel developers who need to include a dropdown menu of timezones in their applications
https://github.com/baspa/laravel-timezones
laravel timezones
Last synced: 5 months ago
JSON representation
This package offers a convenient solution for Laravel developers who need to include a dropdown menu of timezones in their applications
- Host: GitHub
- URL: https://github.com/baspa/laravel-timezones
- Owner: Baspa
- License: mit
- Created: 2024-01-29T11:50:43.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-26T14:38:15.000Z (7 months ago)
- Last Synced: 2025-05-01T19:16:23.887Z (5 months ago)
- Topics: laravel, timezones
- Language: PHP
- Homepage:
- Size: 106 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE.md
Awesome Lists containing this project
README

# Laravel package to generate arrays of available timezones to be used in lists.
[](https://packagist.org/packages/baspa/laravel-timezones)
[](https://github.com/baspa/laravel-timezones/actions?query=workflow%3Arun-tests+branch%3Amain)
[](https://github.com/baspa/laravel-timezones/actions?query=workflow%3A"Fix+PHP+code+style+issues"+branch%3Amain)
[](https://packagist.org/packages/baspa/laravel-timezones)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:
```bash
composer require baspa/laravel-timezones
```## Usage
### Timezones grouped by continent
```php
use Baspa\Timezones\Facades\Timezones;
//
$groupedTimezones = Timezones::toArray(grouped: true);
```### All timezones
```php
use Baspa\Timezones\Facades\Timezones;
//
$timezones = Timezones::toArray();
```### Exclude continents
```php
use Baspa\Timezones\Facades\Timezones;
//
$timezones = Timezones::excludeContinents(['Africa', 'America'])
->toArray();
```### Show offset
```php
$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.```php
$timezones = Timezones::includeGeneral()->toArray();
```## Testing
```bash
composer test
```## Changelog
Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.
## Contributing
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
## Credits
- [Baspa](https://github.com/Baspa)
- [All Contributors](../../contributors)## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.