Download the PHP package brainlet-ali/laravel-convert-timezone without Composer
On this page you can find all versions of the php package brainlet-ali/laravel-convert-timezone. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download brainlet-ali/laravel-convert-timezone
More information about brainlet-ali/laravel-convert-timezone
Files in brainlet-ali/laravel-convert-timezone
Package laravel-convert-timezone
Short Description A minimal package to convert any model datetime fields from UTC to desired timezone.
License MIT
Homepage https://github.com/brainlet-ali/laravel-convert-timezone
Informations about the package laravel-convert-timezone
Laravel Convert Timezone
Seamlessly handle timezone conversions in your Laravel applications. This lightweight package automatically converts datetime fields to your users' local timezones without modifying your database, keeping everything in UTC while displaying dates and times in the correct timezone for each user.
Installation
Laravel
You can install the package via composer:
You can publish the config file with:
Why Use This Package?
Working with timezones in web applications is challenging. Store times in UTC? Display in user's timezone? Filter by local dates? This package solves these problems elegantly:
- ✅ Zero Database Changes - Keep storing everything in UTC
- ✅ Automatic Conversion - DateTime fields automatically display in the configured timezone
- ✅ Smart Filtering - Query by dates/times in any timezone without complex calculations
- ✅ Laravel Native - Works seamlessly with Eloquent models and query builder
- ✅ Minimal Setup - Just add a trait to your model and you're ready to go
Quick Start
Basic Usage
Configuration
Set your default timezone in the config file or .env
:
Automatic Conversion
Once you add the ConvertTZ
trait, all datetime fields (created_at
, updated_at
, etc.) are automatically converted:
Accessor Compatibility
The trait respects existing accessors - if you have a custom accessor for a datetime field, it won't interfere:
Documentation
For more detailed usage examples and advanced features, see the full documentation.
Requirements
- PHP 7.4+ or 8.0+
- Laravel 9.0+ | 10.0+ | 11.0+
- Doctrine DBAL 3.8+
Testing
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Reporting Issues
When creating an issue, please provide:
- Clear description of the problem
- Steps to reproduce the issue
- Expected vs actual behavior
- Laravel version and PHP version
- Any relevant error messages or stack traces
Security Issues
If you discover any security vulnerabilities, please email [email protected]
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-convert-timezone with dependencies
doctrine/dbal Version ^3.8.3
illuminate/contracts Version ^v9.0|^10|^v11.0