laravel-validation-rules/timezone
Validate timezone input in Laravel with a dedicated timezone rule that checks values against PHP's supported timezone identifiers. Drop it into form requests or inline validators for a clear, reusable alternative to regex guessing.
Package: laravel-validation-rules/timezone — v1.7.0 (reviewed against an empty prior baseline)
Architecture fit
A single-purpose validation rule that extends Laravel's validator with a timezone rule, resolving the submitted value against the IANA/Olson timezone identifier database rather than a free-text or regex check. Architecturally this is a thin, framework-native adapter: it registers a validator extension through the package's service provider and imposes no persistence, transport, or domain-model opinions. For any application storing user, tenant, or scheduling configuration that includes a timezone, this is the correct layer to enforce the constraint — it keeps canonicalization at the boundary (FormRequest / Validator::make) instead of scattering in_array($value, timezone_identifiers_list()) checks across controllers and jobs. Low architectural commitment; trivially removable.
Integration feasibility
Very high. Adoption is a Composer require plus a one-line rule addition in existing FormRequests or inline validators. Laravel's package auto-discovery should register the service provider without touching config/app.php. No database migration, no config publication, no queue or cache dependency is expected for a stateless rule. The realistic effort is measured in hours, dominated by identifying every place a timezone string enters the system and deciding whether to validate, normalize, or both.
Technical risk
timezone_identifiers_list() output. A PHP patch release that ships new or retired IANA identifiers will silently change what your application accepts. Timezone IDs are deprecated and renamed (e.g. Europe/Kiev → Europe/Kyiv, America/Godthab → America/Nuuk), so accepted-value sets drift across environments even with the package version pinned.+02:00) and abbreviations (EST) will generally be rejected — confirm this matches product intent before rollout.Key questions
composer.json allow after 1.7.0?Stack fit
Native to Laravel. Works identically in Blade/FormRequest-driven monoliths, API-only services, and Livewire/Filament forms, since the rule is just a validator extension. Composes cleanly with required, nullable, sometimes, and conditional rules (Rule::when), and fits alongside other laravel-validation-rules packages already in the stack if present. No interaction with Eloquent, events, or queues.
Migration path
composer update --dry-run to confirm no transitive version churn, install.Compatibility
Expect Laravel 9–12 and PHP 8.1+ support, but verify against the post-1.7.0 composer.json rather than assuming. Because the rule is registered via auto-discovery, conflicts are rare; the realistic incompatibility is a Laravel major that reshapes the validator extension API, which would be a package-major event, not a 1.7.x one. Watch for coexistence with any in-house rule already aliased timezone — a duplicate alias will silently shadow one implementation.
Sequencing Dependency add → behavior test → surface audit → log-only rollout → enforcement → normalization layer → DB constraint. Do not couple this to the 1.7.0 upgrade; land the 1.7.0 bump as an isolated, low-risk dependency commit so a regression is trivially revertible.
Maintenance Minimal and mostly passive. Expect a handful of releases per year, usually dependency-range or CI work. The recurring cost is not the package but the tzdata lifecycle: every PHP image rebuild can alter the accepted identifier set, so builds should be reproducible (pinned base image digest) and the tz database version recorded. Budget a small periodic review — annually at minimum — to reconcile deprecated identifiers in persisted data.
Support
No vendor support; community/GitHub-issues only. Mitigation is straightforward given the size of the surface: the rule is a thin wrapper, so a fork or a two-line custom Validator::extend is a viable escape hatch. Avoid letting this package become load-bearing for anything beyond identifier validation.
Scaling Effectively zero marginal cost. Validation runs in-process with no I/O; identifier lookup is a static array in the PHP runtime. Negligible on request latency at any realistic volume and safe in high-throughput import or bulk-write paths, where it is far cheaper than per-row external validation.
Failure modes
timezone rule silently overridden by the package (or vice versa) after auto-discovery, producing behavior that diverges from code review.composer update could shift accepted values without any visible signal. Mitigate by pinning exact versions and reading the diff before bumping.Ramp-up Very low. Any Laravel developer can adopt this without documentation beyond the rule name. The genuine onboarding cost is product-facing, not engineering: aligning on whether the contract accepts raw IANA identifiers, human labels, or UTC offsets, and communicating that choice to API consumers and front-end teams. Recommend a short internal note capturing that decision plus the log-only-to-enforce rollout, so the next team inheriting the validation surface does not re-litigate it.
How can I help you explore Laravel packages today?