adlawson/timezone
Sets PHP’s default timezone to UTC when date.timezone isn’t configured, preventing DateTime “not safe to rely on system timezone” warnings. Auto-runs on include (side effect), intended for end-user apps/frameworks, not libraries.
php.ini cannot be modified (e.g., shared hosting, Docker containers, or CI/CD pipelines).php.ini access.Adopt if:
DateTime/Carbon but encounters "It is not safe to rely on the system’s timezone settings" warnings.php.ini (e.g., shared hosting, cloud functions, or restricted environments).Look elsewhere if:
date.timezone already set in your deployment (e.g., Docker, Kubernetes, or cloud init scripts).vlucas/phpdotenv for config-driven solutions)."This is a 5-minute fix for a nagging PHP warning that could derail deployments or confuse developers. By auto-setting UTC as the default timezone, we eliminate flaky date/time behavior in environments where we can’t modify php.ini—like shared hosting or CI/CD pipelines. It’s a low-risk, high-reward solution for legacy systems or microservices where timezone inconsistencies cause bugs. The tradeoff? We accept UTC as a default (which is fine for APIs/internal tools) and ignore a minor PSR violation for simplicity. No dev time, no refactoring—just stability."
*"This package silently fixes the date.timezone warning by forcing UTC on load, which is critical for:
php.ini is locked.Pros:
✅ Zero config—just require 'vendor/autoload.php'.
✅ Works in frameworks/libraries (but not plugins).
✅ MIT-licensed, no dependencies.
Cons: ⚠️ Violates PSR-1 (auto-execution on include). ⚠️ Abandoned (last update: 2013)—only use if no alternatives exist. ⚠️ UTC-only: Not suitable for user-facing apps needing dynamic timezones.
Recommendation: Use as a last-resort fallback for environments where other solutions (e.g., Docker php.ini overrides, date_default_timezone_set() in bootstrap) aren’t possible. Pair with monitoring to alert if timezone warnings persist."*
How can I help you explore Laravel packages today?